blob: ff61b75249a82c527715cb28ea4748574b3a4eb5 [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]8fcbaa372012-11-05 04:12:415#ifndef CC_LAYER_TREE_HOST_IMPL_H_
6#define CC_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]aa0a9d32012-10-24 01:58:1011#include "cc/animation_events.h"
[email protected]0a9fd4d2012-12-07 07:37:0812#include "cc/animation_registrar.h"
[email protected]52347c842012-11-02 21:06:2013#include "cc/cc_export.h"
[email protected]d50c6862012-10-23 02:08:3114#include "cc/input_handler.h"
[email protected]3b31c6ac2012-12-06 21:27:2915#include "cc/layer_tree_impl.h"
[email protected]a46f32932012-12-07 21:43:1616#include "cc/output_surface_client.h"
[email protected]55a124d02012-10-22 03:07:1317#include "cc/render_pass.h"
18#include "cc/render_pass_sink.h"
[email protected]c4040a522012-10-21 15:01:4019#include "cc/renderer.h"
[email protected]8947cbe2012-11-28 05:27:4320#include "cc/tile_manager.h"
[email protected]ddf9df82012-10-16 06:52:4621#include "third_party/skia/include/core/SkColor.h"
[email protected]167ed9d52012-10-31 20:47:5822#include "ui/gfx/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4123
24namespace cc {
25
[email protected]96baf3e2012-10-22 23:09:5526class CompletionEvent;
27class DebugRectHistory;
28class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5529class LayerImpl;
30class LayerTreeHostImplTimeSourceAdapter;
31class PageScaleAnimation;
32class RenderPassDrawQuad;
33class ResourceProvider;
[email protected]cd57cc5a2012-10-12 22:43:4134struct RendererCapabilities;
[email protected]96baf3e2012-10-22 23:09:5535struct RenderingStats;
[email protected]cd57cc5a2012-10-12 22:43:4136
[email protected]96baf3e2012-10-22 23:09:5537// LayerTreeHost->Proxy callback interface.
38class LayerTreeHostImplClient {
[email protected]cd57cc5a2012-10-12 22:43:4139public:
[email protected]3be2171d2012-12-06 06:13:2040 virtual void didLoseOutputSurfaceOnImplThread() = 0;
[email protected]cd57cc5a2012-10-12 22:43:4141 virtual void onSwapBuffersCompleteOnImplThread() = 0;
[email protected]30faac92012-10-29 00:06:2942 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) = 0;
[email protected]cd57cc5a2012-10-12 22:43:4143 virtual void onCanDrawStateChanged(bool canDraw) = 0;
44 virtual void setNeedsRedrawOnImplThread() = 0;
45 virtual void setNeedsCommitOnImplThread() = 0;
[email protected]8947cbe2012-11-28 05:27:4346 virtual void setNeedsManageTilesOnImplThread() = 0;
[email protected]30faac92012-10-29 00:06:2947 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) = 0;
[email protected]b1969fa2012-10-17 20:16:2948 // Returns true if resources were deleted by this call.
[email protected]a0a00842012-10-22 22:50:2849 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) = 0;
[email protected]3d21e022012-10-25 20:03:0850 virtual void sendManagedMemoryStats() = 0;
[email protected]cd57cc5a2012-10-12 22:43:4151};
52
[email protected]96baf3e2012-10-22 23:09:5553// PinchZoomViewport models the bounds and offset of the viewport that is used during a pinch-zoom operation.
[email protected]cd57cc5a2012-10-12 22:43:4154// It tracks the layout-space dimensions of the viewport before any applied scale, and then tracks the layout-space
55// coordinates of the viewport respecting the pinch settings.
[email protected]96baf3e2012-10-22 23:09:5556class PinchZoomViewport {
[email protected]cd57cc5a2012-10-12 22:43:4157public:
[email protected]96baf3e2012-10-22 23:09:5558 PinchZoomViewport();
[email protected]cd57cc5a2012-10-12 22:43:4159
60 float totalPageScaleFactor() const;
61
62 void setPageScaleFactor(float factor) { m_pageScaleFactor = factor; }
63 float pageScaleFactor() const { return m_pageScaleFactor; }
64
65 void setPageScaleDelta(float delta);
66 float pageScaleDelta() const { return m_pageScaleDelta; }
67
68 float minPageScaleFactor() const { return m_minPageScaleFactor; }
69 float maxPageScaleFactor() const { return m_maxPageScaleFactor; }
70
71 void setSentPageScaleDelta(float delta) { m_sentPageScaleDelta = delta; }
72 float sentPageScaleDelta() const { return m_sentPageScaleDelta; }
73
[email protected]e39bf212012-11-22 21:04:0374 void setDeviceScaleFactor(float factor) { m_deviceScaleFactor = factor; }
75 float deviceScaleFactor() const { return m_deviceScaleFactor; }
76
[email protected]cd57cc5a2012-10-12 22:43:4177 // Returns true if the passed parameters were different from those previously
78 // cached.
79 bool setPageScaleFactorAndLimits(float pageScaleFactor,
80 float minPageScaleFactor,
81 float maxPageScaleFactor);
82
83 // Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
[email protected]aad0a0072012-11-01 18:15:5884 gfx::RectF bounds() const;
[email protected]e39bf212012-11-22 21:04:0385 const gfx::Vector2dF& zoomedViewportOffset() const { return m_zoomedViewportOffset; }
[email protected]cd57cc5a2012-10-12 22:43:4186
[email protected]aad0a0072012-11-01 18:15:5887 void setLayoutViewportSize(const gfx::SizeF& size) { m_layoutViewportSize = size; }
[email protected]cd57cc5a2012-10-12 22:43:4188
89 // Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
90 // scrolled outside of the layout viewport bounds. Returns the component of the scroll that is un-applied due to
91 // this constraint.
[email protected]c9c1ebe2012-11-05 20:46:1392 gfx::Vector2dF applyScroll(const gfx::Vector2dF&);
[email protected]cd57cc5a2012-10-12 22:43:4193
[email protected]e39bf212012-11-22 21:04:0394 // The implTransform goes from the origin of the unzoomedDeviceViewport to the
95 // origin of the zoomedDeviceViewport.
96 //
97 // implTransform = S[pageScale] * Tr[-zoomedDeviceViewportOffset]
[email protected]c8686a02012-11-27 08:29:0098 gfx::Transform implTransform(bool pageScalePinchZoomEnabled) const;
[email protected]cd57cc5a2012-10-12 22:43:4199
100private:
101 float m_pageScaleFactor;
102 float m_pageScaleDelta;
103 float m_sentPageScaleDelta;
104 float m_maxPageScaleFactor;
105 float m_minPageScaleFactor;
[email protected]e39bf212012-11-22 21:04:03106 float m_deviceScaleFactor;
[email protected]cd57cc5a2012-10-12 22:43:41107
[email protected]e39bf212012-11-22 21:04:03108 gfx::Vector2dF m_zoomedViewportOffset;
[email protected]aad0a0072012-11-01 18:15:58109 gfx::SizeF m_layoutViewportSize;
[email protected]cd57cc5a2012-10-12 22:43:41110};
111
[email protected]96baf3e2012-10-22 23:09:55112// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
[email protected]52347c842012-11-02 21:06:20113class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
114 public RendererClient,
[email protected]8947cbe2012-11-28 05:27:43115 public TileManagerClient,
[email protected]3b31c6ac2012-12-06 21:27:29116 public LayerTreeImplClient,
[email protected]0a9fd4d2012-12-07 07:37:08117 public AnimationRegistrar,
[email protected]a46f32932012-12-07 21:43:16118 public OutputSurfaceClient {
[email protected]96baf3e2012-10-22 23:09:55119 typedef std::vector<LayerImpl*> LayerList;
[email protected]0a9fd4d2012-12-07 07:37:08120 typedef base::hash_set<LayerAnimationController*> AnimationControllerSet;
[email protected]cd57cc5a2012-10-12 22:43:41121
122public:
[email protected]61de5812012-11-08 07:03:44123 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
[email protected]96baf3e2012-10-22 23:09:55124 virtual ~LayerTreeHostImpl();
[email protected]cd57cc5a2012-10-12 22:43:41125
[email protected]96baf3e2012-10-22 23:09:55126 // InputHandlerClient implementation
[email protected]c9c1ebe2012-11-05 20:46:13127 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandlerClient::ScrollInputType) OVERRIDE;
[email protected]a9710962012-11-14 20:11:02128 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41129 virtual void scrollEnd() OVERRIDE;
130 virtual void pinchGestureBegin() OVERRIDE;
[email protected]c9c1ebe2012-11-05 20:46:13131 virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41132 virtual void pinchGestureEnd() OVERRIDE;
[email protected]69a2a5be2012-11-14 06:51:44133 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41134 virtual void scheduleAnimation() OVERRIDE;
[email protected]2f1acc262012-11-16 21:42:22135 virtual bool haveTouchEventHandlersAt(const gfx::Point&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41136
[email protected]52347c842012-11-02 21:06:20137 struct CC_EXPORT FrameData : public RenderPassSink {
[email protected]cd57cc5a2012-10-12 22:43:41138 FrameData();
139 ~FrameData();
140
[email protected]167ed9d52012-10-31 20:47:58141 std::vector<gfx::Rect> occludingScreenSpaceRects;
[email protected]4d8804e2012-11-15 01:51:10142 std::vector<gfx::Rect> nonOccludingScreenSpaceRects;
[email protected]96baf3e2012-10-22 23:09:55143 RenderPassList renderPasses;
144 RenderPassIdHashMap renderPassesById;
145 LayerList* renderSurfaceLayerList;
146 LayerList willDrawLayers;
[email protected]cd57cc5a2012-10-12 22:43:41147
[email protected]96baf3e2012-10-22 23:09:55148 // RenderPassSink implementation.
149 virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41150 };
151
152 // Virtual for testing.
153 virtual void beginCommit();
154 virtual void commitComplete();
[email protected]30faac92012-10-29 00:06:29155 virtual void animate(base::TimeTicks monotonicTime, base::Time wallClockTime);
[email protected]cd57cc5a2012-10-12 22:43:41156
[email protected]8947cbe2012-11-28 05:27:43157 void manageTiles();
158
[email protected]cd57cc5a2012-10-12 22:43:41159 // Returns false if problems occured preparing the frame, and we should try
160 // to avoid displaying the frame. If prepareToDraw is called,
161 // didDrawAllLayers must also be called, regardless of whether drawLayers is
162 // called between the two.
163 virtual bool prepareToDraw(FrameData&);
[email protected]85167c72012-12-04 03:56:07164 virtual void drawLayers(FrameData&);
[email protected]cd57cc5a2012-10-12 22:43:41165 // Must be called if and only if prepareToDraw was called.
166 void didDrawAllLayers(const FrameData&);
167
[email protected]96baf3e2012-10-22 23:09:55168 // RendererClient implementation
[email protected]aad0a0072012-11-01 18:15:58169 virtual const gfx::Size& deviceViewportSize() const OVERRIDE;
[email protected]96baf3e2012-10-22 23:09:55170 virtual const LayerTreeSettings& settings() const OVERRIDE;
[email protected]3be2171d2012-12-06 06:13:20171 virtual void didLoseOutputSurface() OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41172 virtual void onSwapBuffersComplete() OVERRIDE;
173 virtual void setFullRootLayerDamage() OVERRIDE;
[email protected]a0a00842012-10-22 22:50:28174 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
175 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
[email protected]61de5812012-11-08 07:03:44176 virtual bool hasImplThread() const OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41177
[email protected]8947cbe2012-11-28 05:27:43178 // TileManagerClient implementation.
179 virtual void ScheduleManageTiles() OVERRIDE;
[email protected]d142a47d2012-12-07 08:18:37180 virtual void ScheduleCheckForCompletedSetPixels() OVERRIDE;
[email protected]8947cbe2012-11-28 05:27:43181
[email protected]a46f32932012-12-07 21:43:16182 // OutputSurfaceClient implementation.
183 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
184 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41185
[email protected]3b31c6ac2012-12-06 21:27:29186 // LayerTreeImplClient implementation.
187 virtual void OnCanDrawStateChangedForTree(LayerTreeImpl*) OVERRIDE;
188
[email protected]cd57cc5a2012-10-12 22:43:41189 // Implementation
190 bool canDraw();
[email protected]3be2171d2012-12-06 06:13:20191 OutputSurface* outputSurface() const;
[email protected]cd57cc5a2012-10-12 22:43:41192
193 std::string layerTreeAsText() const;
194
195 void finishAllRendering();
196 int sourceAnimationFrameNumber() const;
197
[email protected]3be2171d2012-12-06 06:13:20198 bool initializeRenderer(scoped_ptr<OutputSurface>);
[email protected]cd57cc5a2012-10-12 22:43:41199 bool isContextLost();
[email protected]8947cbe2012-11-28 05:27:43200 TileManager* tileManager() { return m_tileManager.get(); }
[email protected]96baf3e2012-10-22 23:09:55201 Renderer* renderer() { return m_renderer.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41202 const RendererCapabilities& rendererCapabilities() const;
203
204 bool swapBuffers();
205
[email protected]aad0a0072012-11-01 18:15:58206 void readback(void* pixels, const gfx::Rect&);
[email protected]cd57cc5a2012-10-12 22:43:41207
[email protected]3b31c6ac2012-12-06 21:27:29208 LayerTreeImpl* activeTree() { return m_activeTree.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41209
[email protected]3b31c6ac2012-12-06 21:27:29210 // TODO(nduca): Remove these in favor of LayerTreeImpl.
211 void setRootLayer(scoped_ptr<LayerImpl>);
212 LayerImpl* rootLayer() const { return m_activeTree->RootLayer(); }
[email protected]cd57cc5a2012-10-12 22:43:41213
214 // Release ownership of the current layer tree and replace it with an empty
215 // tree. Returns the root layer of the detached tree.
[email protected]96baf3e2012-10-22 23:09:55216 scoped_ptr<LayerImpl> detachLayerTree();
[email protected]cd57cc5a2012-10-12 22:43:41217
[email protected]3b31c6ac2012-12-06 21:27:29218 LayerImpl* rootScrollLayer() const { return m_activeTree->root_scroll_layer(); }
219
220 // TOOD(nduca): This goes away when scrolling moves to LayerTreeImpl.
221 LayerImpl* currentlyScrollingLayer() const { return m_activeTree->currently_scrolling_layer(); }
[email protected]cd57cc5a2012-10-12 22:43:41222
223 bool visible() const { return m_visible; }
224 void setVisible(bool);
225
[email protected]cd57cc5a2012-10-12 22:43:41226 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; }
227 void setContentsTexturesPurged();
228 void resetContentsTexturesPurged();
[email protected]a0a00842012-10-22 22:50:28229 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
[email protected]cd57cc5a2012-10-12 22:43:41230
[email protected]aad0a0072012-11-01 18:15:58231 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
232 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
[email protected]cd57cc5a2012-10-12 22:43:41233
234 float deviceScaleFactor() const { return m_deviceScaleFactor; }
235 void setDeviceScaleFactor(float);
236
237 float pageScaleFactor() const;
238 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
239
[email protected]96baf3e2012-10-22 23:09:55240 scoped_ptr<ScrollAndScaleSet> processScrollDeltas();
[email protected]c8686a02012-11-27 08:29:00241 gfx::Transform implTransform() const;
[email protected]cd57cc5a2012-10-12 22:43:41242
[email protected]c9c1ebe2012-11-05 20:46:13243 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration);
[email protected]cd57cc5a2012-10-12 22:43:41244
245 SkColor backgroundColor() const { return m_backgroundColor; }
246 void setBackgroundColor(SkColor color) { m_backgroundColor = color; }
247
248 bool hasTransparentBackground() const { return m_hasTransparentBackground; }
249 void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; }
[email protected]0a9fd4d2012-12-07 07:37:08250 bool needsAnimateLayers() const { return !m_activeAnimationControllers.empty(); }
[email protected]cd57cc5a2012-10-12 22:43:41251
252 void setNeedsRedraw();
253
[email protected]96baf3e2012-10-22 23:09:55254 void renderingStats(RenderingStats*) const;
[email protected]cd57cc5a2012-10-12 22:43:41255
256 void updateRootScrollLayerImplTransform();
257
[email protected]d3afa112012-12-08 06:24:28258 void sendManagedMemoryStats(
259 size_t memoryVisibleBytes,
260 size_t memoryVisibleAndNearbyBytes,
261 size_t memoryUseBytes);
262
[email protected]96baf3e2012-10-22 23:09:55263 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
264 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
265 ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
[email protected]61de5812012-11-08 07:03:44266 Proxy* proxy() const { return m_proxy; }
[email protected]cd57cc5a2012-10-12 22:43:41267
[email protected]f511afb2012-11-30 01:55:20268 void setDebugState(const LayerTreeDebugState& debugState) { m_debugState = debugState; }
269 const LayerTreeDebugState& debugState() const { return m_debugState; }
270
[email protected]52347c842012-11-02 21:06:20271 class CC_EXPORT CullRenderPassesWithCachedTextures {
[email protected]cd57cc5a2012-10-12 22:43:41272 public:
[email protected]96baf3e2012-10-22 23:09:55273 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
[email protected]cd57cc5a2012-10-12 22:43:41274
275 // Iterates from the root first, in order to remove the surfaces closest
276 // to the root with cached textures, and all surfaces that draw into
277 // them.
[email protected]96baf3e2012-10-22 23:09:55278 size_t renderPassListBegin(const RenderPassList& list) const { return list.size() - 1; }
279 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; }
[email protected]cd57cc5a2012-10-12 22:43:41280 size_t renderPassListNext(size_t it) const { return it - 1; }
281
[email protected]96baf3e2012-10-22 23:09:55282 CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(renderer) { }
[email protected]cd57cc5a2012-10-12 22:43:41283 private:
[email protected]96baf3e2012-10-22 23:09:55284 Renderer& m_renderer;
[email protected]cd57cc5a2012-10-12 22:43:41285 };
286
[email protected]52347c842012-11-02 21:06:20287 class CC_EXPORT CullRenderPassesWithNoQuads {
[email protected]cd57cc5a2012-10-12 22:43:41288 public:
[email protected]96baf3e2012-10-22 23:09:55289 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
[email protected]cd57cc5a2012-10-12 22:43:41290
291 // Iterates in draw order, so that when a surface is removed, and its
292 // target becomes empty, then its target can be removed also.
[email protected]96baf3e2012-10-22 23:09:55293 size_t renderPassListBegin(const RenderPassList&) const { return 0; }
294 size_t renderPassListEnd(const RenderPassList& list) const { return list.size(); }
[email protected]cd57cc5a2012-10-12 22:43:41295 size_t renderPassListNext(size_t it) const { return it + 1; }
296 };
297
298 template<typename RenderPassCuller>
299 static void removeRenderPasses(RenderPassCuller, FrameData&);
300
301protected:
[email protected]61de5812012-11-08 07:03:44302 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
[email protected]cd57cc5a2012-10-12 22:43:41303
[email protected]30faac92012-10-29 00:06:29304 void animatePageScale(base::TimeTicks monotonicTime);
305 void animateScrollbars(base::TimeTicks monotonicTime);
[email protected]cd57cc5a2012-10-12 22:43:41306
307 // Exposed for testing.
[email protected]96baf3e2012-10-22 23:09:55308 void calculateRenderSurfaceLayerList(LayerList&);
[email protected]cd57cc5a2012-10-12 22:43:41309
310 // Virtual for testing.
[email protected]30faac92012-10-29 00:06:29311 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime);
[email protected]cd57cc5a2012-10-12 22:43:41312
313 // Virtual for testing.
314 virtual base::TimeDelta lowFrequencyAnimationInterval() const;
315
[email protected]96baf3e2012-10-22 23:09:55316 LayerTreeHostImplClient* m_client;
[email protected]61de5812012-11-08 07:03:44317 Proxy* m_proxy;
[email protected]cd57cc5a2012-10-12 22:43:41318
319private:
[email protected]96baf3e2012-10-22 23:09:55320 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo);
321 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo);
[email protected]c9c1ebe2012-11-05 20:46:13322 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scrollOffset, float pageScale);
[email protected]cd57cc5a2012-10-12 22:43:41323
324 void setPageScaleDelta(float);
[email protected]c9c1ebe2012-11-05 20:46:13325 void updateMaxScrollOffset();
[email protected]96baf3e2012-10-22 23:09:55326 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList);
[email protected]cd57cc5a2012-10-12 22:43:41327
328 // Returns false if the frame should not be displayed. This function should
329 // only be called from prepareToDraw, as didDrawAllLayers must be called
330 // if this helper function is called.
331 bool calculateRenderPasses(FrameData&);
[email protected]30faac92012-10-29 00:06:29332 void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
[email protected]cd57cc5a2012-10-12 22:43:41333 void setBackgroundTickingEnabled(bool);
[email protected]aad0a0072012-11-01 18:15:58334 gfx::Size contentSize() const;
[email protected]cd57cc5a2012-10-12 22:43:41335
[email protected]3be2171d2012-12-06 06:13:20336 void sendDidLoseOutputSurfaceRecursive(LayerImpl*);
[email protected]cd57cc5a2012-10-12 22:43:41337 void clearRenderSurfaces();
338 bool ensureRenderSurfaceLayerList();
339 void clearCurrentlyScrollingLayer();
340
[email protected]30faac92012-10-29 00:06:29341 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime);
[email protected]cd57cc5a2012-10-12 22:43:41342
[email protected]96baf3e2012-10-22 23:09:55343 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
[email protected]cd57cc5a2012-10-12 22:43:41344
[email protected]0a9fd4d2012-12-07 07:37:08345 // AnimationRegistar implementation.
346 virtual void DidActivateAnimationController(LayerAnimationController*) OVERRIDE;
347 virtual void DidDeactivateAnimationController(LayerAnimationController*) OVERRIDE;
348 virtual void RegisterAnimationController(LayerAnimationController*) OVERRIDE;
349 virtual void UnregisterAnimationController(LayerAnimationController*) OVERRIDE;
350
[email protected]3be2171d2012-12-06 06:13:20351 scoped_ptr<OutputSurface> m_outputSurface;
[email protected]0a9fd4d2012-12-07 07:37:08352
[email protected]96baf3e2012-10-22 23:09:55353 scoped_ptr<ResourceProvider> m_resourceProvider;
354 scoped_ptr<Renderer> m_renderer;
[email protected]8947cbe2012-11-28 05:27:43355 scoped_ptr<TileManager> m_tileManager;
[email protected]3b31c6ac2012-12-06 21:27:29356
357 scoped_ptr<LayerTreeImpl> m_activeTree;
358
[email protected]31bfe272012-10-19 18:49:52359 bool m_scrollDeltaIsInViewportSpace;
[email protected]96baf3e2012-10-22 23:09:55360 LayerTreeSettings m_settings;
[email protected]f511afb2012-11-30 01:55:20361 LayerTreeDebugState m_debugState;
[email protected]aad0a0072012-11-01 18:15:58362 gfx::Size m_layoutViewportSize;
363 gfx::Size m_deviceViewportSize;
[email protected]cd57cc5a2012-10-12 22:43:41364 float m_deviceScaleFactor;
365 bool m_visible;
366 bool m_contentsTexturesPurged;
[email protected]a0a00842012-10-22 22:50:28367 ManagedMemoryPolicy m_managedMemoryPolicy;
[email protected]cd57cc5a2012-10-12 22:43:41368
369 SkColor m_backgroundColor;
370 bool m_hasTransparentBackground;
371
372 // If this is true, it is necessary to traverse the layer tree ticking the animators.
[email protected]cd57cc5a2012-10-12 22:43:41373 bool m_pinchGestureActive;
[email protected]c9c1ebe2012-11-05 20:46:13374 gfx::Point m_previousPinchAnchor;
[email protected]cd57cc5a2012-10-12 22:43:41375
[email protected]96baf3e2012-10-22 23:09:55376 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation;
[email protected]cd57cc5a2012-10-12 22:43:41377
378 // This is used for ticking animations slowly when hidden.
[email protected]96baf3e2012-10-22 23:09:55379 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
[email protected]cd57cc5a2012-10-12 22:43:41380
[email protected]cd57cc5a2012-10-12 22:43:41381 // List of visible layers for the most recently prepared frame. Used for
382 // rendering and input event hit testing.
[email protected]96baf3e2012-10-22 23:09:55383 LayerList m_renderSurfaceLayerList;
[email protected]cd57cc5a2012-10-12 22:43:41384
[email protected]96baf3e2012-10-22 23:09:55385 PinchZoomViewport m_pinchZoomViewport;
[email protected]cd57cc5a2012-10-12 22:43:41386
[email protected]96baf3e2012-10-22 23:09:55387 scoped_ptr<FrameRateCounter> m_fpsCounter;
388 scoped_ptr<DebugRectHistory> m_debugRectHistory;
[email protected]cd57cc5a2012-10-12 22:43:41389
[email protected]f2bbb4e2012-12-07 21:40:49390 int64 m_numImplThreadScrolls;
391 int64 m_numMainThreadScrolls;
[email protected]cd57cc5a2012-10-12 22:43:41392
[email protected]f2bbb4e2012-12-07 21:40:49393 int64 m_cumulativeNumLayersDrawn;
394
395 int64 m_cumulativeNumMissingTiles;
[email protected]9c2be6a2012-11-27 19:16:10396
[email protected]0a9fd4d2012-12-07 07:37:08397 AnimationControllerSet m_activeAnimationControllers;
398
399#if !defined(NDEBUG)
400 AnimationControllerSet m_allAnimationControllers;
401#endif
402
[email protected]d3afa112012-12-08 06:24:28403 size_t m_lastSentMemoryVisibleBytes;
404 size_t m_lastSentMemoryVisibleAndNearbyBytes;
405 size_t m_lastSentMemoryUseBytes;
406
[email protected]96baf3e2012-10-22 23:09:55407 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41408};
409
[email protected]0023e8b2012-10-15 12:52:45410} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41411
[email protected]8fcbaa372012-11-05 04:12:41412#endif // CC_LAYER_TREE_HOST_IMPL_H_