blob: a6448c126fa09b7011ab14d7b7a2cbe0755740e6 [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]c9280762013-08-01 06:28:578#include <list>
[email protected]127bdc1a2013-09-11 01:44:489#include <set>
[email protected]bf691c22013-03-26 21:15:0610#include <string>
11#include <vector>
12
[email protected]c4040a522012-10-21 15:01:4013#include "base/basictypes.h"
[email protected]c9280762013-08-01 06:28:5714#include "base/containers/hash_tables.h"
[email protected]c4040a522012-10-21 15:01:4015#include "base/memory/scoped_ptr.h"
[email protected]1b0df502013-06-27 23:39:5816#include "base/time/time.h"
[email protected]95e4e1a02013-03-18 07:09:0917#include "cc/animation/animation_events.h"
18#include "cc/animation/animation_registrar.h"
[email protected]930ff43b2014-05-02 05:24:0019#include "cc/animation/scrollbar_animation_controller.h"
[email protected]681ccff2013-03-18 06:13:5220#include "cc/base/cc_export.h"
[email protected]5e5648a2013-11-18 00:39:3321#include "cc/debug/micro_benchmark_controller_impl.h"
[email protected]3052b10f2013-03-18 07:41:2122#include "cc/input/input_handler.h"
[email protected]1960a712013-04-30 17:06:4723#include "cc/input/layer_scroll_offset_delegate.h"
[email protected]3052b10f2013-03-18 07:41:2124#include "cc/input/top_controls_manager_client.h"
[email protected]50761e92013-03-29 20:51:2825#include "cc/layers/layer_lists.h"
[email protected]cc3cfaa2013-03-18 09:05:5226#include "cc/layers/render_pass_sink.h"
[email protected]df3c24c92013-06-19 03:54:3527#include "cc/output/begin_frame_args.h"
[email protected]fd32d122013-06-29 13:11:0428#include "cc/output/managed_memory_policy.h"
[email protected]7f0d825f2013-03-18 07:24:3029#include "cc/output/output_surface_client.h"
30#include "cc/output/renderer.h"
[email protected]89e8267a2013-03-18 07:50:5631#include "cc/quads/render_pass.h"
[email protected]c9280762013-08-01 06:28:5732#include "cc/resources/resource_provider.h"
[email protected]e12dd0e2013-03-18 08:24:4033#include "cc/resources/tile_manager.h"
mithroc34fc0b12014-09-30 09:10:4134#include "cc/scheduler/begin_frame_source.h"
[email protected]30d82142014-05-12 04:26:0235#include "cc/scheduler/draw_result.h"
[email protected]c9280762013-08-01 06:28:5736#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4637#include "third_party/skia/include/core/SkColor.h"
[email protected]167ed9d52012-10-31 20:47:5838#include "ui/gfx/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4139
40namespace cc {
41
[email protected]96baf3e2012-10-22 23:09:5542class CompletionEvent;
[email protected]bf189f62012-12-18 03:42:1143class CompositorFrameMetadata;
[email protected]96baf3e2012-10-22 23:09:5544class DebugRectHistory;
[email protected]bf050582014-07-24 11:10:5845class EvictionTilePriorityQueue;
[email protected]96baf3e2012-10-22 23:09:5546class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5547class LayerImpl;
48class LayerTreeHostImplTimeSourceAdapter;
[email protected]8bef40572012-12-11 21:38:0849class LayerTreeImpl;
[email protected]ec7541d2014-04-09 01:23:5350class MemoryHistory;
[email protected]96baf3e2012-10-22 23:09:5551class PageScaleAnimation;
[email protected]0edbfbe9f2013-01-17 03:33:0352class PaintTimeCounter;
[email protected]8aa39ecb2014-06-12 14:19:1453class PictureLayerImpl;
[email protected]bf050582014-07-24 11:10:5854class RasterTilePriorityQueue;
[email protected]7beac1b52014-04-10 23:09:5655class RasterWorkerPool;
[email protected]96baf3e2012-10-22 23:09:5556class RenderPassDrawQuad;
[email protected]ec7541d2014-04-09 01:23:5357class RenderingStatsInstrumentation;
[email protected]eece11e2014-04-12 03:07:1658class ResourcePool;
[email protected]bf1cfd9a2013-09-26 05:43:0259class ScrollbarLayerImplBase;
[email protected]ea468c6c2013-09-10 08:25:1160class TextureMailboxDeleter;
[email protected]3ba4cae2013-01-16 03:58:3861class TopControlsManager;
[email protected]c9280762013-08-01 06:28:5762class UIResourceBitmap;
[email protected]741fba422013-09-20 03:34:1463class UIResourceRequest;
[email protected]7a8bcd262014-01-15 12:54:5864struct RendererCapabilitiesImpl;
[email protected]cd57cc5a2012-10-12 22:43:4165
[email protected]96baf3e2012-10-22 23:09:5566// LayerTreeHost->Proxy callback interface.
67class LayerTreeHostImplClient {
[email protected]c1bb5af2013-03-13 19:06:2768 public:
[email protected]fa339032014-02-18 22:11:5969 virtual void UpdateRendererCapabilitiesOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2770 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
[email protected]3dc0c772014-04-26 10:06:0571 virtual void CommitVSyncParameters(base::TimeTicks timebase,
72 base::TimeDelta interval) = 0;
73 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0;
[email protected]c14902662014-04-18 05:06:1174 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0;
[email protected]4d7e46a2013-11-08 05:33:4075 virtual void DidSwapBuffersOnImplThread() = 0;
[email protected]c14902662014-04-18 05:06:1176 virtual void DidSwapBuffersCompleteOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2777 virtual void OnCanDrawStateChanged(bool can_draw) = 0;
[email protected]4f48f6e2013-08-27 06:33:3878 virtual void NotifyReadyToActivate() = 0;
[email protected]43b8f982014-04-30 21:24:3379 // Please call these 3 functions through
80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
81 // SetNeedsAnimate().
[email protected]c1bb5af2013-03-13 19:06:2782 virtual void SetNeedsRedrawOnImplThread() = 0;
[email protected]0023fc72014-01-10 20:05:0683 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0;
[email protected]43b8f982014-04-30 21:24:3384 virtual void SetNeedsAnimateOnImplThread() = 0;
[email protected]86126792013-03-16 20:07:5485 virtual void DidInitializeVisibleTileOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2786 virtual void SetNeedsCommitOnImplThread() = 0;
[email protected]c48536a52013-09-14 00:02:0887 virtual void SetNeedsManageTilesOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2788 virtual void PostAnimationEventsToMainThreadOnImplThread(
[email protected]85b57502014-03-11 15:37:4889 scoped_ptr<AnimationEventsVector> events) = 0;
[email protected]c1bb5af2013-03-13 19:06:2790 // Returns true if resources were deleted by this call.
91 virtual bool ReduceContentsTextureMemoryOnImplThread(
92 size_t limit_bytes,
93 int priority_cutoff) = 0;
[email protected]c1bb5af2013-03-13 19:06:2794 virtual bool IsInsideDraw() = 0;
95 virtual void RenewTreePriority() = 0;
[email protected]930ff43b2014-05-02 05:24:0096 virtual void PostDelayedScrollbarFadeOnImplThread(
97 const base::Closure& start_fade,
98 base::TimeDelta delay) = 0;
[email protected]fc20d142014-07-01 00:49:1599 virtual void DidActivateSyncTree() = 0;
[email protected]bac0e552013-11-05 22:38:51100 virtual void DidManageTiles() = 0;
[email protected]bf691c22013-03-26 21:15:06101
102 protected:
103 virtual ~LayerTreeHostImplClient() {}
[email protected]cd57cc5a2012-10-12 22:43:41104};
105
[email protected]c1bb5af2013-03-13 19:06:27106// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
107// state.
[email protected]200a9c062013-05-20 04:34:37108class CC_EXPORT LayerTreeHostImpl
109 : public InputHandler,
110 public RendererClient,
111 public TileManagerClient,
112 public OutputSurfaceClient,
113 public TopControlsManagerClient,
[email protected]930ff43b2014-05-02 05:24:00114 public ScrollbarAnimationControllerClient,
mithroc34fc0b12014-09-30 09:10:41115 public BeginFrameSourceMixIn,
[email protected]200a9c062013-05-20 04:34:37116 public base::SupportsWeakPtr<LayerTreeHostImpl> {
[email protected]e216fef02013-03-20 22:56:10117 public:
[email protected]c1bb5af2013-03-13 19:06:27118 static scoped_ptr<LayerTreeHostImpl> Create(
119 const LayerTreeSettings& settings,
120 LayerTreeHostImplClient* client,
[email protected]372bad5f2013-03-21 16:38:43121 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57122 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05123 SharedBitmapManager* shared_bitmap_manager,
124 GpuMemoryBufferManager* gpu_memory_buffer_manager,
[email protected]dbe759a2013-12-02 19:23:02125 int id);
dcheng716bedf2014-10-21 09:51:08126 ~LayerTreeHostImpl() override;
[email protected]cd57cc5a2012-10-12 22:43:41127
mithroc34fc0b12014-09-30 09:10:41128 // BeginFrameSourceMixIn implementation
dcheng716bedf2014-10-21 09:51:08129 void OnNeedsBeginFramesChange(bool needs_begin_frames) override;
mithroc34fc0b12014-09-30 09:10:41130
[email protected]5ff3c9782013-04-29 17:35:12131 // InputHandler implementation
dcheng716bedf2014-10-21 09:51:08132 void BindToClient(InputHandlerClient* client) override;
133 InputHandler::ScrollStatus ScrollBegin(
[email protected]47a723f2014-03-05 12:42:49134 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37135 InputHandler::ScrollInputType type) override;
dcheng716bedf2014-10-21 09:51:08136 InputHandler::ScrollStatus ScrollAnimated(
[email protected]749cbc62014-07-10 01:06:35137 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37138 const gfx::Vector2dF& scroll_delta) override;
dcheng716bedf2014-10-21 09:51:08139 bool ScrollBy(const gfx::Point& viewport_point,
140 const gfx::Vector2dF& scroll_delta) override;
141 bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
142 ScrollDirection direction) override;
143 void SetRootLayerScrollOffsetDelegate(
mostynbf68776d82014-10-06 18:07:37144 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) override;
dcheng716bedf2014-10-21 09:51:08145 void OnRootLayerDelegatedScrollOffsetChanged() override;
146 void ScrollEnd() override;
147 InputHandler::ScrollStatus FlingScrollBegin() override;
148 void MouseMoveAt(const gfx::Point& viewport_point) override;
149 void PinchGestureBegin() override;
150 void PinchGestureUpdate(float magnify_delta,
151 const gfx::Point& anchor) override;
152 void PinchGestureEnd() override;
153 void SetNeedsAnimate() override;
154 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
155 InputHandler::ScrollInputType type) override;
156 bool HaveTouchEventHandlersAt(const gfx::Point& viewport_port) override;
157 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
mostynbf68776d82014-10-06 18:07:37158 ui::LatencyInfo* latency) override;
[email protected]cd57cc5a2012-10-12 22:43:41159
[email protected]c1bb5af2013-03-13 19:06:27160 // TopControlsManagerClient implementation.
dcheng716bedf2014-10-21 09:51:08161 void SetControlsTopOffset(float offset) override;
162 float ControlsTopOffset() const override;
163 void DidChangeTopControlsPosition() override;
164 bool HaveRootScrollLayer() const override;
[email protected]3ba4cae2013-01-16 03:58:38165
[email protected]c1bb5af2013-03-13 19:06:27166 struct CC_EXPORT FrameData : public RenderPassSink {
167 FrameData();
dcheng716bedf2014-10-21 09:51:08168 ~FrameData() override;
[email protected]d12aa932014-08-01 13:10:38169 void AsValueInto(base::debug::TracedValue* value) const;
[email protected]cd57cc5a2012-10-12 22:43:41170
[email protected]c1bb5af2013-03-13 19:06:27171 std::vector<gfx::Rect> occluding_screen_space_rects;
172 std::vector<gfx::Rect> non_occluding_screen_space_rects;
173 RenderPassList render_passes;
174 RenderPassIdHashMap render_passes_by_id;
[email protected]50761e92013-03-29 20:51:28175 const LayerImplList* render_surface_layer_list;
176 LayerImplList will_draw_layers;
[email protected]c1bb5af2013-03-13 19:06:27177 bool contains_incomplete_tile;
[email protected]e0341352013-04-06 05:01:20178 bool has_no_damage;
[email protected]cd57cc5a2012-10-12 22:43:41179
[email protected]c1bb5af2013-03-13 19:06:27180 // RenderPassSink implementation.
dcheng716bedf2014-10-21 09:51:08181 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
[email protected]c1bb5af2013-03-13 19:06:27182 };
[email protected]cd57cc5a2012-10-12 22:43:41183
[email protected]097a0cbf2013-12-12 17:04:58184 virtual void BeginMainFrameAborted(bool did_handle);
[email protected]c1bb5af2013-03-13 19:06:27185 virtual void BeginCommit();
186 virtual void CommitComplete();
[email protected]27152642014-03-11 20:42:00187 virtual void Animate(base::TimeTicks monotonic_time);
[email protected]3d9f7432013-04-06 00:35:18188 virtual void UpdateAnimationState(bool start_ready_animations);
[email protected]b33348f2014-04-30 18:17:34189 void ActivateAnimations();
[email protected]200a9c062013-05-20 04:34:37190 void MainThreadHasStoppedFlinging();
[email protected]3d9f7432013-04-06 00:35:18191 void UpdateBackgroundAnimateTicking(bool should_background_tick);
[email protected]b8384e22013-12-03 02:20:48192 void DidAnimateScrollOffset();
[email protected]0023fc72014-01-10 20:05:06193 void SetViewportDamage(const gfx::Rect& damage_rect);
[email protected]cd57cc5a2012-10-12 22:43:41194
[email protected]c48536a52013-09-14 00:02:08195 virtual void ManageTiles();
[email protected]8947cbe2012-11-28 05:27:43196
[email protected]2aae96792014-05-15 23:10:50197 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we
198 // should try to avoid displaying the frame. If PrepareToDraw is called,
199 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is
200 // called between the two.
201 virtual DrawResult PrepareToDraw(FrameData* frame);
[email protected]2e316b272014-07-19 05:01:20202 virtual void DrawLayers(FrameData* frame, base::TimeTicks frame_begin_time);
[email protected]c1bb5af2013-03-13 19:06:27203 // Must be called if and only if PrepareToDraw was called.
204 void DidDrawAllLayers(const FrameData& frame);
[email protected]cd57cc5a2012-10-12 22:43:41205
[email protected]c1bb5af2013-03-13 19:06:27206 const LayerTreeSettings& settings() const { return settings_; }
[email protected]cd57cc5a2012-10-12 22:43:41207
[email protected]0309ba5e02013-06-26 04:11:08208 // Evict all textures by enforcing a memory policy with an allocation of 0.
209 void EvictTexturesForTesting();
210
[email protected]4f48f6e2013-08-27 06:33:38211 // When blocking, this prevents client_->NotifyReadyToActivate() from being
212 // called. When disabled, it calls client_->NotifyReadyToActivate()
213 // immediately if any notifications had been blocked while blocking.
214 virtual void BlockNotifyReadyToActivateForTesting(bool block);
215
[email protected]425e5332013-09-21 04:10:03216 // This allows us to inject DidInitializeVisibleTile events for testing.
217 void DidInitializeVisibleTileForTesting();
218
[email protected]34bff2122014-05-16 04:09:34219 // Resets all of the trees to an empty state.
220 void ResetTreesForTesting();
vmpstr7fceb772014-08-26 18:51:52221 void ResetRecycleTreeForTesting();
[email protected]34bff2122014-05-16 04:09:34222
[email protected]c05dfbb2014-07-10 22:49:04223 DrawMode GetDrawMode() const;
[email protected]54af03522013-09-05 00:43:28224
225 // Viewport size in draw space: this size is in physical pixels and is used
226 // for draw properties, tilings, quads and render passes.
227 gfx::Size DrawViewportSize() const;
228
[email protected]bd5324592014-07-31 09:09:33229 // Viewport rect in view space used for tiling prioritization.
230 const gfx::Rect ViewportRectForTilePriority() const;
231
[email protected]59fee302013-12-10 17:53:30232 // RendererClient implementation.
dcheng716bedf2014-10-21 09:51:08233 void SetFullRootLayerDamage() override;
[email protected]8947cbe2012-11-28 05:27:43234
[email protected]c1bb5af2013-03-13 19:06:27235 // TileManagerClient implementation.
dcheng716bedf2014-10-21 09:51:08236 const std::vector<PictureLayerImpl*>& GetPictureLayers() const override;
237 void NotifyReadyToActivate() override;
238 void NotifyTileStateChanged(const Tile* tile) override;
239 void BuildRasterQueue(RasterTilePriorityQueue* queue,
240 TreePriority tree_priority) override;
241 void BuildEvictionQueue(EvictionTilePriorityQueue* queue,
242 TreePriority tree_priority) override;
[email protected]cd57cc5a2012-10-12 22:43:41243
[email protected]930ff43b2014-05-02 05:24:00244 // ScrollbarAnimationControllerClient implementation.
dcheng716bedf2014-10-21 09:51:08245 void PostDelayedScrollbarFade(const base::Closure& start_fade,
246 base::TimeDelta delay) override;
247 void SetNeedsScrollbarAnimationFrame() override;
[email protected]930ff43b2014-05-02 05:24:00248
[email protected]c1bb5af2013-03-13 19:06:27249 // OutputSurfaceClient implementation.
dcheng716bedf2014-10-21 09:51:08250 void DeferredInitialize() override;
251 void ReleaseGL() override;
252 void CommitVSyncParameters(base::TimeTicks timebase,
253 base::TimeDelta interval) override;
254 void SetNeedsRedrawRect(const gfx::Rect& rect) override;
255 void BeginFrame(const BeginFrameArgs& args) override;
[email protected]bd5324592014-07-31 09:09:33256
dcheng716bedf2014-10-21 09:51:08257 void SetExternalDrawConstraints(
[email protected]54af03522013-09-05 00:43:28258 const gfx::Transform& transform,
[email protected]0023fc72014-01-10 20:05:06259 const gfx::Rect& viewport,
260 const gfx::Rect& clip,
[email protected]bd5324592014-07-31 09:09:33261 const gfx::Rect& viewport_rect_for_tile_priority,
262 const gfx::Transform& transform_for_tile_priority,
mostynbf68776d82014-10-06 18:07:37263 bool resourceless_software_draw) override;
dcheng716bedf2014-10-21 09:51:08264 void DidLoseOutputSurface() override;
265 void DidSwapBuffers() override;
266 void DidSwapBuffersComplete() override;
267 void ReclaimResources(const CompositorFrameAck* ack) override;
268 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
269 void SetTreeActivationCallback(const base::Closure& callback) override;
[email protected]3b31c6ac2012-12-06 21:27:29270
[email protected]c1bb5af2013-03-13 19:06:27271 // Called from LayerTreeImpl.
272 void OnCanDrawStateChangedForTree();
[email protected]cd57cc5a2012-10-12 22:43:41273
[email protected]b5174d712013-08-28 08:10:43274 // Implementation.
[email protected]12a63da2014-06-13 06:06:22275 int id() const { return id_; }
[email protected]6133cc232013-07-30 18:47:07276 bool CanDraw() const;
[email protected]c1bb5af2013-03-13 19:06:27277 OutputSurface* output_surface() const { return output_surface_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41278
[email protected]c1bb5af2013-03-13 19:06:27279 std::string LayerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41280
[email protected]c1bb5af2013-03-13 19:06:27281 void FinishAllRendering();
282 int SourceAnimationFrameNumber() const;
[email protected]cd57cc5a2012-10-12 22:43:41283
[email protected]c1bb5af2013-03-13 19:06:27284 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
[email protected]c1bb5af2013-03-13 19:06:27285 TileManager* tile_manager() { return tile_manager_.get(); }
[email protected]13525d62014-05-20 21:22:04286 void SetUseGpuRasterization(bool use_gpu);
287 bool use_gpu_rasterization() const { return use_gpu_rasterization_; }
[email protected]473f1f22014-05-22 08:19:17288 bool create_low_res_tiling() const {
289 return settings_.create_low_res_tiling && !use_gpu_rasterization_;
290 }
[email protected]b7635e02014-04-28 07:08:43291 ResourcePool* resource_pool() { return resource_pool_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27292 Renderer* renderer() { return renderer_.get(); }
[email protected]7a8bcd262014-01-15 12:54:58293 const RendererCapabilitiesImpl& GetRendererCapabilities() const;
[email protected]cd57cc5a2012-10-12 22:43:41294
[email protected]e0341352013-04-06 05:01:20295 virtual bool SwapBuffers(const FrameData& frame);
[email protected]97e9ccd62014-04-12 01:07:15296 virtual void WillBeginImplFrame(const BeginFrameArgs& args);
[email protected]c48536a52013-09-14 00:02:08297 void DidModifyTilePriorities();
[email protected]cd57cc5a2012-10-12 22:43:41298
[email protected]c1bb5af2013-03-13 19:06:27299 LayerTreeImpl* active_tree() { return active_tree_.get(); }
300 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
301 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
302 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
[email protected]71618ed2014-07-24 02:23:45303 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27304 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
[email protected]12a63da2014-06-13 06:06:22305 // Returns the tree LTH synchronizes with.
306 LayerTreeImpl* sync_tree() {
[email protected]fc20d142014-07-01 00:49:15307 return pending_tree_ ? pending_tree_.get() : active_tree_.get();
[email protected]12a63da2014-06-13 06:06:22308 }
[email protected]2f0d92f2013-06-11 04:07:20309 virtual void CreatePendingTree();
[email protected]1e212c9bb2013-09-07 04:32:14310 virtual void UpdateVisibleTiles();
[email protected]fc20d142014-07-01 00:49:15311 virtual void ActivateSyncTree();
[email protected]cd57cc5a2012-10-12 22:43:41312
[email protected]c1bb5af2013-03-13 19:06:27313 // Shortcuts to layers on the active tree.
314 LayerImpl* RootLayer() const;
[email protected]adeda572014-01-31 00:49:47315 LayerImpl* InnerViewportScrollLayer() const;
316 LayerImpl* OuterViewportScrollLayer() const;
[email protected]c1bb5af2013-03-13 19:06:27317 LayerImpl* CurrentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41318
[email protected]f161ca9e2014-04-01 13:57:01319 int scroll_layer_id_when_mouse_over_scrollbar() const {
[email protected]f620b0e72013-10-01 21:38:24320 return scroll_layer_id_when_mouse_over_scrollbar_;
321 }
[email protected]f161ca9e2014-04-01 13:57:01322 bool scroll_affects_scroll_handler() const {
323 return scroll_affects_scroll_handler_;
324 }
[email protected]dab0a422014-08-13 16:09:46325 void QueueSwapPromiseForMainThreadScrollUpdate(
326 scoped_ptr<SwapPromise> swap_promise);
[email protected]f620b0e72013-10-01 21:38:24327
[email protected]251699b2013-10-09 00:21:26328 bool IsCurrentlyScrolling() const;
329
[email protected]c1bb5af2013-03-13 19:06:27330 virtual void SetVisible(bool visible);
331 bool visible() const { return visible_; }
[email protected]cd57cc5a2012-10-12 22:43:41332
[email protected]d7eb8c72013-03-23 22:57:13333 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
[email protected]6be422b2013-12-08 06:47:31334 void SetNeedsRedraw();
[email protected]d7eb8c72013-03-23 22:57:13335
[email protected]206a3922013-05-17 06:34:12336 ManagedMemoryPolicy ActualManagedMemoryPolicy() const;
337
[email protected]3f2ff112013-08-03 02:41:07338 size_t memory_allocation_limit_bytes() const;
[email protected]990e050a2013-09-23 18:50:21339 int memory_allocation_priority_cutoff() const;
[email protected]cd57cc5a2012-10-12 22:43:41340
[email protected]64348ea2014-01-29 22:58:26341 void SetViewportSize(const gfx::Size& device_viewport_size);
[email protected]4a6c091d2014-04-24 21:06:46342 gfx::Size device_viewport_size() const { return device_viewport_size_; }
[email protected]cd57cc5a2012-10-12 22:43:41343
[email protected]9f4f6a32013-09-04 21:35:12344 void SetOverhangUIResource(UIResourceId overhang_ui_resource_id,
[email protected]64348ea2014-01-29 22:58:26345 const gfx::Size& overhang_ui_resource_size);
[email protected]9f4f6a32013-09-04 21:35:12346
[email protected]c1bb5af2013-03-13 19:06:27347 void SetDeviceScaleFactor(float device_scale_factor);
348 float device_scale_factor() const { return device_scale_factor_; }
[email protected]cd57cc5a2012-10-12 22:43:41349
[email protected]54af03522013-09-05 00:43:28350 const gfx::Transform& DrawTransform() const;
[email protected]f224cc92013-06-06 23:23:32351
[email protected]c1bb5af2013-03-13 19:06:27352 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
[email protected]cd57cc5a2012-10-12 22:43:41353
[email protected]c1bb5af2013-03-13 19:06:27354 bool needs_animate_layers() const {
355 return !animation_registrar_->active_animation_controllers().empty();
356 }
[email protected]cd57cc5a2012-10-12 22:43:41357
[email protected]d7626ffd2013-03-29 00:17:42358 void set_max_memory_needed_bytes(size_t bytes) {
359 max_memory_needed_bytes_ = bytes;
360 }
361
[email protected]c1bb5af2013-03-13 19:06:27362 FrameRateCounter* fps_counter() {
363 return fps_counter_.get();
364 }
365 PaintTimeCounter* paint_time_counter() {
366 return paint_time_counter_.get();
367 }
368 MemoryHistory* memory_history() {
369 return memory_history_.get();
370 }
371 DebugRectHistory* debug_rect_history() {
372 return debug_rect_history_.get();
373 }
374 ResourceProvider* resource_provider() {
375 return resource_provider_.get();
376 }
377 TopControlsManager* top_controls_manager() {
378 return top_controls_manager_.get();
379 }
[email protected]4bb0f312014-02-25 02:02:32380 const GlobalStateThatImpactsTilePriority& global_tile_state() {
381 return global_tile_state_;
382 }
[email protected]ff762fb2012-12-12 19:18:37383
[email protected]c1bb5af2013-03-13 19:06:27384 Proxy* proxy() const { return proxy_; }
[email protected]cd57cc5a2012-10-12 22:43:41385
[email protected]c1bb5af2013-03-13 19:06:27386 AnimationRegistrar* animation_registrar() const {
387 return animation_registrar_.get();
388 }
[email protected]de4afb5e2012-12-20 00:11:34389
[email protected]6e7fdeb2013-07-09 14:28:38390 void SetDebugState(const LayerTreeDebugState& new_debug_state);
[email protected]c1bb5af2013-03-13 19:06:27391 const LayerTreeDebugState& debug_state() const { return debug_state_; }
[email protected]f511afb2012-11-30 01:55:20392
[email protected]c1bb5af2013-03-13 19:06:27393 class CC_EXPORT CullRenderPassesWithNoQuads {
[email protected]30d82142014-05-12 04:26:02394 public:
[email protected]c1bb5af2013-03-13 19:06:27395 bool ShouldRemoveRenderPass(const RenderPassDrawQuad& quad,
396 const FrameData& frame) const;
[email protected]cd57cc5a2012-10-12 22:43:41397
[email protected]c1bb5af2013-03-13 19:06:27398 // Iterates in draw order, so that when a surface is removed, and its
399 // target becomes empty, then its target can be removed also.
400 size_t RenderPassListBegin(const RenderPassList& list) const { return 0; }
401 size_t RenderPassListEnd(const RenderPassList& list) const {
402 return list.size();
403 }
404 size_t RenderPassListNext(size_t it) const { return it + 1; }
405 };
[email protected]cd57cc5a2012-10-12 22:43:41406
[email protected]c1bb5af2013-03-13 19:06:27407 template <typename RenderPassCuller>
408 static void RemoveRenderPasses(RenderPassCuller culler, FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41409
[email protected]a2b5ded2013-05-20 21:32:53410 gfx::Vector2dF accumulated_root_overscroll() const {
411 return accumulated_root_overscroll_;
412 }
[email protected]a2b5ded2013-05-20 21:32:53413
[email protected]c1bb5af2013-03-13 19:06:27414 bool pinch_gesture_active() const { return pinch_gesture_active_; }
[email protected]166db5c82013-01-09 23:54:31415
[email protected]c1bb5af2013-03-13 19:06:27416 void SetTreePriority(TreePriority priority);
vmpstr56ace232014-10-09 20:16:28417 TreePriority GetTreePriority() const;
[email protected]362f1e8b2013-01-21 16:54:30418
[email protected]04c5900d2014-08-18 13:38:36419 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args);
420 void ResetCurrentBeginFrameArgsForNextFrame();
421 virtual BeginFrameArgs CurrentBeginFrameArgs() const;
[email protected]829ad972013-01-28 23:36:10422
[email protected]c92195e2014-05-07 18:18:49423 // Expected time between two begin impl frame calls.
424 base::TimeDelta begin_impl_frame_interval() const {
425 return begin_impl_frame_interval_;
426 }
427
dcheng716bedf2014-10-21 09:51:08428 void AsValueInto(base::debug::TracedValue* value) const override;
[email protected]d12aa932014-08-01 13:10:38429 void AsValueWithFrameInto(FrameData* frame,
430 base::debug::TracedValue* value) const;
431 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const;
432 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame(
433 FrameData* frame) const;
434 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue()
435 const;
436 void ActivationStateAsValueInto(base::debug::TracedValue* value) const;
[email protected]131a0c22013-02-12 18:31:08437
[email protected]c1bb5af2013-03-13 19:06:27438 bool page_scale_animation_active() const { return !!page_scale_animation_; }
[email protected]498ddd02013-02-28 23:59:25439
[email protected]741fba422013-09-20 03:34:14440 virtual void CreateUIResource(UIResourceId uid,
441 const UIResourceBitmap& bitmap);
[email protected]c9280762013-08-01 06:28:57442 // Deletes a UI resource. May safely be called more than once.
[email protected]741fba422013-09-20 03:34:14443 virtual void DeleteUIResource(UIResourceId uid);
[email protected]127bdc1a2013-09-11 01:44:48444 void EvictAllUIResources();
445 bool EvictedUIResourcesExist() const;
[email protected]c9280762013-08-01 06:28:57446
[email protected]741fba422013-09-20 03:34:14447 virtual ResourceProvider::ResourceId ResourceIdForUIResource(
448 UIResourceId uid) const;
[email protected]c9280762013-08-01 06:28:57449
[email protected]709c9542013-10-26 01:43:51450 virtual bool IsUIResourceOpaque(UIResourceId uid) const;
451
[email protected]efbdb3a2013-10-04 00:35:13452 struct UIResourceData {
453 ResourceProvider::ResourceId resource_id;
454 gfx::Size size;
[email protected]709c9542013-10-26 01:43:51455 bool opaque;
[email protected]efbdb3a2013-10-04 00:35:13456 };
457
[email protected]5e5648a2013-11-18 00:39:33458 void ScheduleMicroBenchmark(scoped_ptr<MicroBenchmarkImpl> benchmark);
459
[email protected]4a28a612013-11-27 02:06:33460 CompositorFrameMetadata MakeCompositorFrameMetadata() const;
[email protected]59fee302013-12-10 17:53:30461 // Viewport rectangle and clip in nonflipped window space. These rects
462 // should only be used by Renderer subclasses to populate glViewport/glClip
463 // and their software-mode equivalents.
464 gfx::Rect DeviceViewport() const;
465 gfx::Rect DeviceClip() const;
[email protected]4a28a612013-11-27 02:06:33466
[email protected]6be422b2013-12-08 06:47:31467 // When a SwapPromiseMonitor is created on the impl thread, it calls
468 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl.
469 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor()
470 // to unregister itself.
471 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor);
472 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor);
473
[email protected]8aa39ecb2014-06-12 14:19:14474 void RegisterPictureLayerImpl(PictureLayerImpl* layer);
475 void UnregisterPictureLayerImpl(PictureLayerImpl* layer);
476
[email protected]bf050582014-07-24 11:10:58477 void GetPictureLayerImplPairs(
478 std::vector<PictureLayerImpl::Pair>* layers) const;
479
bokan88eae012014-09-09 20:40:42480 void SetTopControlsLayoutHeight(float height);
481
vmpstr61ed94a12014-10-09 04:49:30482 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; }
483 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; }
484 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; }
485
[email protected]c1bb5af2013-03-13 19:06:27486 protected:
[email protected]372bad5f2013-03-21 16:38:43487 LayerTreeHostImpl(
488 const LayerTreeSettings& settings,
489 LayerTreeHostImplClient* client,
490 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57491 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05492 SharedBitmapManager* shared_bitmap_manager,
493 GpuMemoryBufferManager* gpu_memory_buffer_manager,
[email protected]dbe759a2013-12-02 19:23:02494 int id);
[email protected]cd57cc5a2012-10-12 22:43:41495
bokanef971462014-10-13 22:58:32496 void UpdateViewportContainerSizes();
[email protected]fef74fd2014-02-27 06:28:17497
[email protected]c1bb5af2013-03-13 19:06:27498 // Virtual for testing.
[email protected]27152642014-03-11 20:42:00499 virtual void AnimateLayers(base::TimeTicks monotonic_time);
[email protected]cd57cc5a2012-10-12 22:43:41500
[email protected]c1bb5af2013-03-13 19:06:27501 // Virtual for testing.
502 virtual base::TimeDelta LowFrequencyAnimationInterval() const;
[email protected]cd57cc5a2012-10-12 22:43:41503
[email protected]c1bb5af2013-03-13 19:06:27504 const AnimationRegistrar::AnimationControllerMap&
505 active_animation_controllers() const {
506 return animation_registrar_->active_animation_controllers();
507 }
[email protected]de4afb5e2012-12-20 00:11:34508
[email protected]c48536a52013-09-14 00:02:08509 bool manage_tiles_needed() const { return tile_priorities_dirty_; }
[email protected]54af03522013-09-05 00:43:28510
[email protected]c1bb5af2013-03-13 19:06:27511 LayerTreeHostImplClient* client_;
512 Proxy* proxy_;
[email protected]cd57cc5a2012-10-12 22:43:41513
[email protected]c1bb5af2013-03-13 19:06:27514 private:
[email protected]ced667b2014-05-22 21:49:53515 void CreateAndSetRenderer();
516 void CreateAndSetTileManager();
517 void DestroyTileManager();
[email protected]50644642013-06-20 13:58:55518 void ReleaseTreeResources();
519 void EnforceZeroBudget(bool zero_budget);
[email protected]2b154b22013-06-07 09:03:27520
[email protected]fc20d142014-07-01 00:49:15521 bool UsePendingTreeForSync() const;
reveman423e7da2014-09-23 16:57:44522 bool UseZeroCopyRasterizer() const;
523 bool UseOneCopyRasterizer() const;
[email protected]ced667b2014-05-22 21:49:53524
bokan59379b092014-09-29 13:47:21525 // Scroll by preferring to move the outer viewport first, only moving the
526 // inner if the outer is at its scroll extents.
[email protected]adeda572014-01-31 00:49:47527 void ScrollViewportBy(gfx::Vector2dF scroll_delta);
bokan59379b092014-09-29 13:47:21528 // Scroll by preferring to move the inner viewport first, only moving the
529 // outer if the inner is at its scroll extents.
530 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta);
[email protected]c1bb5af2013-03-13 19:06:27531 void AnimatePageScale(base::TimeTicks monotonic_time);
532 void AnimateScrollbars(base::TimeTicks monotonic_time);
[email protected]ffb2720f2013-03-15 19:18:37533 void AnimateTopControls(base::TimeTicks monotonic_time);
[email protected]2d692992012-12-19 01:19:32534
bokanef971462014-10-13 22:58:32535 bool ShouldTopControlsConsumeScroll(const gfx::Vector2dF& scroll_delta) const;
536
[email protected]c1bb5af2013-03-13 19:06:27537 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
[email protected]ed511b8d2013-03-25 03:29:29538 LayerImpl* layer_impl,
539 float scale_from_viewport_to_screen_space,
[email protected]14bc5d682014-01-17 07:26:47540 const gfx::PointF& viewport_point,
[email protected]3244c9132014-01-23 10:39:12541 const gfx::Vector2dF& viewport_delta);
[email protected]615c78a2013-01-24 23:44:16542
[email protected]50761e92013-03-29 20:51:28543 void TrackDamageForAllSurfaces(
544 LayerImpl* root_draw_layer,
545 const LayerImplList& render_surface_layer_list);
[email protected]cd57cc5a2012-10-12 22:43:41546
[email protected]8be1a9bf2013-05-01 03:45:19547 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy);
548
[email protected]7ddfe7e82014-01-30 07:22:11549 // This function should only be called from PrepareToDraw, as DidDrawAllLayers
550 // must be called if this helper function is called. Returns DRAW_SUCCESS if
551 // the frame should be drawn.
[email protected]30d82142014-05-12 04:26:02552 DrawResult CalculateRenderPasses(FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41553
[email protected]c1bb5af2013-03-13 19:06:27554 void ClearCurrentlyScrollingLayer();
[email protected]cd57cc5a2012-10-12 22:43:41555
[email protected]f620b0e72013-10-01 21:38:24556 bool HandleMouseOverScrollbar(LayerImpl* layer_impl,
[email protected]14bc5d682014-01-17 07:26:47557 const gfx::PointF& device_viewport_point);
[email protected]f620b0e72013-10-01 21:38:24558
[email protected]c1bb5af2013-03-13 19:06:27559 void AnimateScrollbarsRecursive(LayerImpl* layer,
560 base::TimeTicks time);
[email protected]cd57cc5a2012-10-12 22:43:41561
[email protected]f620b0e72013-10-01 21:38:24562 LayerImpl* FindScrollLayerForDeviceViewportPoint(
[email protected]14bc5d682014-01-17 07:26:47563 const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02564 InputHandler::ScrollInputType type,
[email protected]f620b0e72013-10-01 21:38:24565 LayerImpl* layer_hit_by_point,
[email protected]f161ca9e2014-04-01 13:57:01566 bool* scroll_on_main_thread,
[email protected]edcc1a12014-05-06 01:26:39567 bool* optional_has_ancestor_scroll_handler) const;
[email protected]14bc5d682014-01-17 07:26:47568 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02569 LayerImpl* layer_impl);
[email protected]930ff43b2014-05-02 05:24:00570 void StartScrollbarFadeRecursive(LayerImpl* layer);
[email protected]3f2ff112013-08-03 02:41:07571 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy,
572 bool zero_budget);
[email protected]0309ba5e02013-06-26 04:11:08573 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
[email protected]0fc818e2013-03-18 06:45:20574
[email protected]8bb6cfa2013-07-23 00:11:19575 void DidInitializeVisibleTile();
576
[email protected]127bdc1a2013-09-11 01:44:48577 void MarkUIResourceNotEvicted(UIResourceId uid);
578
[email protected]6be422b2013-12-08 06:47:31579 void NotifySwapPromiseMonitorsOfSetNeedsRedraw();
[email protected]dab0a422014-08-13 16:09:46580 void NotifySwapPromiseMonitorsOfForwardingToMainThread();
[email protected]6be422b2013-12-08 06:47:31581
[email protected]efbdb3a2013-10-04 00:35:13582 typedef base::hash_map<UIResourceId, UIResourceData>
[email protected]c9280762013-08-01 06:28:57583 UIResourceMap;
584 UIResourceMap ui_resource_map_;
585
[email protected]127bdc1a2013-09-11 01:44:48586 // Resources that were evicted by EvictAllUIResources. Resources are removed
587 // from this when they are touched by a create or destroy from the UI resource
588 // request queue.
589 std::set<UIResourceId> evicted_ui_resources_;
590
[email protected]c1bb5af2013-03-13 19:06:27591 scoped_ptr<OutputSurface> output_surface_;
[email protected]fbe89f72013-05-21 07:24:24592
593 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
594 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
[email protected]c1bb5af2013-03-13 19:06:27595 scoped_ptr<ResourceProvider> resource_provider_;
[email protected]c1bb5af2013-03-13 19:06:27596 scoped_ptr<TileManager> tile_manager_;
[email protected]13525d62014-05-20 21:22:04597 bool use_gpu_rasterization_;
[email protected]7beac1b52014-04-10 23:09:56598 scoped_ptr<RasterWorkerPool> raster_worker_pool_;
[email protected]eece11e2014-04-12 03:07:16599 scoped_ptr<ResourcePool> resource_pool_;
[email protected]2cccfef2014-05-01 06:05:16600 scoped_ptr<ResourcePool> staging_resource_pool_;
[email protected]fbe89f72013-05-21 07:24:24601 scoped_ptr<Renderer> renderer_;
[email protected]3b31c6ac2012-12-06 21:27:29602
[email protected]1bcced22013-09-24 13:51:19603 GlobalStateThatImpactsTilePriority global_tile_state_;
604
[email protected]c1bb5af2013-03-13 19:06:27605 // Tree currently being drawn.
606 scoped_ptr<LayerTreeImpl> active_tree_;
[email protected]3b31c6ac2012-12-06 21:27:29607
[email protected]c1bb5af2013-03-13 19:06:27608 // In impl-side painting mode, tree with possibly incomplete rasterized
[email protected]4f48f6e2013-08-27 06:33:38609 // content. May be promoted to active by ActivatePendingTree().
[email protected]c1bb5af2013-03-13 19:06:27610 scoped_ptr<LayerTreeImpl> pending_tree_;
[email protected]48871fc2013-01-23 07:36:51611
[email protected]c1bb5af2013-03-13 19:06:27612 // In impl-side painting mode, inert tree with layers that can be recycled
613 // by the next sync from the main thread.
614 scoped_ptr<LayerTreeImpl> recycle_tree_;
[email protected]48871fc2013-01-23 07:36:51615
[email protected]200a9c062013-05-20 04:34:37616 InputHandlerClient* input_handler_client_;
[email protected]c1bb5af2013-03-13 19:06:27617 bool did_lock_scrolling_layer_;
618 bool should_bubble_scrolls_;
619 bool wheel_scrolling_;
[email protected]f161ca9e2014-04-01 13:57:01620 bool scroll_affects_scroll_handler_;
[email protected]f620b0e72013-10-01 21:38:24621 int scroll_layer_id_when_mouse_over_scrollbar_;
[email protected]dab0a422014-08-13 16:09:46622 ScopedPtrVector<SwapPromise> swap_promises_for_main_thread_scroll_update_;
[email protected]a23451e2013-06-07 20:58:26623
[email protected]c48536a52013-09-14 00:02:08624 bool tile_priorities_dirty_;
[email protected]a23451e2013-06-07 20:58:26625
[email protected]1960a712013-04-30 17:06:47626 // The optional delegate for the root layer scroll offset.
627 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_;
[email protected]c1bb5af2013-03-13 19:06:27628 LayerTreeSettings settings_;
629 LayerTreeDebugState debug_state_;
[email protected]c1bb5af2013-03-13 19:06:27630 bool visible_;
[email protected]3f2ff112013-08-03 02:41:07631 ManagedMemoryPolicy cached_managed_memory_policy_;
[email protected]cd57cc5a2012-10-12 22:43:41632
[email protected]a2b5ded2013-05-20 21:32:53633 gfx::Vector2dF accumulated_root_overscroll_;
[email protected]6e921bd2013-04-29 21:10:20634
[email protected]c1bb5af2013-03-13 19:06:27635 bool pinch_gesture_active_;
[email protected]2fa342b82013-09-24 03:19:13636 bool pinch_gesture_end_should_clear_scrolling_layer_;
[email protected]c1bb5af2013-03-13 19:06:27637 gfx::Point previous_pinch_anchor_;
[email protected]cd57cc5a2012-10-12 22:43:41638
[email protected]c1bb5af2013-03-13 19:06:27639 scoped_ptr<TopControlsManager> top_controls_manager_;
[email protected]3ba4cae2013-01-16 03:58:38640
[email protected]c1bb5af2013-03-13 19:06:27641 scoped_ptr<PageScaleAnimation> page_scale_animation_;
[email protected]cd57cc5a2012-10-12 22:43:41642
[email protected]c1bb5af2013-03-13 19:06:27643 // This is used for ticking animations slowly when hidden.
644 scoped_ptr<LayerTreeHostImplTimeSourceAdapter> time_source_client_adapter_;
[email protected]cd57cc5a2012-10-12 22:43:41645
[email protected]c1bb5af2013-03-13 19:06:27646 scoped_ptr<FrameRateCounter> fps_counter_;
647 scoped_ptr<PaintTimeCounter> paint_time_counter_;
648 scoped_ptr<MemoryHistory> memory_history_;
649 scoped_ptr<DebugRectHistory> debug_rect_history_;
[email protected]cd57cc5a2012-10-12 22:43:41650
[email protected]ea468c6c2013-09-10 08:25:11651 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
652
[email protected]d7626ffd2013-03-29 00:17:42653 // The maximum memory that would be used by the prioritized resource
654 // manager, if there were no limit on memory usage.
655 size_t max_memory_needed_bytes_;
656
[email protected]50644642013-06-20 13:58:55657 bool zero_budget_;
[email protected]d3afa112012-12-08 06:24:28658
[email protected]54af03522013-09-05 00:43:28659 // Viewport size passed in from the main thread, in physical pixels. This
660 // value is the default size for all concepts of physical viewport (draw
661 // viewport, scrolling viewport and device viewport), but it can be
662 // overridden.
[email protected]f224cc92013-06-06 23:23:32663 gfx::Size device_viewport_size_;
664
665 // Conversion factor from CSS pixels to physical pixels when
666 // pageScaleFactor=1.
667 float device_scale_factor_;
668
[email protected]9f4f6a32013-09-04 21:35:12669 // UI resource to use for drawing overhang gutters.
670 UIResourceId overhang_ui_resource_id_;
671 gfx::Size overhang_ui_resource_size_;
672
[email protected]54af03522013-09-05 00:43:28673 // Optional top-level constraints that can be set by the OutputSurface.
674 // - external_transform_ applies a transform above the root layer
675 // - external_viewport_ is used DrawProperties, tile management and
676 // glViewport/window projection matrix.
677 // - external_clip_ specifies a top-level clip rect
[email protected]bd5324592014-07-31 09:09:33678 // - viewport_rect_for_tile_priority_ is the rect in view space used for
679 // tiling priority.
[email protected]f224cc92013-06-06 23:23:32680 gfx::Transform external_transform_;
681 gfx::Rect external_viewport_;
[email protected]54af03522013-09-05 00:43:28682 gfx::Rect external_clip_;
[email protected]bd5324592014-07-31 09:09:33683 gfx::Rect viewport_rect_for_tile_priority_;
[email protected]c05dfbb2014-07-10 22:49:04684 bool resourceless_software_draw_;
[email protected]f224cc92013-06-06 23:23:32685
[email protected]878705be2013-04-15 22:44:02686 gfx::Rect viewport_damage_rect_;
[email protected]e0341352013-04-06 05:01:20687
[email protected]04c5900d2014-08-18 13:38:36688 BeginFrameArgs current_begin_frame_args_;
[email protected]829ad972013-01-28 23:36:10689
[email protected]c92195e2014-05-07 18:18:49690 // Expected time between two begin impl frame calls.
691 base::TimeDelta begin_impl_frame_interval_;
692
[email protected]c1bb5af2013-03-13 19:06:27693 scoped_ptr<AnimationRegistrar> animation_registrar_;
[email protected]de4afb5e2012-12-20 00:11:34694
[email protected]372bad5f2013-03-21 16:38:43695 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
[email protected]5e5648a2013-11-18 00:39:33696 MicroBenchmarkControllerImpl micro_benchmark_controller_;
[email protected]372bad5f2013-03-21 16:38:43697
[email protected]8bb6cfa2013-07-23 00:11:19698 bool need_to_update_visible_tiles_before_draw_;
[email protected]39643fb2013-07-09 17:28:19699
[email protected]5f07afc2013-07-19 05:17:18700 // Optional callback to notify of new tree activations.
[email protected]2022c672013-07-23 19:55:26701 base::Closure tree_activation_callback_;
[email protected]5f07afc2013-07-19 05:17:18702
[email protected]a7f35682013-10-22 23:05:57703 SharedBitmapManager* shared_bitmap_manager_;
reveman22dd9292014-10-13 20:52:05704 GpuMemoryBufferManager* gpu_memory_buffer_manager_;
[email protected]dbe759a2013-12-02 19:23:02705 int id_;
[email protected]a7f35682013-10-22 23:05:57706
[email protected]6be422b2013-12-08 06:47:31707 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
708
[email protected]8aa39ecb2014-06-12 14:19:14709 std::vector<PictureLayerImpl*> picture_layers_;
[email protected]bf050582014-07-24 11:10:58710 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_;
[email protected]8aa39ecb2014-06-12 14:19:14711
vmpstr61ed94a12014-10-09 04:49:30712 bool requires_high_res_to_draw_;
713
[email protected]c1bb5af2013-03-13 19:06:27714 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41715};
716
[email protected]0023e8b2012-10-15 12:52:45717} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41718
[email protected]556fd292013-03-18 08:03:04719#endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_