blob: 5c2dc40b603cd40c71ca49928617916bd207b406 [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]7f0d825f2013-03-18 07:24:3016#include "cc/output/output_surface_client.h"
17#include "cc/output/renderer.h"
[email protected]89e8267a2013-03-18 07:50:5618#include "cc/quads/render_pass.h"
[email protected]55a124d02012-10-22 03:07:1319#include "cc/render_pass_sink.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]96baf3e2012-10-22 23:09:5538class RenderPassDrawQuad;
39class ResourceProvider;
[email protected]3ba4cae2013-01-16 03:58:3840class TopControlsManager;
[email protected]cd57cc5a2012-10-12 22:43:4141struct RendererCapabilities;
[email protected]96baf3e2012-10-22 23:09:5542struct RenderingStats;
[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]c1bb5af2013-03-13 19:06:2778 typedef std::vector<LayerImpl*> LayerList;
[email protected]cd57cc5a2012-10-12 22:43:4179
[email protected]c1bb5af2013-03-13 19:06:2780 public:
81 static scoped_ptr<LayerTreeHostImpl> Create(
82 const LayerTreeSettings& settings,
83 LayerTreeHostImplClient* client,
84 Proxy* proxy);
85 virtual ~LayerTreeHostImpl();
[email protected]cd57cc5a2012-10-12 22:43:4186
[email protected]c1bb5af2013-03-13 19:06:2787 // InputHandlerClient implementation
88 virtual InputHandlerClient::ScrollStatus ScrollBegin(
89 gfx::Point viewport_point,
90 InputHandlerClient::ScrollInputType type) OVERRIDE;
91 virtual bool ScrollBy(gfx::Point viewport_point,
92 gfx::Vector2dF scroll_delta) OVERRIDE;
93 virtual void ScrollEnd() OVERRIDE;
94 virtual void PinchGestureBegin() OVERRIDE;
95 virtual void PinchGestureUpdate(float magnify_delta,
96 gfx::Point anchor) OVERRIDE;
97 virtual void PinchGestureEnd() OVERRIDE;
98 virtual void StartPageScaleAnimation(gfx::Vector2d target_offset,
99 bool anchor_point,
100 float page_scale,
101 base::TimeTicks start_time,
102 base::TimeDelta duration) OVERRIDE;
103 virtual void ScheduleAnimation() OVERRIDE;
104 virtual bool HaveTouchEventHandlersAt(gfx::Point viewport_port) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41105
[email protected]c1bb5af2013-03-13 19:06:27106 // TopControlsManagerClient implementation.
107 virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
108 virtual void setNeedsRedraw() OVERRIDE;
109 virtual bool haveRootScrollLayer() const OVERRIDE;
[email protected]3ba4cae2013-01-16 03:58:38110
[email protected]0fc818e2013-03-18 06:45:20111 void StartScrollbarAnimation(base::TimeTicks now);
112
[email protected]c1bb5af2013-03-13 19:06:27113 struct CC_EXPORT FrameData : public RenderPassSink {
114 FrameData();
115 ~FrameData();
[email protected]cd57cc5a2012-10-12 22:43:41116
[email protected]c1bb5af2013-03-13 19:06:27117 std::vector<gfx::Rect> occluding_screen_space_rects;
118 std::vector<gfx::Rect> non_occluding_screen_space_rects;
119 RenderPassList render_passes;
120 RenderPassIdHashMap render_passes_by_id;
121 const LayerList* render_surface_layer_list;
122 LayerList will_draw_layers;
123 bool contains_incomplete_tile;
[email protected]cd57cc5a2012-10-12 22:43:41124
[email protected]c1bb5af2013-03-13 19:06:27125 // RenderPassSink implementation.
126 virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE;
127 };
[email protected]cd57cc5a2012-10-12 22:43:41128
[email protected]c1bb5af2013-03-13 19:06:27129 virtual void BeginCommit();
130 virtual void CommitComplete();
131 virtual void Animate(base::TimeTicks monotonic_time,
132 base::Time wall_clock_time);
[email protected]cd57cc5a2012-10-12 22:43:41133
[email protected]c1bb5af2013-03-13 19:06:27134 void ManageTiles();
[email protected]8947cbe2012-11-28 05:27:43135
[email protected]c1bb5af2013-03-13 19:06:27136 // Returns false if problems occured preparing the frame, and we should try
137 // to avoid displaying the frame. If prepareToDraw is called, DidDrawAllLayers
138 // must also be called, regardless of whether DrawLayers is called between the
139 // two.
140 virtual bool PrepareToDraw(FrameData* frame);
[email protected]f0c2a242013-03-15 19:34:52141 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
[email protected]c1bb5af2013-03-13 19:06:27142 // Must be called if and only if PrepareToDraw was called.
143 void DidDrawAllLayers(const FrameData& frame);
[email protected]cd57cc5a2012-10-12 22:43:41144
[email protected]c1bb5af2013-03-13 19:06:27145 const LayerTreeSettings& settings() const { return settings_; }
[email protected]cd57cc5a2012-10-12 22:43:41146
[email protected]ffb2720f2013-03-15 19:18:37147 // Returns the currently visible viewport size in DIP. This value excludes
148 // the URL bar and non-overlay scrollbars.
149 gfx::SizeF VisibleViewportSize() const;
150
[email protected]c1bb5af2013-03-13 19:06:27151 // RendererClient implementation
152 private:
153 virtual gfx::Size DeviceViewportSize() const OVERRIDE;
154 virtual const LayerTreeSettings& Settings() const OVERRIDE;
155 public:
156 virtual void DidLoseOutputSurface() OVERRIDE;
157 virtual void OnSwapBuffersComplete() OVERRIDE;
158 virtual void SetFullRootLayerDamage() OVERRIDE;
159 virtual void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
160 OVERRIDE;
161 virtual void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy)
162 OVERRIDE;
163 virtual bool HasImplThread() const OVERRIDE;
164 virtual bool ShouldClearRootRenderPass() const OVERRIDE;
165 virtual CompositorFrameMetadata MakeCompositorFrameMetadata() const OVERRIDE;
[email protected]8947cbe2012-11-28 05:27:43166
[email protected]c1bb5af2013-03-13 19:06:27167 // TileManagerClient implementation.
168 virtual void ScheduleManageTiles() OVERRIDE;
[email protected]86126792013-03-16 20:07:54169 virtual void DidInitializeVisibleTile() OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41170
[email protected]c1bb5af2013-03-13 19:06:27171 // OutputSurfaceClient implementation.
172 virtual void OnVSyncParametersChanged(base::TimeTicks timebase,
173 base::TimeDelta interval) OVERRIDE;
174 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck& ack)
175 OVERRIDE;
[email protected]3b31c6ac2012-12-06 21:27:29176
[email protected]c1bb5af2013-03-13 19:06:27177 // Called from LayerTreeImpl.
178 void OnCanDrawStateChangedForTree();
[email protected]cd57cc5a2012-10-12 22:43:41179
[email protected]c1bb5af2013-03-13 19:06:27180 // Implementation
181 bool CanDraw();
182 OutputSurface* output_surface() const { return output_surface_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41183
[email protected]c1bb5af2013-03-13 19:06:27184 std::string LayerTreeAsText() const;
185 std::string LayerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41186
[email protected]c1bb5af2013-03-13 19:06:27187 void FinishAllRendering();
188 int SourceAnimationFrameNumber() const;
[email protected]cd57cc5a2012-10-12 22:43:41189
[email protected]c1bb5af2013-03-13 19:06:27190 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
191 bool IsContextLost();
192 TileManager* tile_manager() { return tile_manager_.get(); }
193 Renderer* renderer() { return renderer_.get(); }
194 const RendererCapabilities& GetRendererCapabilities() const;
[email protected]cd57cc5a2012-10-12 22:43:41195
[email protected]a7252f12013-03-15 04:57:34196 virtual bool SwapBuffers();
[email protected]cd57cc5a2012-10-12 22:43:41197
[email protected]c1bb5af2013-03-13 19:06:27198 void Readback(void* pixels, gfx::Rect rect_in_device_viewport);
[email protected]cd57cc5a2012-10-12 22:43:41199
[email protected]c1bb5af2013-03-13 19:06:27200 LayerTreeImpl* active_tree() { return active_tree_.get(); }
201 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
202 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
203 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
204 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
205 void CreatePendingTree();
206 void CheckForCompletedTileUploads();
207 virtual bool ActivatePendingTreeIfNeeded();
[email protected]cd57cc5a2012-10-12 22:43:41208
[email protected]c1bb5af2013-03-13 19:06:27209 // Shortcuts to layers on the active tree.
210 LayerImpl* RootLayer() const;
211 LayerImpl* RootScrollLayer() const;
212 LayerImpl* CurrentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41213
[email protected]c1bb5af2013-03-13 19:06:27214 virtual void SetVisible(bool visible);
215 bool visible() const { return visible_; }
[email protected]cd57cc5a2012-10-12 22:43:41216
[email protected]c1bb5af2013-03-13 19:06:27217 size_t memory_allocation_limit_bytes() const {
218 return managed_memory_policy_.bytesLimitWhenVisible;
219 }
[email protected]cd57cc5a2012-10-12 22:43:41220
[email protected]c1bb5af2013-03-13 19:06:27221 void SetViewportSize(gfx::Size layout_viewport_size,
222 gfx::Size device_viewport_size);
223 gfx::Size layout_viewport_size() const { return layout_viewport_size_; }
224 gfx::Size device_viewport_size() const { return device_viewport_size_; }
[email protected]cd57cc5a2012-10-12 22:43:41225
[email protected]c1bb5af2013-03-13 19:06:27226 void SetDeviceScaleFactor(float device_scale_factor);
227 float device_scale_factor() const { return device_scale_factor_; }
[email protected]cd57cc5a2012-10-12 22:43:41228
[email protected]c1bb5af2013-03-13 19:06:27229 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
[email protected]cd57cc5a2012-10-12 22:43:41230
[email protected]c1bb5af2013-03-13 19:06:27231 void StartPageScaleAnimation(gfx::Vector2d target_offset,
232 bool use_anchor,
233 float scale,
234 base::TimeDelta duration);
[email protected]cd57cc5a2012-10-12 22:43:41235
[email protected]c1bb5af2013-03-13 19:06:27236 bool needs_animate_layers() const {
237 return !animation_registrar_->active_animation_controllers().empty();
238 }
[email protected]cd57cc5a2012-10-12 22:43:41239
[email protected]c1bb5af2013-03-13 19:06:27240 void CollectRenderingStats(RenderingStats* stats) const;
[email protected]d3afa112012-12-08 06:24:28241
[email protected]c1bb5af2013-03-13 19:06:27242 void SendManagedMemoryStats(
243 size_t memory_visible_bytes,
244 size_t memory_visible_and_nearby_bytes,
245 size_t memoryUseBytes);
246
247 FrameRateCounter* fps_counter() {
248 return fps_counter_.get();
249 }
250 PaintTimeCounter* paint_time_counter() {
251 return paint_time_counter_.get();
252 }
253 MemoryHistory* memory_history() {
254 return memory_history_.get();
255 }
256 DebugRectHistory* debug_rect_history() {
257 return debug_rect_history_.get();
258 }
259 ResourceProvider* resource_provider() {
260 return resource_provider_.get();
261 }
262 TopControlsManager* top_controls_manager() {
263 return top_controls_manager_.get();
264 }
[email protected]ff762fb2012-12-12 19:18:37265
[email protected]c1bb5af2013-03-13 19:06:27266 Proxy* proxy() const { return proxy_; }
[email protected]cd57cc5a2012-10-12 22:43:41267
[email protected]c1bb5af2013-03-13 19:06:27268 AnimationRegistrar* animation_registrar() const {
269 return animation_registrar_.get();
270 }
[email protected]de4afb5e2012-12-20 00:11:34271
[email protected]c1bb5af2013-03-13 19:06:27272 void SetDebugState(const LayerTreeDebugState& debug_state);
273 const LayerTreeDebugState& debug_state() const { return debug_state_; }
[email protected]f511afb2012-11-30 01:55:20274
[email protected]c1bb5af2013-03-13 19:06:27275 void SavePaintTime(const base::TimeDelta& total_paint_time,
276 int commit_number);
[email protected]0edbfbe9f2013-01-17 03:33:03277
[email protected]c1bb5af2013-03-13 19:06:27278 class CC_EXPORT CullRenderPassesWithCachedTextures {
279 public:
280 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
281 const FrameData& frame) const;
[email protected]cd57cc5a2012-10-12 22:43:41282
[email protected]c1bb5af2013-03-13 19:06:27283 // Iterates from the root first, in order to remove the surfaces closest
284 // to the root with cached textures, and all surfaces that draw into
285 // them.
286 size_t RenderPassListBegin(const RenderPassList& list) const {
287 return list.size() - 1;
288 }
289 size_t RenderPassListEnd(const RenderPassList& list) const { return 0 - 1; }
290 size_t RenderPassListNext(size_t it) const { return it - 1; }
[email protected]cd57cc5a2012-10-12 22:43:41291
[email protected]c1bb5af2013-03-13 19:06:27292 CullRenderPassesWithCachedTextures(Renderer& renderer)
293 : renderer_(renderer) {}
294 private:
295 Renderer& renderer_;
296 };
[email protected]cd57cc5a2012-10-12 22:43:41297
[email protected]c1bb5af2013-03-13 19:06:27298 class CC_EXPORT CullRenderPassesWithNoQuads {
299 public:
300 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
301 const FrameData& frame) const;
[email protected]cd57cc5a2012-10-12 22:43:41302
[email protected]c1bb5af2013-03-13 19:06:27303 // Iterates in draw order, so that when a surface is removed, and its
304 // target becomes empty, then its target can be removed also.
305 size_t RenderPassListBegin(const RenderPassList& list) const { return 0; }
306 size_t RenderPassListEnd(const RenderPassList& list) const {
307 return list.size();
308 }
309 size_t RenderPassListNext(size_t it) const { return it + 1; }
310 };
[email protected]cd57cc5a2012-10-12 22:43:41311
[email protected]c1bb5af2013-03-13 19:06:27312 template <typename RenderPassCuller>
313 static void RemoveRenderPasses(RenderPassCuller culler, FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41314
[email protected]c1bb5af2013-03-13 19:06:27315 skia::RefPtr<SkPicture> CapturePicture();
[email protected]b9dcf43a2013-01-09 00:15:29316
[email protected]c1bb5af2013-03-13 19:06:27317 bool pinch_gesture_active() const { return pinch_gesture_active_; }
[email protected]166db5c82013-01-09 23:54:31318
[email protected]c1bb5af2013-03-13 19:06:27319 void SetTreePriority(TreePriority priority);
[email protected]362f1e8b2013-01-21 16:54:30320
[email protected]c1bb5af2013-03-13 19:06:27321 void BeginNextFrame();
322 base::TimeTicks CurrentFrameTime();
[email protected]829ad972013-01-28 23:36:10323
[email protected]c1bb5af2013-03-13 19:06:27324 scoped_ptr<base::Value> AsValue() const;
325 scoped_ptr<base::Value> ActivationStateAsValue() const;
326 scoped_ptr<base::Value> FrameStateAsValue() const;
[email protected]131a0c22013-02-12 18:31:08327
[email protected]c1bb5af2013-03-13 19:06:27328 bool page_scale_animation_active() const { return !!page_scale_animation_; }
[email protected]498ddd02013-02-28 23:59:25329
[email protected]c1bb5af2013-03-13 19:06:27330 protected:
331 LayerTreeHostImpl(const LayerTreeSettings& settings,
332 LayerTreeHostImplClient* client,
333 Proxy* proxy);
334 void ActivatePendingTree();
[email protected]cd57cc5a2012-10-12 22:43:41335
[email protected]c1bb5af2013-03-13 19:06:27336 // Virtual for testing.
337 virtual void AnimateLayers(base::TimeTicks monotonic_time,
338 base::Time wall_clock_time);
339 virtual void UpdateAnimationState();
[email protected]cd57cc5a2012-10-12 22:43:41340
[email protected]c1bb5af2013-03-13 19:06:27341 // Virtual for testing.
342 virtual base::TimeDelta LowFrequencyAnimationInterval() const;
[email protected]cd57cc5a2012-10-12 22:43:41343
[email protected]c1bb5af2013-03-13 19:06:27344 const AnimationRegistrar::AnimationControllerMap&
345 active_animation_controllers() const {
346 return animation_registrar_->active_animation_controllers();
347 }
[email protected]de4afb5e2012-12-20 00:11:34348
[email protected]c1bb5af2013-03-13 19:06:27349 LayerTreeHostImplClient* client_;
350 Proxy* proxy_;
[email protected]cd57cc5a2012-10-12 22:43:41351
[email protected]c1bb5af2013-03-13 19:06:27352 private:
353 void AnimatePageScale(base::TimeTicks monotonic_time);
354 void AnimateScrollbars(base::TimeTicks monotonic_time);
[email protected]ffb2720f2013-03-15 19:18:37355 void AnimateTopControls(base::TimeTicks monotonic_time);
[email protected]2d692992012-12-19 01:19:32356
[email protected]c1bb5af2013-03-13 19:06:27357 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
358 LayerImpl* layerImpl,
359 float scaleFromViewportToScreenSpace,
360 gfx::PointF viewportPoint,
361 gfx::Vector2dF viewportDelta);
[email protected]615c78a2013-01-24 23:44:16362
[email protected]c1bb5af2013-03-13 19:06:27363 void UpdateMaxScrollOffset();
364 void TrackDamageForAllSurfaces(LayerImpl* root_draw_layer,
365 const LayerList& render_surface_layer_list);
[email protected]cd57cc5a2012-10-12 22:43:41366
[email protected]c1bb5af2013-03-13 19:06:27367 // Returns false if the frame should not be displayed. This function should
368 // only be called from prepareToDraw, as didDrawAllLayers must be called
369 // if this helper function is called.
370 bool CalculateRenderPasses(FrameData* frame);
371 void SetBackgroundTickingEnabled(bool enabled);
[email protected]cd57cc5a2012-10-12 22:43:41372
[email protected]c1bb5af2013-03-13 19:06:27373 void SendDidLoseOutputSurfaceRecursive(LayerImpl* current);
374 void ClearRenderSurfaces();
375 bool EnsureRenderSurfaceLayerList();
376 void ClearCurrentlyScrollingLayer();
[email protected]cd57cc5a2012-10-12 22:43:41377
[email protected]c1bb5af2013-03-13 19:06:27378 void AnimateScrollbarsRecursive(LayerImpl* layer,
379 base::TimeTicks time);
[email protected]cd57cc5a2012-10-12 22:43:41380
[email protected]c1bb5af2013-03-13 19:06:27381 void DumpRenderSurfaces(std::string* str,
382 int indent,
383 const LayerImpl* layer) const;
[email protected]cd57cc5a2012-10-12 22:43:41384
[email protected]c1bb5af2013-03-13 19:06:27385 static LayerImpl* GetNonCompositedContentLayerRecursive(LayerImpl* layer);
[email protected]b9dcf43a2013-01-09 00:15:29386
[email protected]0fc818e2013-03-18 06:45:20387 void StartScrollbarAnimationRecursive(LayerImpl* layer, base::TimeTicks time);
388
[email protected]c1bb5af2013-03-13 19:06:27389 scoped_ptr<OutputSurface> output_surface_;
390 scoped_ptr<ResourceProvider> resource_provider_;
391 scoped_ptr<Renderer> renderer_;
392 scoped_ptr<TileManager> tile_manager_;
[email protected]3b31c6ac2012-12-06 21:27:29393
[email protected]c1bb5af2013-03-13 19:06:27394 // Tree currently being drawn.
395 scoped_ptr<LayerTreeImpl> active_tree_;
[email protected]3b31c6ac2012-12-06 21:27:29396
[email protected]c1bb5af2013-03-13 19:06:27397 // In impl-side painting mode, tree with possibly incomplete rasterized
398 // content. May be promoted to active by ActivatePendingTreeIfNeeded().
399 scoped_ptr<LayerTreeImpl> pending_tree_;
[email protected]48871fc2013-01-23 07:36:51400
[email protected]c1bb5af2013-03-13 19:06:27401 // In impl-side painting mode, inert tree with layers that can be recycled
402 // by the next sync from the main thread.
403 scoped_ptr<LayerTreeImpl> recycle_tree_;
[email protected]48871fc2013-01-23 07:36:51404
[email protected]c1bb5af2013-03-13 19:06:27405 bool did_lock_scrolling_layer_;
406 bool should_bubble_scrolls_;
407 bool wheel_scrolling_;
408 LayerTreeSettings settings_;
409 LayerTreeDebugState debug_state_;
410 gfx::Size layout_viewport_size_;
411 gfx::Size device_viewport_size_;
412 float device_scale_factor_;
413 bool visible_;
414 ManagedMemoryPolicy managed_memory_policy_;
[email protected]cd57cc5a2012-10-12 22:43:41415
[email protected]c1bb5af2013-03-13 19:06:27416 bool pinch_gesture_active_;
417 gfx::Point previous_pinch_anchor_;
[email protected]cd57cc5a2012-10-12 22:43:41418
[email protected]c1bb5af2013-03-13 19:06:27419 // This is set by AnimateLayers() and used by UpdateAnimationState()
420 // when sending animation events to the main thread.
421 base::Time last_animation_time_;
[email protected]6ad55bb22013-02-08 21:34:33422
[email protected]c1bb5af2013-03-13 19:06:27423 scoped_ptr<TopControlsManager> top_controls_manager_;
[email protected]3ba4cae2013-01-16 03:58:38424
[email protected]c1bb5af2013-03-13 19:06:27425 scoped_ptr<PageScaleAnimation> page_scale_animation_;
[email protected]cd57cc5a2012-10-12 22:43:41426
[email protected]c1bb5af2013-03-13 19:06:27427 // This is used for ticking animations slowly when hidden.
428 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_;
[email protected]cd57cc5a2012-10-12 22:43:41429
[email protected]c1bb5af2013-03-13 19:06:27430 scoped_ptr<FrameRateCounter> fps_counter_;
431 scoped_ptr<PaintTimeCounter> paint_time_counter_;
432 scoped_ptr<MemoryHistory> memory_history_;
433 scoped_ptr<DebugRectHistory> debug_rect_history_;
[email protected]cd57cc5a2012-10-12 22:43:41434
[email protected]c1bb5af2013-03-13 19:06:27435 int64 num_impl_thread_scrolls_;
436 int64 num_main_thread_scrolls_;
[email protected]cd57cc5a2012-10-12 22:43:41437
[email protected]c1bb5af2013-03-13 19:06:27438 int64 cumulative_num_layers_drawn_;
[email protected]f2bbb4e2012-12-07 21:40:49439
[email protected]c1bb5af2013-03-13 19:06:27440 int64 cumulative_num_missing_tiles_;
[email protected]9c2be6a2012-11-27 19:16:10441
[email protected]c1bb5af2013-03-13 19:06:27442 size_t last_sent_memory_visible_bytes_;
443 size_t last_sent_memory_visible_and_nearby_bytes_;
444 size_t last_sent_memory_use_bytes_;
[email protected]d3afa112012-12-08 06:24:28445
[email protected]c1bb5af2013-03-13 19:06:27446 base::TimeTicks current_frame_time_;
[email protected]829ad972013-01-28 23:36:10447
[email protected]c1bb5af2013-03-13 19:06:27448 scoped_ptr<AnimationRegistrar> animation_registrar_;
[email protected]de4afb5e2012-12-20 00:11:34449
[email protected]c1bb5af2013-03-13 19:06:27450 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41451};
452
[email protected]0023e8b2012-10-15 12:52:45453} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41454
[email protected]556fd292013-03-18 08:03:04455#endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_