blob: 2e287c81e09cb2ae32651eda7afe94d0959ab9d3 [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]de4afb5e2012-12-20 00:11:3412#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]a46f32932012-12-07 21:43:1615#include "cc/output_surface_client.h"
[email protected]a823df82013-01-10 02:38:1716#include "cc/pinch_zoom_viewport.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]3ba4cae2013-01-16 03:58:3821#include "cc/top_controls_manager_client.h"
[email protected]b9dcf43a2013-01-09 00:15:2922#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4623#include "third_party/skia/include/core/SkColor.h"
[email protected]b9dcf43a2013-01-09 00:15:2924#include "third_party/skia/include/core/SkPicture.h"
[email protected]167ed9d52012-10-31 20:47:5825#include "ui/gfx/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4126
27namespace cc {
28
[email protected]96baf3e2012-10-22 23:09:5529class CompletionEvent;
[email protected]bf189f62012-12-18 03:42:1130class CompositorFrameMetadata;
[email protected]96baf3e2012-10-22 23:09:5531class DebugRectHistory;
32class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5533class LayerImpl;
34class LayerTreeHostImplTimeSourceAdapter;
[email protected]8bef40572012-12-11 21:38:0835class LayerTreeImpl;
[email protected]96baf3e2012-10-22 23:09:5536class PageScaleAnimation;
[email protected]0edbfbe9f2013-01-17 03:33:0337class PaintTimeCounter;
[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]cd57cc5a2012-10-12 22:43:4146public:
[email protected]3be2171d2012-12-06 06:13:2047 virtual void didLoseOutputSurfaceOnImplThread() = 0;
[email protected]cd57cc5a2012-10-12 22:43:4148 virtual void onSwapBuffersCompleteOnImplThread() = 0;
[email protected]30faac92012-10-29 00:06:2949 virtual void onVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) = 0;
[email protected]cd57cc5a2012-10-12 22:43:4150 virtual void onCanDrawStateChanged(bool canDraw) = 0;
[email protected]2e7ca422012-12-20 02:57:2751 virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0;
[email protected]cd57cc5a2012-10-12 22:43:4152 virtual void setNeedsRedrawOnImplThread() = 0;
[email protected]6367cda2013-01-23 00:21:1353 virtual void didSwapUseIncompleteTileOnImplThread() = 0;
54 virtual void didUploadVisibleHighResolutionTileOnImplThread() = 0;
[email protected]cd57cc5a2012-10-12 22:43:4155 virtual void setNeedsCommitOnImplThread() = 0;
[email protected]8947cbe2012-11-28 05:27:4356 virtual void setNeedsManageTilesOnImplThread() = 0;
[email protected]30faac92012-10-29 00:06:2957 virtual void postAnimationEventsToMainThreadOnImplThread(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime) = 0;
[email protected]b1969fa2012-10-17 20:16:2958 // Returns true if resources were deleted by this call.
[email protected]a0a00842012-10-22 22:50:2859 virtual bool reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int priorityCutoff) = 0;
[email protected]3d21e022012-10-25 20:03:0860 virtual void sendManagedMemoryStats() = 0;
[email protected]74d9063c2013-01-18 03:14:4761 virtual bool isInsideDraw() = 0;
[email protected]362f1e8b2013-01-21 16:54:3062 virtual void renewTreePriority() = 0;
[email protected]cd57cc5a2012-10-12 22:43:4163};
64
[email protected]96baf3e2012-10-22 23:09:5565// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
[email protected]52347c842012-11-02 21:06:2066class CC_EXPORT LayerTreeHostImpl : public InputHandlerClient,
67 public RendererClient,
[email protected]8947cbe2012-11-28 05:27:4368 public TileManagerClient,
[email protected]3ba4cae2013-01-16 03:58:3869 public OutputSurfaceClient,
70 public TopControlsManagerClient {
[email protected]96baf3e2012-10-22 23:09:5571 typedef std::vector<LayerImpl*> LayerList;
[email protected]cd57cc5a2012-10-12 22:43:4172
73public:
[email protected]61de5812012-11-08 07:03:4474 static scoped_ptr<LayerTreeHostImpl> create(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
[email protected]96baf3e2012-10-22 23:09:5575 virtual ~LayerTreeHostImpl();
[email protected]cd57cc5a2012-10-12 22:43:4176
[email protected]96baf3e2012-10-22 23:09:5577 // InputHandlerClient implementation
[email protected]c9c1ebe2012-11-05 20:46:1378 virtual InputHandlerClient::ScrollStatus scrollBegin(gfx::Point, InputHandlerClient::ScrollInputType) OVERRIDE;
[email protected]a9710962012-11-14 20:11:0279 virtual bool scrollBy(const gfx::Point&, const gfx::Vector2d&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:4180 virtual void scrollEnd() OVERRIDE;
81 virtual void pinchGestureBegin() OVERRIDE;
[email protected]c9c1ebe2012-11-05 20:46:1382 virtual void pinchGestureUpdate(float, gfx::Point) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:4183 virtual void pinchGestureEnd() OVERRIDE;
[email protected]69a2a5be2012-11-14 06:51:4484 virtual void startPageScaleAnimation(gfx::Vector2d targetOffset, bool anchorPoint, float pageScale, base::TimeTicks startTime, base::TimeDelta duration) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:4185 virtual void scheduleAnimation() OVERRIDE;
[email protected]2f1acc262012-11-16 21:42:2286 virtual bool haveTouchEventHandlersAt(const gfx::Point&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:4187
[email protected]3ba4cae2013-01-16 03:58:3888 // TopControlsManagerClient implementation.
[email protected]615c78a2013-01-24 23:44:1689 virtual void setActiveTreeNeedsUpdateDrawProperties() OVERRIDE;
[email protected]3ba4cae2013-01-16 03:58:3890 virtual void setNeedsRedraw() OVERRIDE;
[email protected]69b50ec2013-01-19 04:58:0191 virtual bool haveRootScrollLayer() const OVERRIDE;
92 virtual float rootScrollLayerTotalScrollY() const OVERRIDE;
[email protected]3ba4cae2013-01-16 03:58:3893
[email protected]52347c842012-11-02 21:06:2094 struct CC_EXPORT FrameData : public RenderPassSink {
[email protected]cd57cc5a2012-10-12 22:43:4195 FrameData();
96 ~FrameData();
97
[email protected]167ed9d52012-10-31 20:47:5898 std::vector<gfx::Rect> occludingScreenSpaceRects;
[email protected]4d8804e2012-11-15 01:51:1099 std::vector<gfx::Rect> nonOccludingScreenSpaceRects;
[email protected]96baf3e2012-10-22 23:09:55100 RenderPassList renderPasses;
101 RenderPassIdHashMap renderPassesById;
[email protected]76ffd9e2012-12-20 19:12:47102 const LayerList* renderSurfaceLayerList;
[email protected]96baf3e2012-10-22 23:09:55103 LayerList willDrawLayers;
[email protected]cd57cc5a2012-10-12 22:43:41104
[email protected]96baf3e2012-10-22 23:09:55105 // RenderPassSink implementation.
106 virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41107 };
108
109 // Virtual for testing.
110 virtual void beginCommit();
111 virtual void commitComplete();
[email protected]30faac92012-10-29 00:06:29112 virtual void animate(base::TimeTicks monotonicTime, base::Time wallClockTime);
[email protected]cd57cc5a2012-10-12 22:43:41113
[email protected]8947cbe2012-11-28 05:27:43114 void manageTiles();
115
[email protected]cd57cc5a2012-10-12 22:43:41116 // Returns false if problems occured preparing the frame, and we should try
117 // to avoid displaying the frame. If prepareToDraw is called,
118 // didDrawAllLayers must also be called, regardless of whether drawLayers is
119 // called between the two.
120 virtual bool prepareToDraw(FrameData&);
[email protected]85167c72012-12-04 03:56:07121 virtual void drawLayers(FrameData&);
[email protected]cd57cc5a2012-10-12 22:43:41122 // Must be called if and only if prepareToDraw was called.
123 void didDrawAllLayers(const FrameData&);
124
[email protected]96baf3e2012-10-22 23:09:55125 // RendererClient implementation
[email protected]aad0a0072012-11-01 18:15:58126 virtual const gfx::Size& deviceViewportSize() const OVERRIDE;
[email protected]96baf3e2012-10-22 23:09:55127 virtual const LayerTreeSettings& settings() const OVERRIDE;
[email protected]3be2171d2012-12-06 06:13:20128 virtual void didLoseOutputSurface() OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41129 virtual void onSwapBuffersComplete() OVERRIDE;
130 virtual void setFullRootLayerDamage() OVERRIDE;
[email protected]a0a00842012-10-22 22:50:28131 virtual void setManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
132 virtual void enforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE;
[email protected]61de5812012-11-08 07:03:44133 virtual bool hasImplThread() const OVERRIDE;
[email protected]f35e2322012-12-15 21:45:52134 virtual bool shouldClearRootRenderPass() const OVERRIDE;
[email protected]bf189f62012-12-18 03:42:11135 virtual CompositorFrameMetadata makeCompositorFrameMetadata() const OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41136
[email protected]8947cbe2012-11-28 05:27:43137 // TileManagerClient implementation.
138 virtual void ScheduleManageTiles() OVERRIDE;
[email protected]74d9063c2013-01-18 03:14:47139 virtual void DidUploadVisibleHighResolutionTile() OVERRIDE;
[email protected]8947cbe2012-11-28 05:27:43140
[email protected]a46f32932012-12-07 21:43:16141 // OutputSurfaceClient implementation.
142 virtual void OnVSyncParametersChanged(base::TimeTicks timebase, base::TimeDelta interval) OVERRIDE;
143 virtual void OnSendFrameToParentCompositorAck(const CompositorFrameAck&) OVERRIDE;
[email protected]cd57cc5a2012-10-12 22:43:41144
[email protected]8bef40572012-12-11 21:38:08145 // Called from LayerTreeImpl.
146 void OnCanDrawStateChangedForTree(LayerTreeImpl*);
[email protected]3b31c6ac2012-12-06 21:27:29147
[email protected]cd57cc5a2012-10-12 22:43:41148 // Implementation
149 bool canDraw();
[email protected]3be2171d2012-12-06 06:13:20150 OutputSurface* outputSurface() const;
[email protected]cd57cc5a2012-10-12 22:43:41151
152 std::string layerTreeAsText() const;
[email protected]4a23c374c2012-12-08 08:38:55153 std::string layerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41154
155 void finishAllRendering();
156 int sourceAnimationFrameNumber() const;
157
[email protected]3be2171d2012-12-06 06:13:20158 bool initializeRenderer(scoped_ptr<OutputSurface>);
[email protected]cd57cc5a2012-10-12 22:43:41159 bool isContextLost();
[email protected]8947cbe2012-11-28 05:27:43160 TileManager* tileManager() { return m_tileManager.get(); }
[email protected]96baf3e2012-10-22 23:09:55161 Renderer* renderer() { return m_renderer.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41162 const RendererCapabilities& rendererCapabilities() const;
163
164 bool swapBuffers();
165
[email protected]aad0a0072012-11-01 18:15:58166 void readback(void* pixels, const gfx::Rect&);
[email protected]cd57cc5a2012-10-12 22:43:41167
[email protected]69b50ec2013-01-19 04:58:01168 LayerTreeImpl* activeTree() { return m_activeTree.get(); }
[email protected]caa567d2012-12-20 07:56:16169 const LayerTreeImpl* activeTree() const { return m_activeTree.get(); }
[email protected]f117a4c2012-12-16 04:53:10170 LayerTreeImpl* pendingTree() { return m_pendingTree.get(); }
[email protected]caa567d2012-12-20 07:56:16171 const LayerTreeImpl* pendingTree() const { return m_pendingTree.get(); }
[email protected]48871fc2013-01-23 07:36:51172 const LayerTreeImpl* recycleTree() const { return m_recycleTree.get(); }
[email protected]2e7ca422012-12-20 02:57:27173 void createPendingTree();
[email protected]6367cda2013-01-23 00:21:13174 void checkForCompletedTileUploads();
[email protected]9bd1cb52013-01-03 22:26:33175 virtual void activatePendingTreeIfNeeded();
[email protected]cd57cc5a2012-10-12 22:43:41176
[email protected]a30290142013-01-05 01:27:00177 // Shortcuts to layers on the active tree.
[email protected]8bef40572012-12-11 21:38:08178 LayerImpl* rootLayer() const;
[email protected]8bef40572012-12-11 21:38:08179 LayerImpl* rootScrollLayer() const;
[email protected]8bef40572012-12-11 21:38:08180 LayerImpl* currentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41181
182 bool visible() const { return m_visible; }
183 void setVisible(bool);
184
[email protected]a0a00842012-10-22 22:50:28185 size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
[email protected]cd57cc5a2012-10-12 22:43:41186
[email protected]aad0a0072012-11-01 18:15:58187 void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
188 const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
[email protected]cd57cc5a2012-10-12 22:43:41189
190 float deviceScaleFactor() const { return m_deviceScaleFactor; }
191 void setDeviceScaleFactor(float);
192
193 float pageScaleFactor() const;
194 void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
195
[email protected]96baf3e2012-10-22 23:09:55196 scoped_ptr<ScrollAndScaleSet> processScrollDeltas();
[email protected]c8686a02012-11-27 08:29:00197 gfx::Transform implTransform() const;
[email protected]cd57cc5a2012-10-12 22:43:41198
[email protected]c9c1ebe2012-11-05 20:46:13199 void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration);
[email protected]cd57cc5a2012-10-12 22:43:41200
[email protected]de4afb5e2012-12-20 00:11:34201 bool needsAnimateLayers() const { return !m_animationRegistrar->active_animation_controllers().empty(); }
[email protected]cd57cc5a2012-10-12 22:43:41202
[email protected]96baf3e2012-10-22 23:09:55203 void renderingStats(RenderingStats*) const;
[email protected]cd57cc5a2012-10-12 22:43:41204
[email protected]d3afa112012-12-08 06:24:28205 void sendManagedMemoryStats(
206 size_t memoryVisibleBytes,
207 size_t memoryVisibleAndNearbyBytes,
208 size_t memoryUseBytes);
209
[email protected]96baf3e2012-10-22 23:09:55210 FrameRateCounter* fpsCounter() const { return m_fpsCounter.get(); }
[email protected]0edbfbe9f2013-01-17 03:33:03211 PaintTimeCounter* paintTimeCounter() const { return m_paintTimeCounter.get(); }
[email protected]96baf3e2012-10-22 23:09:55212 DebugRectHistory* debugRectHistory() const { return m_debugRectHistory.get(); }
213 ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
[email protected]3ba4cae2013-01-16 03:58:38214 TopControlsManager* topControlsManager() const { return m_topControlsManager.get(); }
[email protected]ff762fb2012-12-12 19:18:37215
[email protected]61de5812012-11-08 07:03:44216 Proxy* proxy() const { return m_proxy; }
[email protected]cd57cc5a2012-10-12 22:43:41217
[email protected]de4afb5e2012-12-20 00:11:34218 AnimationRegistrar* animationRegistrar() const { return m_animationRegistrar.get(); }
219
[email protected]f511afb2012-11-30 01:55:20220 void setDebugState(const LayerTreeDebugState& debugState) { m_debugState = debugState; }
221 const LayerTreeDebugState& debugState() const { return m_debugState; }
222
[email protected]0edbfbe9f2013-01-17 03:33:03223 void savePaintTime(const base::TimeDelta& totalPaintTime);
224
[email protected]52347c842012-11-02 21:06:20225 class CC_EXPORT CullRenderPassesWithCachedTextures {
[email protected]cd57cc5a2012-10-12 22:43:41226 public:
[email protected]96baf3e2012-10-22 23:09:55227 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
[email protected]cd57cc5a2012-10-12 22:43:41228
229 // Iterates from the root first, in order to remove the surfaces closest
230 // to the root with cached textures, and all surfaces that draw into
231 // them.
[email protected]96baf3e2012-10-22 23:09:55232 size_t renderPassListBegin(const RenderPassList& list) const { return list.size() - 1; }
233 size_t renderPassListEnd(const RenderPassList&) const { return 0 - 1; }
[email protected]cd57cc5a2012-10-12 22:43:41234 size_t renderPassListNext(size_t it) const { return it - 1; }
235
[email protected]96baf3e2012-10-22 23:09:55236 CullRenderPassesWithCachedTextures(Renderer& renderer) : m_renderer(renderer) { }
[email protected]cd57cc5a2012-10-12 22:43:41237 private:
[email protected]96baf3e2012-10-22 23:09:55238 Renderer& m_renderer;
[email protected]cd57cc5a2012-10-12 22:43:41239 };
240
[email protected]52347c842012-11-02 21:06:20241 class CC_EXPORT CullRenderPassesWithNoQuads {
[email protected]cd57cc5a2012-10-12 22:43:41242 public:
[email protected]96baf3e2012-10-22 23:09:55243 bool shouldRemoveRenderPass(const RenderPassDrawQuad&, const FrameData&) const;
[email protected]cd57cc5a2012-10-12 22:43:41244
245 // Iterates in draw order, so that when a surface is removed, and its
246 // target becomes empty, then its target can be removed also.
[email protected]96baf3e2012-10-22 23:09:55247 size_t renderPassListBegin(const RenderPassList&) const { return 0; }
248 size_t renderPassListEnd(const RenderPassList& list) const { return list.size(); }
[email protected]cd57cc5a2012-10-12 22:43:41249 size_t renderPassListNext(size_t it) const { return it + 1; }
250 };
251
252 template<typename RenderPassCuller>
253 static void removeRenderPasses(RenderPassCuller, FrameData&);
254
[email protected]a823df82013-01-10 02:38:17255 float totalPageScaleFactorForTesting() const { return m_pinchZoomViewport.total_page_scale_factor(); }
[email protected]2d692992012-12-19 01:19:32256
[email protected]caa567d2012-12-20 07:56:16257 const PinchZoomViewport& pinchZoomViewport() const { return m_pinchZoomViewport; }
258
[email protected]b9dcf43a2013-01-09 00:15:29259 skia::RefPtr<SkPicture> capturePicture();
260
[email protected]166db5c82013-01-09 23:54:31261 bool pinchGestureActive() const { return m_pinchGestureActive; }
262
[email protected]362f1e8b2013-01-21 16:54:30263 void setTreePriority(TreePriority priority);
264
[email protected]cd57cc5a2012-10-12 22:43:41265protected:
[email protected]61de5812012-11-08 07:03:44266 LayerTreeHostImpl(const LayerTreeSettings&, LayerTreeHostImplClient*, Proxy*);
[email protected]2e7ca422012-12-20 02:57:27267 void activatePendingTree();
[email protected]cd57cc5a2012-10-12 22:43:41268
[email protected]cd57cc5a2012-10-12 22:43:41269 // Virtual for testing.
[email protected]30faac92012-10-29 00:06:29270 virtual void animateLayers(base::TimeTicks monotonicTime, base::Time wallClockTime);
[email protected]cd57cc5a2012-10-12 22:43:41271
272 // Virtual for testing.
273 virtual base::TimeDelta lowFrequencyAnimationInterval() const;
274
[email protected]de4afb5e2012-12-20 00:11:34275 const AnimationRegistrar::AnimationControllerMap& activeAnimationControllers() const { return m_animationRegistrar->active_animation_controllers(); }
276
[email protected]96baf3e2012-10-22 23:09:55277 LayerTreeHostImplClient* m_client;
[email protected]61de5812012-11-08 07:03:44278 Proxy* m_proxy;
[email protected]cd57cc5a2012-10-12 22:43:41279
280private:
[email protected]2d692992012-12-19 01:19:32281 void animatePageScale(base::TimeTicks monotonicTime);
282 void animateScrollbars(base::TimeTicks monotonicTime);
283
[email protected]96baf3e2012-10-22 23:09:55284 void computeDoubleTapZoomDeltas(ScrollAndScaleSet* scrollInfo);
285 void computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo);
[email protected]c9c1ebe2012-11-05 20:46:13286 void makeScrollAndScaleSet(ScrollAndScaleSet* scrollInfo, gfx::Vector2d scrollOffset, float pageScale);
[email protected]cd57cc5a2012-10-12 22:43:41287
288 void setPageScaleDelta(float);
[email protected]615c78a2013-01-24 23:44:16289 gfx::Vector2dF scrollPinchZoomViewport(gfx::Vector2dF delta);
290 gfx::Vector2dF scrollLayerWithViewportSpaceDelta(LayerImpl* layerImpl, float scaleFromViewportToScreenSpace, gfx::PointF viewportPoint, gfx::Vector2dF viewportDelta);
291
[email protected]c9c1ebe2012-11-05 20:46:13292 void updateMaxScrollOffset();
[email protected]96baf3e2012-10-22 23:09:55293 void trackDamageForAllSurfaces(LayerImpl* rootDrawLayer, const LayerList& renderSurfaceLayerList);
[email protected]cd57cc5a2012-10-12 22:43:41294
295 // Returns false if the frame should not be displayed. This function should
296 // only be called from prepareToDraw, as didDrawAllLayers must be called
297 // if this helper function is called.
298 bool calculateRenderPasses(FrameData&);
[email protected]30faac92012-10-29 00:06:29299 void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
[email protected]cd57cc5a2012-10-12 22:43:41300 void setBackgroundTickingEnabled(bool);
[email protected]cd57cc5a2012-10-12 22:43:41301
[email protected]3be2171d2012-12-06 06:13:20302 void sendDidLoseOutputSurfaceRecursive(LayerImpl*);
[email protected]cd57cc5a2012-10-12 22:43:41303 void clearRenderSurfaces();
304 bool ensureRenderSurfaceLayerList();
305 void clearCurrentlyScrollingLayer();
306
[email protected]30faac92012-10-29 00:06:29307 void animateScrollbarsRecursive(LayerImpl*, base::TimeTicks monotonicTime);
[email protected]cd57cc5a2012-10-12 22:43:41308
[email protected]96baf3e2012-10-22 23:09:55309 void dumpRenderSurfaces(std::string*, int indent, const LayerImpl*) const;
[email protected]cd57cc5a2012-10-12 22:43:41310
[email protected]b9dcf43a2013-01-09 00:15:29311 static LayerImpl* getNonCompositedContentLayerRecursive(LayerImpl* layer);
312
[email protected]3be2171d2012-12-06 06:13:20313 scoped_ptr<OutputSurface> m_outputSurface;
[email protected]96baf3e2012-10-22 23:09:55314 scoped_ptr<ResourceProvider> m_resourceProvider;
315 scoped_ptr<Renderer> m_renderer;
[email protected]8947cbe2012-11-28 05:27:43316 scoped_ptr<TileManager> m_tileManager;
[email protected]3b31c6ac2012-12-06 21:27:29317
[email protected]48871fc2013-01-23 07:36:51318 // Tree currently being drawn.
[email protected]3b31c6ac2012-12-06 21:27:29319 scoped_ptr<LayerTreeImpl> m_activeTree;
320
[email protected]48871fc2013-01-23 07:36:51321 // In impl-side painting mode, tree with possibly incomplete rasterized
322 // content. May be promoted to active by activatePendingTreeIfNeeded().
323 scoped_ptr<LayerTreeImpl> m_pendingTree;
324
325 // In impl-side painting mode, inert tree with layers that can be recycled
326 // by the next sync from the main thread.
327 scoped_ptr<LayerTreeImpl> m_recycleTree;
328
[email protected]31bfe272012-10-19 18:49:52329 bool m_scrollDeltaIsInViewportSpace;
[email protected]96baf3e2012-10-22 23:09:55330 LayerTreeSettings m_settings;
[email protected]f511afb2012-11-30 01:55:20331 LayerTreeDebugState m_debugState;
[email protected]aad0a0072012-11-01 18:15:58332 gfx::Size m_layoutViewportSize;
333 gfx::Size m_deviceViewportSize;
[email protected]cd57cc5a2012-10-12 22:43:41334 float m_deviceScaleFactor;
335 bool m_visible;
[email protected]a0a00842012-10-22 22:50:28336 ManagedMemoryPolicy m_managedMemoryPolicy;
[email protected]cd57cc5a2012-10-12 22:43:41337
[email protected]cd57cc5a2012-10-12 22:43:41338 bool m_pinchGestureActive;
[email protected]c9c1ebe2012-11-05 20:46:13339 gfx::Point m_previousPinchAnchor;
[email protected]cd57cc5a2012-10-12 22:43:41340
[email protected]3ba4cae2013-01-16 03:58:38341 scoped_ptr<TopControlsManager> m_topControlsManager;
342
[email protected]96baf3e2012-10-22 23:09:55343 scoped_ptr<PageScaleAnimation> m_pageScaleAnimation;
[email protected]cd57cc5a2012-10-12 22:43:41344
345 // This is used for ticking animations slowly when hidden.
[email protected]96baf3e2012-10-22 23:09:55346 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> m_timeSourceClientAdapter;
[email protected]cd57cc5a2012-10-12 22:43:41347
[email protected]96baf3e2012-10-22 23:09:55348 PinchZoomViewport m_pinchZoomViewport;
[email protected]cd57cc5a2012-10-12 22:43:41349
[email protected]96baf3e2012-10-22 23:09:55350 scoped_ptr<FrameRateCounter> m_fpsCounter;
[email protected]0edbfbe9f2013-01-17 03:33:03351 scoped_ptr<PaintTimeCounter> m_paintTimeCounter;
[email protected]96baf3e2012-10-22 23:09:55352 scoped_ptr<DebugRectHistory> m_debugRectHistory;
[email protected]cd57cc5a2012-10-12 22:43:41353
[email protected]f2bbb4e2012-12-07 21:40:49354 int64 m_numImplThreadScrolls;
355 int64 m_numMainThreadScrolls;
[email protected]cd57cc5a2012-10-12 22:43:41356
[email protected]f2bbb4e2012-12-07 21:40:49357 int64 m_cumulativeNumLayersDrawn;
358
359 int64 m_cumulativeNumMissingTiles;
[email protected]9c2be6a2012-11-27 19:16:10360
[email protected]d3afa112012-12-08 06:24:28361 size_t m_lastSentMemoryVisibleBytes;
362 size_t m_lastSentMemoryVisibleAndNearbyBytes;
363 size_t m_lastSentMemoryUseBytes;
364
[email protected]de4afb5e2012-12-20 00:11:34365 scoped_ptr<AnimationRegistrar> m_animationRegistrar;
366
[email protected]96baf3e2012-10-22 23:09:55367 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41368};
369
[email protected]0023e8b2012-10-15 12:52:45370} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41371
[email protected]8fcbaa372012-11-05 04:12:41372#endif // CC_LAYER_TREE_HOST_IMPL_H_