blob: 10fb24a0f1ccf42773f6fce67ca7b35a882e9341 [file] [log] [blame]
[email protected]cd57cc5a2012-10-12 22:43:411// Copyright 2011 The Chromium Authors. All rights reserved.
[email protected]0fb25002012-10-12 07:20:022// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
[email protected]cd57cc5a2012-10-12 22:43:414
[email protected]556fd292013-03-18 08:03:045#ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_
6#define CC_TREES_LAYER_TREE_HOST_IMPL_H_
[email protected]cd57cc5a2012-10-12 22:43:417
[email protected]c4040a522012-10-21 15:01:408#include "base/basictypes.h"
9#include "base/memory/scoped_ptr.h"
10#include "base/time.h"
[email protected]95e4e1a02013-03-18 07:09:0911#include "cc/animation/animation_events.h"
12#include "cc/animation/animation_registrar.h"
[email protected]681ccff2013-03-18 06:13:5213#include "cc/base/cc_export.h"
[email protected]3052b10f2013-03-18 07:41:2114#include "cc/input/input_handler.h"
15#include "cc/input/top_controls_manager_client.h"
[email protected]cc3cfaa2013-03-18 09:05:5216#include "cc/layers/render_pass_sink.h"
[email protected]7f0d825f2013-03-18 07:24:3017#include "cc/output/output_surface_client.h"
18#include "cc/output/renderer.h"
[email protected]89e8267a2013-03-18 07:50:5619#include "cc/quads/render_pass.h"
[email protected]e12dd0e2013-03-18 08:24:4020#include "cc/resources/tile_manager.h"
[email protected]b9dcf43a2013-01-09 00:15:2921#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4622#include "third_party/skia/include/core/SkColor.h"
[email protected]b9dcf43a2013-01-09 00:15:2923#include "third_party/skia/include/core/SkPicture.h"
[email protected]167ed9d52012-10-31 20:47:5824#include "ui/gfx/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4125
26namespace cc {
27
[email protected]96baf3e2012-10-22 23:09:5528class CompletionEvent;
[email protected]bf189f62012-12-18 03:42:1129class CompositorFrameMetadata;
[email protected]96baf3e2012-10-22 23:09:5530class DebugRectHistory;
31class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5532class LayerImpl;
33class LayerTreeHostImplTimeSourceAdapter;
[email protected]8bef40572012-12-11 21:38:0834class LayerTreeImpl;
[email protected]96baf3e2012-10-22 23:09:5535class PageScaleAnimation;
[email protected]0edbfbe9f2013-01-17 03:33:0336class PaintTimeCounter;
[email protected]1191d9d2013-02-02 06:00:3337class MemoryHistory;
[email protected]372bad5f2013-03-21 16:38:4338class RenderingStatsInstrumentation;
[email protected]96baf3e2012-10-22 23:09:5539class RenderPassDrawQuad;
40class ResourceProvider;
[email protected]3ba4cae2013-01-16 03:58:3841class TopControlsManager;
[email protected]cd57cc5a2012-10-12 22:43:4142struct RendererCapabilities;
[email protected]cd57cc5a2012-10-12 22:43:4143
[email protected]96baf3e2012-10-22 23:09:5544// LayerTreeHost->Proxy callback interface.
45class LayerTreeHostImplClient {
[email protected]c1bb5af2013-03-13 19:06:2746 public:
47 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
48 virtual void OnSwapBuffersCompleteOnImplThread() = 0;
49 virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
50 base::TimeDelta interval) = 0;
51 virtual void OnCanDrawStateChanged(bool can_draw) = 0;
52 virtual void OnHasPendingTreeStateChanged(bool has_pending_tree) = 0;
53 virtual void SetNeedsRedrawOnImplThread() = 0;
[email protected]86126792013-03-16 20:07:5454 virtual void DidInitializeVisibleTileOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2755 virtual void SetNeedsCommitOnImplThread() = 0;
56 virtual void SetNeedsManageTilesOnImplThread() = 0;
57 virtual void PostAnimationEventsToMainThreadOnImplThread(
58 scoped_ptr<AnimationEventsVector> events,
59 base::Time wall_clock_time) = 0;
60 // Returns true if resources were deleted by this call.
61 virtual bool ReduceContentsTextureMemoryOnImplThread(
62 size_t limit_bytes,
63 int priority_cutoff) = 0;
64 virtual void ReduceWastedContentsTextureMemoryOnImplThread() = 0;
65 virtual void SendManagedMemoryStats() = 0;
66 virtual bool IsInsideDraw() = 0;
67 virtual void RenewTreePriority() = 0;
[email protected]0fc818e2013-03-18 06:45:2068 virtual void RequestScrollbarAnimationOnImplThread(base::TimeDelta delay) = 0;
[email protected]cd57cc5a2012-10-12 22:43:4169};
70
[email protected]c1bb5af2013-03-13 19:06:2771// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
72// state.
[email protected]52347c842012-11-02 21:06:2073class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
74 public RendererClient,
[email protected]8947cbe2012-11-28 05:27:4375 public TileManagerClient,
[email protected]3ba4cae2013-01-16 03:58:3876 public OutputSurfaceClient,
77 public TopControlsManagerClient {
[email protected]e216fef02013-03-20 22:56:1078 public:
[email protected]c1bb5af2013-03-13 19:06:2779 typedef std::vector<LayerImpl*> LayerList;
[email protected]cd57cc5a2012-10-12 22:43:4180
[email protected]c1bb5af2013-03-13 19:06:2781 static scoped_ptr<LayerTreeHostImpl> Create(
82 const LayerTreeSettings& settings,
83 LayerTreeHostImplClient* client,
[email protected]372bad5f2013-03-21 16:38:4384 Proxy* proxy,
85 RenderingStatsInstrumentation* rendering_stats_instrumentation);
[email protected]c1bb5af2013-03-13 19:06:2786 virtual ~LayerTreeHostImpl();
[email protected]cd57cc5a2012-10-12 22:43:4187
[email protected]c1bb5af2013-03-13 19:06:2788 // InputHandlerClient implementation
89 virtual InputHandlerClient::ScrollStatus ScrollBegin(
90 gfx::Point viewport_point,
91 InputHandlerClient::ScrollInputType type) OVERRIDE;
92 virtual bool ScrollBy(gfx::Point viewport_point,
93 gfx::Vector2dF scroll_delta) OVERRIDE;
[email protected]be782f52013-03-23 21:36:1494 virtual bool ScrollVerticallyByPage(
95 gfx::Point viewport_point,
96 WebKit::WebScrollbar::ScrollDirection direction) OVERRIDE;
[email protected]c1bb5af2013-03-13 19:06:2797 virtual void ScrollEnd() OVERRIDE;
98 virtual void PinchGestureBegin() OVERRIDE;
99 virtual void PinchGestureUpdate(float magnify_delta,
100 gfx::Point anchor) OVERRIDE;
101 virtual void PinchGestureEnd() OVERRIDE;
102 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
103 bool anchor_point,
104 float page_scale,
105 base::TimeTicks start_time,
106 base::TimeDelta duration) OVERRIDE;
107 virtual void ScheduleAnimation() OVERRIDE;
108 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41109
[email protected]c1bb5af2013-03-13 19:06:27110 // TopControlsManagerClient implementation.
111 virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
112 virtual void setNeedsRedraw() OVERRIDE;
113 virtual bool haveRootScrollLayer() const OVERRIDE;
[email protected]3ba4cae2013-01-16 03:58:38114
[email protected]0fc818e2013-03-18 06:45:20115 void StartScrollbarAnimation(base::TimeTicks now);
116
[email protected]c1bb5af2013-03-13 19:06:27117 struct CC_EXPORT FrameData : public RenderPassSink {
118 FrameData();
119 ~FrameData();
[email protected]cd57cc5a2012-10-12 22:43:41120
[email protected]c1bb5af2013-03-13 19:06:27121 std::vector<gfx::Rect> occluding_screen_space_rects;
122 std::vector<gfx::Rect> non_occluding_screen_space_rects;
123 RenderPassList render_passes;
124 RenderPassIdHashMap render_passes_by_id;
125 const LayerList* render_surface_layer_list;
126 LayerList will_draw_layers;
127 bool contains_incomplete_tile;
[email protected]cd57cc5a2012-10-12 22:43:41128
[email protected]c1bb5af2013-03-13 19:06:27129 // RenderPassSink implementation.
130 virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE;
131 };
[email protected]cd57cc5a2012-10-12 22:43:41132
[email protected]c1bb5af2013-03-13 19:06:27133 virtual void BeginCommit();
134 virtual void CommitComplete();
135 virtual void Animate(base::TimeTicks monotonic_time,
136 base::Time wall_clock_time);
[email protected]cd57cc5a2012-10-12 22:43:41137
[email protected]c1bb5af2013-03-13 19:06:27138 void ManageTiles();
[email protected]f8456612013-03-19 20:56:09139 void SetAnticipatedDrawTime(base::TimeTicks time);
[email protected]8947cbe2012-11-28 05:27:43140
[email protected]c1bb5af2013-03-13 19:06:27141 // Returns false if problems occured preparing the frame, and we should try
142 // to avoid displaying the frame. If prepareToDraw is called, DidDrawAllLayers
143 // must also be called, regardless of whether DrawLayers is called between the
144 // two.
145 virtual bool PrepareToDraw(FrameData* frame);
[email protected]f0c2a242013-03-15 19:34:52146 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
[email protected]c1bb5af2013-03-13 19:06:27147 // Must be called if and only if PrepareToDraw was called.
148 void DidDrawAllLayers(const FrameData& frame);
[email protected]cd57cc5a2012-10-12 22:43:41149
[email protected]c1bb5af2013-03-13 19:06:27150 const LayerTreeSettings& settings() const { return settings_; }
[email protected]cd57cc5a2012-10-12 22:43:41151
[email protected]ffb2720f2013-03-15 19:18:37152 // Returns the currently visible viewport size in DIP. This value excludes
153 // the URL bar and non-overlay scrollbars.
154 gfx::SizeF VisibleViewportSize() const;
155
[email protected]c1bb5af2013-03-13 19:06:27156 // RendererClient implementation
157 private:
158 virtual gfx::Size DeviceViewportSize() const OVERRIDE;
159 virtual const LayerTreeSettings& Settings() const OVERRIDE;
160 public:
161 virtual void DidLoseOutputSurface() OVERRIDE;
162 virtual void OnSwapBuffersComplete() OVERRIDE;
163 virtual void SetFullRootLayerDamage() OVERRIDE;
164 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
165 OVERRIDE;
166 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
167 OVERRIDE;
168 virtual bool HasImplThread() const OVERRIDE;
169 virtual bool ShouldClearRootRenderPass() const OVERRIDE;
170 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
[email protected]8947cbe2012-11-28 05:27:43171
[email protected]c1bb5af2013-03-13 19:06:27172 // TileManagerClient implementation.
173 virtual void ScheduleManageTiles() OVERRIDE;
[email protected]86126792013-03-16 20:07:54174 virtual void DidInitializeVisibleTile() OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41175
[email protected]c1bb5af2013-03-13 19:06:27176 // OutputSurfaceClient implementation.
177 virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
178 base::TimeDelta interval) OVERRIDE;
179 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
180 OVERRIDE;
[email protected]3b31c6ac2012-12-06 21:27:29181
[email protected]c1bb5af2013-03-13 19:06:27182 // Called from LayerTreeImpl.
183 void OnCanDrawStateChangedForTree();
[email protected]cd57cc5a2012-10-12 22:43:41184
[email protected]c1bb5af2013-03-13 19:06:27185 // Implementation
186 bool CanDraw();
187 OutputSurface* output_surface() const { return output_surface_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41188
[email protected]c1bb5af2013-03-13 19:06:27189 std::string LayerTreeAsText() const;
190 std::string LayerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41191
[email protected]c1bb5af2013-03-13 19:06:27192 void FinishAllRendering();
193 int SourceAnimationFrameNumber() const;
[email protected]cd57cc5a2012-10-12 22:43:41194
[email protected]c1bb5af2013-03-13 19:06:27195 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
196 bool IsContextLost();
197 TileManager* tile_manager() { return tile_manager_.get(); }
198 Renderer* renderer() { return renderer_.get(); }
199 const RendererCapabilities& GetRendererCapabilities() const;
[email protected]cd57cc5a2012-10-12 22:43:41200
[email protected]a7252f12013-03-15 04:57:34201 virtual bool SwapBuffers();
[email protected]cd57cc5a2012-10-12 22:43:41202
[email protected]c1bb5af2013-03-13 19:06:27203 void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
[email protected]cd57cc5a2012-10-12 22:43:41204
[email protected]c1bb5af2013-03-13 19:06:27205 LayerTreeImpl* active_tree() { return active_tree_.get(); }
206 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
207 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
208 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
209 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
210 void CreatePendingTree();
211 void CheckForCompletedTileUploads();
212 virtual bool ActivatePendingTreeIfNeeded();
[email protected]cd57cc5a2012-10-12 22:43:41213
[email protected]c1bb5af2013-03-13 19:06:27214 // Shortcuts to layers on the active tree.
215 LayerImpl* RootLayer() const;
216 LayerImpl* RootScrollLayer() const;
217 LayerImpl* CurrentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41218
[email protected]c1bb5af2013-03-13 19:06:27219 virtual void SetVisible(bool visible);
220 bool visible() const { return visible_; }
[email protected]cd57cc5a2012-10-12 22:43:41221
[email protected]d7eb8c72013-03-23 22:57:13222 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
223
[email protected]c1bb5af2013-03-13 19:06:27224 size_t memory_allocation_limit_bytes() const {
[email protected]46b8acc2013-03-19 22:38:35225 return managed_memory_policy_.bytes_limit_when_visible;
[email protected]c1bb5af2013-03-13 19:06:27226 }
[email protected]cd57cc5a2012-10-12 22:43:41227
[email protected]c1bb5af2013-03-13 19:06:27228 void SetViewportSize(gfx::Size layout_viewport_size,
229 gfx::Size device_viewport_size);
230 gfx::Size layout_viewport_size() const { return layout_viewport_size_; }
231 gfx::Size device_viewport_size() const { return device_viewport_size_; }
[email protected]cd57cc5a2012-10-12 22:43:41232
[email protected]d9083762013-03-24 01:36:40233 void SetOverdrawBottomHeight(float overdraw_bottom_height);
234 float overdraw_bottom_height() const { return overdraw_bottom_height_; }
235
[email protected]c1bb5af2013-03-13 19:06:27236 void SetDeviceScaleFactor(float device_scale_factor);
237 float device_scale_factor() const { return device_scale_factor_; }
[email protected]cd57cc5a2012-10-12 22:43:41238
[email protected]c1bb5af2013-03-13 19:06:27239 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
[email protected]cd57cc5a2012-10-12 22:43:41240
[email protected]c1bb5af2013-03-13 19:06:27241 void StartPageScaleAnimation(gfx::Vector2d target_offset,
242 bool use_anchor,
243 float scale,
244 base::TimeDelta duration);
[email protected]cd57cc5a2012-10-12 22:43:41245
[email protected]c1bb5af2013-03-13 19:06:27246 bool needs_animate_layers() const {
247 return !animation_registrar_->active_animation_controllers().empty();
248 }
[email protected]cd57cc5a2012-10-12 22:43:41249
[email protected]c1bb5af2013-03-13 19:06:27250 void SendManagedMemoryStats(
251 size_t memory_visible_bytes,
252 size_t memory_visible_and_nearby_bytes,
253 size_t memoryUseBytes);
254
255 FrameRateCounter* fps_counter() {
256 return fps_counter_.get();
257 }
258 PaintTimeCounter* paint_time_counter() {
259 return paint_time_counter_.get();
260 }
261 MemoryHistory* memory_history() {
262 return memory_history_.get();
263 }
264 DebugRectHistory* debug_rect_history() {
265 return debug_rect_history_.get();
266 }
267 ResourceProvider* resource_provider() {
268 return resource_provider_.get();
269 }
270 TopControlsManager* top_controls_manager() {
271 return top_controls_manager_.get();
272 }
[email protected]ff762fb2012-12-12 19:18:37273
[email protected]c1bb5af2013-03-13 19:06:27274 Proxy* proxy() const { return proxy_; }
[email protected]cd57cc5a2012-10-12 22:43:41275
[email protected]c1bb5af2013-03-13 19:06:27276 AnimationRegistrar* animation_registrar() const {
277 return animation_registrar_.get();
278 }
[email protected]de4afb5e2012-12-20 00:11:34279
[email protected]c1bb5af2013-03-13 19:06:27280 void SetDebugState(const LayerTreeDebugState& debug_state);
281 const LayerTreeDebugState& debug_state() const { return debug_state_; }
[email protected]f511afb2012-11-30 01:55:20282
[email protected]c1bb5af2013-03-13 19:06:27283 void SavePaintTime(const base::TimeDelta& total_paint_time,
284 int commit_number);
[email protected]0edbfbe9f2013-01-17 03:33:03285
[email protected]c1bb5af2013-03-13 19:06:27286 class CC_EXPORT CullRenderPassesWithCachedTextures {
287 public:
288 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
289 const FrameData& frame) const;
[email protected]cd57cc5a2012-10-12 22:43:41290
[email protected]c1bb5af2013-03-13 19:06:27291 // Iterates from the root first, in order to remove the surfaces closest
292 // to the root with cached textures, and all surfaces that draw into
293 // them.
294 size_t RenderPassListBegin(const RenderPassList& list) const {
295 return list.size() - 1;
296 }
297 size_t RenderPassListEnd(const RenderPassList& list) const { return 0 - 1; }
298 size_t RenderPassListNext(size_t it) const { return it - 1; }
[email protected]cd57cc5a2012-10-12 22:43:41299
[email protected]c1bb5af2013-03-13 19:06:27300 CullRenderPassesWithCachedTextures(Renderer& renderer)
301 : renderer_(renderer) {}
302 private:
303 Renderer& renderer_;
304 };
[email protected]cd57cc5a2012-10-12 22:43:41305
[email protected]c1bb5af2013-03-13 19:06:27306 class CC_EXPORT CullRenderPassesWithNoQuads {
307 public:
308 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
309 const FrameData& frame) const;
[email protected]cd57cc5a2012-10-12 22:43:41310
[email protected]c1bb5af2013-03-13 19:06:27311 // Iterates in draw order, so that when a surface is removed, and its
312 // target becomes empty, then its target can be removed also.
313 size_t RenderPassListBegin(const RenderPassList& list) const { return 0; }
314 size_t RenderPassListEnd(const RenderPassList& list) const {
315 return list.size();
316 }
317 size_t RenderPassListNext(size_t it) const { return it + 1; }
318 };
[email protected]cd57cc5a2012-10-12 22:43:41319
[email protected]c1bb5af2013-03-13 19:06:27320 template <typename RenderPassCuller>
321 static void RemoveRenderPasses(RenderPassCuller culler, FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41322
[email protected]c1bb5af2013-03-13 19:06:27323 skia::RefPtr<SkPicture> CapturePicture();
[email protected]b9dcf43a2013-01-09 00:15:29324
[email protected]c1bb5af2013-03-13 19:06:27325 bool pinch_gesture_active() const { return pinch_gesture_active_; }
[email protected]166db5c82013-01-09 23:54:31326
[email protected]c1bb5af2013-03-13 19:06:27327 void SetTreePriority(TreePriority priority);
[email protected]362f1e8b2013-01-21 16:54:30328
[email protected]c1bb5af2013-03-13 19:06:27329 void BeginNextFrame();
330 base::TimeTicks CurrentFrameTime();
[email protected]829ad972013-01-28 23:36:10331
[email protected]c1bb5af2013-03-13 19:06:27332 scoped_ptr<base::Value> AsValue() const;
333 scoped_ptr<base::Value> ActivationStateAsValue() const;
334 scoped_ptr<base::Value> FrameStateAsValue() const;
[email protected]131a0c22013-02-12 18:31:08335
[email protected]c1bb5af2013-03-13 19:06:27336 bool page_scale_animation_active() const { return !!page_scale_animation_; }
[email protected]498ddd02013-02-28 23:59:25337
[email protected]c1bb5af2013-03-13 19:06:27338 protected:
[email protected]372bad5f2013-03-21 16:38:43339 LayerTreeHostImpl(
340 const LayerTreeSettings& settings,
341 LayerTreeHostImplClient* client,
342 Proxy* proxy,
343 RenderingStatsInstrumentation* rendering_stats_instrumentation);
[email protected]c1bb5af2013-03-13 19:06:27344 void ActivatePendingTree();
[email protected]cd57cc5a2012-10-12 22:43:41345
[email protected]c1bb5af2013-03-13 19:06:27346 // Virtual for testing.
347 virtual void AnimateLayers(base::TimeTicks monotonic_time,
348 base::Time wall_clock_time);
349 virtual void UpdateAnimationState();
[email protected]cd57cc5a2012-10-12 22:43:41350
[email protected]c1bb5af2013-03-13 19:06:27351 // Virtual for testing.
352 virtual base::TimeDelta LowFrequencyAnimationInterval() const;
[email protected]cd57cc5a2012-10-12 22:43:41353
[email protected]c1bb5af2013-03-13 19:06:27354 const AnimationRegistrar::AnimationControllerMap&
355 active_animation_controllers() const {
356 return animation_registrar_->active_animation_controllers();
357 }
[email protected]de4afb5e2012-12-20 00:11:34358
[email protected]c1bb5af2013-03-13 19:06:27359 LayerTreeHostImplClient* client_;
360 Proxy* proxy_;
[email protected]cd57cc5a2012-10-12 22:43:41361
[email protected]c1bb5af2013-03-13 19:06:27362 private:
363 void AnimatePageScale(base::TimeTicks monotonic_time);
364 void AnimateScrollbars(base::TimeTicks monotonic_time);
[email protected]ffb2720f2013-03-15 19:18:37365 void AnimateTopControls(base::TimeTicks monotonic_time);
[email protected]2d692992012-12-19 01:19:32366
[email protected]c1bb5af2013-03-13 19:06:27367 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
368 LayerImpl* layerImpl,
369 float scaleFromViewportToScreenSpace,
370 gfx::PointF viewportPoint,
371 gfx::Vector2dF viewportDelta);
[email protected]615c78a2013-01-24 23:44:16372
[email protected]c1bb5af2013-03-13 19:06:27373 void UpdateMaxScrollOffset();
374 void TrackDamageForAllSurfaces(LayerImpl* root_draw_layer,
375 const LayerList& render_surface_layer_list);
[email protected]cd57cc5a2012-10-12 22:43:41376
[email protected]c1bb5af2013-03-13 19:06:27377 // Returns false if the frame should not be displayed. This function should
378 // only be called from prepareToDraw, as didDrawAllLayers must be called
379 // if this helper function is called.
380 bool CalculateRenderPasses(FrameData* frame);
381 void SetBackgroundTickingEnabled(bool enabled);
[email protected]cd57cc5a2012-10-12 22:43:41382
[email protected]c1bb5af2013-03-13 19:06:27383 void SendDidLoseOutputSurfaceRecursive(LayerImpl* current);
384 void ClearRenderSurfaces();
385 bool EnsureRenderSurfaceLayerList();
386 void ClearCurrentlyScrollingLayer();
[email protected]cd57cc5a2012-10-12 22:43:41387
[email protected]c1bb5af2013-03-13 19:06:27388 void AnimateScrollbarsRecursive(LayerImpl* layer,
389 base::TimeTicks time);
[email protected]cd57cc5a2012-10-12 22:43:41390
[email protected]c1bb5af2013-03-13 19:06:27391 void DumpRenderSurfaces(std::string* str,
392 int indent,
393 const LayerImpl* layer) const;
[email protected]cd57cc5a2012-10-12 22:43:41394
[email protected]c1bb5af2013-03-13 19:06:27395 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer);
[email protected]b9dcf43a2013-01-09 00:15:29396
[email protected]0fc818e2013-03-18 06:45:20397 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time);
398
[email protected]c1bb5af2013-03-13 19:06:27399 scoped_ptr<OutputSurface> output_surface_;
400 scoped_ptr<ResourceProvider> resource_provider_;
401 scoped_ptr<Renderer> renderer_;
402 scoped_ptr<TileManager> tile_manager_;
[email protected]3b31c6ac2012-12-06 21:27:29403
[email protected]c1bb5af2013-03-13 19:06:27404 // Tree currently being drawn.
405 scoped_ptr<LayerTreeImpl> active_tree_;
[email protected]3b31c6ac2012-12-06 21:27:29406
[email protected]c1bb5af2013-03-13 19:06:27407 // In impl-side painting mode, tree with possibly incomplete rasterized
408 // content. May be promoted to active by ActivatePendingTreeIfNeeded().
409 scoped_ptr<LayerTreeImpl> pending_tree_;
[email protected]48871fc2013-01-23 07:36:51410
[email protected]c1bb5af2013-03-13 19:06:27411 // In impl-side painting mode, inert tree with layers that can be recycled
412 // by the next sync from the main thread.
413 scoped_ptr<LayerTreeImpl> recycle_tree_;
[email protected]48871fc2013-01-23 07:36:51414
[email protected]c1bb5af2013-03-13 19:06:27415 bool did_lock_scrolling_layer_;
416 bool should_bubble_scrolls_;
417 bool wheel_scrolling_;
418 LayerTreeSettings settings_;
419 LayerTreeDebugState debug_state_;
420 gfx::Size layout_viewport_size_;
421 gfx::Size device_viewport_size_;
[email protected]d9083762013-03-24 01:36:40422 float overdraw_bottom_height_;
[email protected]c1bb5af2013-03-13 19:06:27423 float device_scale_factor_;
424 bool visible_;
425 ManagedMemoryPolicy managed_memory_policy_;
[email protected]cd57cc5a2012-10-12 22:43:41426
[email protected]c1bb5af2013-03-13 19:06:27427 bool pinch_gesture_active_;
428 gfx::Point previous_pinch_anchor_;
[email protected]cd57cc5a2012-10-12 22:43:41429
[email protected]c1bb5af2013-03-13 19:06:27430 // This is set by AnimateLayers() and used by UpdateAnimationState()
431 // when sending animation events to the main thread.
432 base::Time last_animation_time_;
[email protected]6ad55bb22013-02-08 21:34:33433
[email protected]c1bb5af2013-03-13 19:06:27434 scoped_ptr<TopControlsManager> top_controls_manager_;
[email protected]3ba4cae2013-01-16 03:58:38435
[email protected]c1bb5af2013-03-13 19:06:27436 scoped_ptr<PageScaleAnimation> page_scale_animation_;
[email protected]cd57cc5a2012-10-12 22:43:41437
[email protected]c1bb5af2013-03-13 19:06:27438 // This is used for ticking animations slowly when hidden.
439 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_;
[email protected]cd57cc5a2012-10-12 22:43:41440
[email protected]c1bb5af2013-03-13 19:06:27441 scoped_ptr<FrameRateCounter> fps_counter_;
442 scoped_ptr<PaintTimeCounter> paint_time_counter_;
443 scoped_ptr<MemoryHistory> memory_history_;
444 scoped_ptr<DebugRectHistory> debug_rect_history_;
[email protected]cd57cc5a2012-10-12 22:43:41445
[email protected]c1bb5af2013-03-13 19:06:27446 int64 num_impl_thread_scrolls_;
447 int64 num_main_thread_scrolls_;
[email protected]cd57cc5a2012-10-12 22:43:41448
[email protected]c1bb5af2013-03-13 19:06:27449 int64 cumulative_num_layers_drawn_;
[email protected]f2bbb4e2012-12-07 21:40:49450
[email protected]c1bb5af2013-03-13 19:06:27451 int64 cumulative_num_missing_tiles_;
[email protected]9c2be6a2012-11-27 19:16:10452
[email protected]c1bb5af2013-03-13 19:06:27453 size_t last_sent_memory_visible_bytes_;
454 size_t last_sent_memory_visible_and_nearby_bytes_;
455 size_t last_sent_memory_use_bytes_;
[email protected]d3afa112012-12-08 06:24:28456
[email protected]c1bb5af2013-03-13 19:06:27457 base::TimeTicks current_frame_time_;
[email protected]829ad972013-01-28 23:36:10458
[email protected]c1bb5af2013-03-13 19:06:27459 scoped_ptr<AnimationRegistrar> animation_registrar_;
[email protected]de4afb5e2012-12-20 00:11:34460
[email protected]372bad5f2013-03-21 16:38:43461 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
462
[email protected]c1bb5af2013-03-13 19:06:27463 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41464};
465
[email protected]0023e8b2012-10-15 12:52:45466} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41467
[email protected]556fd292013-03-18 08:03:04468#endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_