blob: 249367ba6071e64f2e8e94a48eaaed65077d8db7 [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]127bdc1a2013-09-11 01:44:488#include <set>
[email protected]bf691c22013-03-26 21:15:069#include <string>
10#include <vector>
11
[email protected]c4040a522012-10-21 15:01:4012#include "base/basictypes.h"
[email protected]c9280762013-08-01 06:28:5713#include "base/containers/hash_tables.h"
[email protected]c4040a522012-10-21 15:01:4014#include "base/memory/scoped_ptr.h"
[email protected]1b0df502013-06-27 23:39:5815#include "base/time/time.h"
[email protected]95e4e1a02013-03-18 07:09:0916#include "cc/animation/animation_events.h"
17#include "cc/animation/animation_registrar.h"
[email protected]930ff43b2014-05-02 05:24:0018#include "cc/animation/scrollbar_animation_controller.h"
[email protected]681ccff2013-03-18 06:13:5219#include "cc/base/cc_export.h"
aelias58eec0812014-12-04 01:04:4020#include "cc/base/synced_property.h"
vmpstr99aa853c2015-02-03 20:31:2221#include "cc/debug/frame_timing_tracker.h"
[email protected]5e5648a2013-11-18 00:39:3322#include "cc/debug/micro_benchmark_controller_impl.h"
[email protected]3052b10f2013-03-18 07:41:2123#include "cc/input/input_handler.h"
[email protected]1960a712013-04-30 17:06:4724#include "cc/input/layer_scroll_offset_delegate.h"
[email protected]3052b10f2013-03-18 07:41:2125#include "cc/input/top_controls_manager_client.h"
[email protected]50761e92013-03-29 20:51:2826#include "cc/layers/layer_lists.h"
[email protected]cc3cfaa2013-03-18 09:05:5227#include "cc/layers/render_pass_sink.h"
[email protected]df3c24c92013-06-19 03:54:3528#include "cc/output/begin_frame_args.h"
[email protected]fd32d122013-06-29 13:11:0429#include "cc/output/managed_memory_policy.h"
[email protected]7f0d825f2013-03-18 07:24:3030#include "cc/output/output_surface_client.h"
31#include "cc/output/renderer.h"
[email protected]89e8267a2013-03-18 07:50:5632#include "cc/quads/render_pass.h"
[email protected]c9280762013-08-01 06:28:5733#include "cc/resources/resource_provider.h"
[email protected]e12dd0e2013-03-18 08:24:4034#include "cc/resources/tile_manager.h"
jamesr9b8fda32015-03-16 19:11:0535#include "cc/resources/ui_resource_client.h"
mithrof7a21502014-12-17 03:24:4836#include "cc/scheduler/commit_earlyout_reason.h"
[email protected]30d82142014-05-12 04:26:0237#include "cc/scheduler/draw_result.h"
sunnyps7d073dc2015-04-16 23:29:1238#include "cc/scheduler/video_frame_controller.h"
jamesr9b8fda32015-03-16 19:11:0539#include "cc/trees/layer_tree_settings.h"
40#include "cc/trees/proxy.h"
[email protected]c9280762013-08-01 06:28:5741#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4642#include "third_party/skia/include/core/SkColor.h"
heejin.r.chungd28506ba2014-10-23 16:36:2043#include "ui/gfx/geometry/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4144
loyso2c4002d2015-03-13 02:31:4345namespace gfx {
46class ScrollOffset;
47}
48
[email protected]cd57cc5a2012-10-12 22:43:4149namespace cc {
50
[email protected]96baf3e2012-10-22 23:09:5551class CompletionEvent;
[email protected]bf189f62012-12-18 03:42:1152class CompositorFrameMetadata;
[email protected]96baf3e2012-10-22 23:09:5553class DebugRectHistory;
[email protected]bf050582014-07-24 11:10:5854class EvictionTilePriorityQueue;
[email protected]96baf3e2012-10-22 23:09:5555class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5556class LayerImpl;
[email protected]8bef40572012-12-11 21:38:0857class LayerTreeImpl;
[email protected]ec7541d2014-04-09 01:23:5358class MemoryHistory;
[email protected]96baf3e2012-10-22 23:09:5559class PageScaleAnimation;
[email protected]0edbfbe9f2013-01-17 03:33:0360class PaintTimeCounter;
[email protected]8aa39ecb2014-06-12 14:19:1461class PictureLayerImpl;
[email protected]bf050582014-07-24 11:10:5862class RasterTilePriorityQueue;
vmiuraa30e1ea2014-12-09 19:23:5163class TileTaskWorkerPool;
[email protected]96baf3e2012-10-22 23:09:5564class RenderPassDrawQuad;
[email protected]ec7541d2014-04-09 01:23:5365class RenderingStatsInstrumentation;
[email protected]eece11e2014-04-12 03:07:1666class ResourcePool;
ccameron4163cc352014-11-13 19:06:3667class ScrollElasticityHelper;
[email protected]bf1cfd9a2013-09-26 05:43:0268class ScrollbarLayerImplBase;
jamesr9b8fda32015-03-16 19:11:0569class SwapPromise;
70class SwapPromiseMonitor;
[email protected]ea468c6c2013-09-10 08:25:1171class TextureMailboxDeleter;
[email protected]3ba4cae2013-01-16 03:58:3872class TopControlsManager;
[email protected]c9280762013-08-01 06:28:5773class UIResourceBitmap;
[email protected]741fba422013-09-20 03:34:1474class UIResourceRequest;
jamesr9b8fda32015-03-16 19:11:0575struct ScrollAndScaleSet;
bokanaa2748312015-03-26 00:10:3776class Viewport;
[email protected]cd57cc5a2012-10-12 22:43:4177
hendrikwc2bbd612014-12-03 23:49:3478enum class GpuRasterizationStatus {
79 ON,
80 ON_FORCED,
81 OFF_DEVICE,
82 OFF_VIEWPORT,
senorblancofb88a4e2015-05-08 17:28:4183 MSAA_CONTENT,
hendrikwc2bbd612014-12-03 23:49:3484 OFF_CONTENT
85};
86
[email protected]96baf3e2012-10-22 23:09:5587// LayerTreeHost->Proxy callback interface.
88class LayerTreeHostImplClient {
[email protected]c1bb5af2013-03-13 19:06:2789 public:
[email protected]fa339032014-02-18 22:11:5990 virtual void UpdateRendererCapabilitiesOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2791 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
[email protected]3dc0c772014-04-26 10:06:0592 virtual void CommitVSyncParameters(base::TimeTicks timebase,
93 base::TimeDelta interval) = 0;
94 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0;
[email protected]c14902662014-04-18 05:06:1195 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0;
[email protected]4d7e46a2013-11-08 05:33:4096 virtual void DidSwapBuffersOnImplThread() = 0;
[email protected]c14902662014-04-18 05:06:1197 virtual void DidSwapBuffersCompleteOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2798 virtual void OnCanDrawStateChanged(bool can_draw) = 0;
[email protected]4f48f6e2013-08-27 06:33:3899 virtual void NotifyReadyToActivate() = 0;
ernstmdfac03e12014-11-11 20:18:05100 virtual void NotifyReadyToDraw() = 0;
[email protected]43b8f982014-04-30 21:24:33101 // Please call these 3 functions through
102 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
103 // SetNeedsAnimate().
[email protected]c1bb5af2013-03-13 19:06:27104 virtual void SetNeedsRedrawOnImplThread() = 0;
[email protected]0023fc72014-01-10 20:05:06105 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0;
[email protected]43b8f982014-04-30 21:24:33106 virtual void SetNeedsAnimateOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:27107 virtual void SetNeedsCommitOnImplThread() = 0;
vmiura59ea9b4042014-12-09 20:50:39108 virtual void SetNeedsPrepareTilesOnImplThread() = 0;
sunnyps7d073dc2015-04-16 23:29:12109 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0;
[email protected]c1bb5af2013-03-13 19:06:27110 virtual void PostAnimationEventsToMainThreadOnImplThread(
[email protected]85b57502014-03-11 15:37:48111 scoped_ptr<AnimationEventsVector> events) = 0;
[email protected]c1bb5af2013-03-13 19:06:27112 // Returns true if resources were deleted by this call.
113 virtual bool ReduceContentsTextureMemoryOnImplThread(
114 size_t limit_bytes,
115 int priority_cutoff) = 0;
[email protected]c1bb5af2013-03-13 19:06:27116 virtual bool IsInsideDraw() = 0;
117 virtual void RenewTreePriority() = 0;
sunnypsae4316a2015-02-25 00:54:58118 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task,
119 base::TimeDelta delay) = 0;
[email protected]fc20d142014-07-01 00:49:15120 virtual void DidActivateSyncTree() = 0;
vmiura59ea9b4042014-12-09 20:50:39121 virtual void DidPrepareTiles() = 0;
[email protected]bf691c22013-03-26 21:15:06122
rouslanf7ebd8832015-01-22 01:54:14123 // Called when page scale animation has completed on the impl thread.
124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0;
125
sunnypseab5ac92015-04-02 20:26:13126 // Called when output surface asks for a draw.
127 virtual void OnDrawForOutputSurface() = 0;
128
[email protected]bf691c22013-03-26 21:15:06129 protected:
130 virtual ~LayerTreeHostImplClient() {}
[email protected]cd57cc5a2012-10-12 22:43:41131};
132
[email protected]c1bb5af2013-03-13 19:06:27133// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
134// state.
[email protected]200a9c062013-05-20 04:34:37135class CC_EXPORT LayerTreeHostImpl
136 : public InputHandler,
137 public RendererClient,
138 public TileManagerClient,
139 public OutputSurfaceClient,
140 public TopControlsManagerClient,
[email protected]930ff43b2014-05-02 05:24:00141 public ScrollbarAnimationControllerClient,
sunnyps7d073dc2015-04-16 23:29:12142 public VideoFrameControllerClient,
[email protected]200a9c062013-05-20 04:34:37143 public base::SupportsWeakPtr<LayerTreeHostImpl> {
[email protected]e216fef02013-03-20 22:56:10144 public:
[email protected]c1bb5af2013-03-13 19:06:27145 static scoped_ptr<LayerTreeHostImpl> Create(
146 const LayerTreeSettings& settings,
147 LayerTreeHostImplClient* client,
[email protected]372bad5f2013-03-21 16:38:43148 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57149 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05150 SharedBitmapManager* shared_bitmap_manager,
revemanf9a8a2342014-10-28 17:54:52151 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
reveman34b7a1522015-03-23 20:27:47152 TaskGraphRunner* task_graph_runner,
[email protected]dbe759a2013-12-02 19:23:02153 int id);
dcheng716bedf2014-10-21 09:51:08154 ~LayerTreeHostImpl() override;
[email protected]cd57cc5a2012-10-12 22:43:41155
[email protected]5ff3c9782013-04-29 17:35:12156 // InputHandler implementation
dcheng716bedf2014-10-21 09:51:08157 void BindToClient(InputHandlerClient* client) override;
158 InputHandler::ScrollStatus ScrollBegin(
[email protected]47a723f2014-03-05 12:42:49159 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37160 InputHandler::ScrollInputType type) override;
dcheng716bedf2014-10-21 09:51:08161 InputHandler::ScrollStatus ScrollAnimated(
[email protected]749cbc62014-07-10 01:06:35162 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37163 const gfx::Vector2dF& scroll_delta) override;
ccameron36d091f2014-11-07 03:18:50164 InputHandlerScrollResult ScrollBy(
165 const gfx::Point& viewport_point,
166 const gfx::Vector2dF& scroll_delta) override;
dcheng716bedf2014-10-21 09:51:08167 bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
168 ScrollDirection direction) override;
169 void SetRootLayerScrollOffsetDelegate(
mostynbf68776d82014-10-06 18:07:37170 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) override;
dcheng716bedf2014-10-21 09:51:08171 void OnRootLayerDelegatedScrollOffsetChanged() override;
172 void ScrollEnd() override;
173 InputHandler::ScrollStatus FlingScrollBegin() override;
174 void MouseMoveAt(const gfx::Point& viewport_point) override;
175 void PinchGestureBegin() override;
176 void PinchGestureUpdate(float magnify_delta,
177 const gfx::Point& anchor) override;
178 void PinchGestureEnd() override;
bokanfcdbc182014-11-21 21:53:33179 void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
180 bool anchor_point,
181 float page_scale,
182 base::TimeDelta duration);
dcheng716bedf2014-10-21 09:51:08183 void SetNeedsAnimate() override;
184 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
185 InputHandler::ScrollInputType type) override;
ccameron3b607362015-02-02 22:46:29186 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override;
rbyers18779d822015-02-05 06:22:06187 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override;
dcheng716bedf2014-10-21 09:51:08188 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
mostynbf68776d82014-10-06 18:07:37189 ui::LatencyInfo* latency) override;
ccameron4163cc352014-11-13 19:06:36190 ScrollElasticityHelper* CreateScrollElasticityHelper() override;
[email protected]cd57cc5a2012-10-12 22:43:41191
[email protected]c1bb5af2013-03-13 19:06:27192 // TopControlsManagerClient implementation.
aelias6004fe02015-02-07 21:43:01193 float TopControlsHeight() const override;
194 void SetCurrentTopControlsShownRatio(float offset) override;
195 float CurrentTopControlsShownRatio() const override;
dcheng716bedf2014-10-21 09:51:08196 void DidChangeTopControlsPosition() override;
197 bool HaveRootScrollLayer() const override;
[email protected]3ba4cae2013-01-16 03:58:38198
aelias6004fe02015-02-07 21:43:01199 void UpdateViewportContainerSizes();
200
[email protected]c1bb5af2013-03-13 19:06:27201 struct CC_EXPORT FrameData : public RenderPassSink {
202 FrameData();
dcheng716bedf2014-10-21 09:51:08203 ~FrameData() override;
ssid911e40e2015-02-09 17:55:20204 void AsValueInto(base::trace_event::TracedValue* value) const;
[email protected]cd57cc5a2012-10-12 22:43:41205
[email protected]c1bb5af2013-03-13 19:06:27206 std::vector<gfx::Rect> occluding_screen_space_rects;
207 std::vector<gfx::Rect> non_occluding_screen_space_rects;
vmpstr99aa853c2015-02-03 20:31:22208 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events;
[email protected]c1bb5af2013-03-13 19:06:27209 RenderPassList render_passes;
210 RenderPassIdHashMap render_passes_by_id;
[email protected]50761e92013-03-29 20:51:28211 const LayerImplList* render_surface_layer_list;
212 LayerImplList will_draw_layers;
[email protected]e0341352013-04-06 05:01:20213 bool has_no_damage;
[email protected]cd57cc5a2012-10-12 22:43:41214
[email protected]c1bb5af2013-03-13 19:06:27215 // RenderPassSink implementation.
dcheng716bedf2014-10-21 09:51:08216 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
[email protected]c1bb5af2013-03-13 19:06:27217 };
[email protected]cd57cc5a2012-10-12 22:43:41218
mithrof7a21502014-12-17 03:24:48219 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason);
[email protected]c1bb5af2013-03-13 19:06:27220 virtual void BeginCommit();
221 virtual void CommitComplete();
[email protected]27152642014-03-11 20:42:00222 virtual void Animate(base::TimeTicks monotonic_time);
[email protected]3d9f7432013-04-06 00:35:18223 virtual void UpdateAnimationState(bool start_ready_animations);
[email protected]b33348f2014-04-30 18:17:34224 void ActivateAnimations();
[email protected]200a9c062013-05-20 04:34:37225 void MainThreadHasStoppedFlinging();
[email protected]b8384e22013-12-03 02:20:48226 void DidAnimateScrollOffset();
[email protected]0023fc72014-01-10 20:05:06227 void SetViewportDamage(const gfx::Rect& damage_rect);
[email protected]cd57cc5a2012-10-12 22:43:41228
vmiura59ea9b4042014-12-09 20:50:39229 virtual void PrepareTiles();
[email protected]8947cbe2012-11-28 05:27:43230
[email protected]2aae96792014-05-15 23:10:50231 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we
232 // should try to avoid displaying the frame. If PrepareToDraw is called,
233 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is
234 // called between the two.
235 virtual DrawResult PrepareToDraw(FrameData* frame);
mithro248d1722015-05-05 05:23:45236 virtual void DrawLayers(FrameData* frame);
[email protected]c1bb5af2013-03-13 19:06:27237 // Must be called if and only if PrepareToDraw was called.
238 void DidDrawAllLayers(const FrameData& frame);
[email protected]cd57cc5a2012-10-12 22:43:41239
[email protected]c1bb5af2013-03-13 19:06:27240 const LayerTreeSettings& settings() const { return settings_; }
[email protected]cd57cc5a2012-10-12 22:43:41241
[email protected]0309ba5e02013-06-26 04:11:08242 // Evict all textures by enforcing a memory policy with an allocation of 0.
243 void EvictTexturesForTesting();
244
[email protected]4f48f6e2013-08-27 06:33:38245 // When blocking, this prevents client_->NotifyReadyToActivate() from being
246 // called. When disabled, it calls client_->NotifyReadyToActivate()
247 // immediately if any notifications had been blocked while blocking.
248 virtual void BlockNotifyReadyToActivateForTesting(bool block);
249
[email protected]34bff2122014-05-16 04:09:34250 // Resets all of the trees to an empty state.
251 void ResetTreesForTesting();
252
[email protected]c05dfbb2014-07-10 22:49:04253 DrawMode GetDrawMode() const;
[email protected]54af03522013-09-05 00:43:28254
255 // Viewport size in draw space: this size is in physical pixels and is used
256 // for draw properties, tilings, quads and render passes.
257 gfx::Size DrawViewportSize() const;
258
[email protected]bd5324592014-07-31 09:09:33259 // Viewport rect in view space used for tiling prioritization.
260 const gfx::Rect ViewportRectForTilePriority() const;
261
[email protected]59fee302013-12-10 17:53:30262 // RendererClient implementation.
dcheng716bedf2014-10-21 09:51:08263 void SetFullRootLayerDamage() override;
[email protected]8947cbe2012-11-28 05:27:43264
[email protected]c1bb5af2013-03-13 19:06:27265 // TileManagerClient implementation.
dcheng716bedf2014-10-21 09:51:08266 void NotifyReadyToActivate() override;
ernstmdfac03e12014-11-11 20:18:05267 void NotifyReadyToDraw() override;
dcheng716bedf2014-10-21 09:51:08268 void NotifyTileStateChanged(const Tile* tile) override;
vmpstrb4040632015-01-23 17:53:41269 scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue(
270 TreePriority tree_priority,
271 RasterTilePriorityQueue::Type type) override;
vmpstr997b00e2015-01-23 21:03:07272 scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue(
273 TreePriority tree_priority) override;
vmpstr4973f5b2015-02-02 19:27:29274 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override;
[email protected]cd57cc5a2012-10-12 22:43:41275
[email protected]930ff43b2014-05-02 05:24:00276 // ScrollbarAnimationControllerClient implementation.
sunnypsae4316a2015-02-25 00:54:58277 void StartAnimatingScrollbarAnimationController(
278 ScrollbarAnimationController* controller) override;
279 void StopAnimatingScrollbarAnimationController(
280 ScrollbarAnimationController* controller) override;
281 void PostDelayedScrollbarAnimationTask(const base::Closure& task,
282 base::TimeDelta delay) override;
283 void SetNeedsRedrawForScrollbarAnimation() override;
[email protected]930ff43b2014-05-02 05:24:00284
sunnyps7d073dc2015-04-16 23:29:12285 // VideoBeginFrameSource implementation.
286 void AddVideoFrameController(VideoFrameController* controller) override;
287 void RemoveVideoFrameController(VideoFrameController* controller) override;
288
[email protected]c1bb5af2013-03-13 19:06:27289 // OutputSurfaceClient implementation.
dcheng716bedf2014-10-21 09:51:08290 void CommitVSyncParameters(base::TimeTicks timebase,
291 base::TimeDelta interval) override;
292 void SetNeedsRedrawRect(const gfx::Rect& rect) override;
dcheng716bedf2014-10-21 09:51:08293 void SetExternalDrawConstraints(
[email protected]54af03522013-09-05 00:43:28294 const gfx::Transform& transform,
[email protected]0023fc72014-01-10 20:05:06295 const gfx::Rect& viewport,
296 const gfx::Rect& clip,
[email protected]bd5324592014-07-31 09:09:33297 const gfx::Rect& viewport_rect_for_tile_priority,
298 const gfx::Transform& transform_for_tile_priority,
mostynbf68776d82014-10-06 18:07:37299 bool resourceless_software_draw) override;
dcheng716bedf2014-10-21 09:51:08300 void DidLoseOutputSurface() override;
301 void DidSwapBuffers() override;
302 void DidSwapBuffersComplete() override;
303 void ReclaimResources(const CompositorFrameAck* ack) override;
304 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
305 void SetTreeActivationCallback(const base::Closure& callback) override;
sunnypseab5ac92015-04-02 20:26:13306 void OnDraw() override;
[email protected]3b31c6ac2012-12-06 21:27:29307
[email protected]c1bb5af2013-03-13 19:06:27308 // Called from LayerTreeImpl.
309 void OnCanDrawStateChangedForTree();
[email protected]cd57cc5a2012-10-12 22:43:41310
[email protected]b5174d712013-08-28 08:10:43311 // Implementation.
[email protected]12a63da2014-06-13 06:06:22312 int id() const { return id_; }
[email protected]6133cc232013-07-30 18:47:07313 bool CanDraw() const;
[email protected]c1bb5af2013-03-13 19:06:27314 OutputSurface* output_surface() const { return output_surface_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41315
[email protected]c1bb5af2013-03-13 19:06:27316 std::string LayerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41317
[email protected]c1bb5af2013-03-13 19:06:27318 void FinishAllRendering();
319 int SourceAnimationFrameNumber() const;
[email protected]cd57cc5a2012-10-12 22:43:41320
[email protected]c1bb5af2013-03-13 19:06:27321 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
[email protected]c1bb5af2013-03-13 19:06:27322 TileManager* tile_manager() { return tile_manager_.get(); }
senorblanco8d1b3ac2015-05-05 00:14:26323
324 void set_has_gpu_rasterization_trigger(bool flag) {
325 has_gpu_rasterization_trigger_ = flag;
326 }
327 void set_content_is_suitable_for_gpu_rasterization(bool flag) {
328 content_is_suitable_for_gpu_rasterization_ = flag;
329 }
330 void UpdateGpuRasterizationStatus();
[email protected]13525d62014-05-20 21:22:04331 bool use_gpu_rasterization() const { return use_gpu_rasterization_; }
senorblancofb88a4e2015-05-08 17:28:41332 bool use_msaa() const { return use_msaa_; }
hendrikwc2bbd612014-12-03 23:49:34333
334 GpuRasterizationStatus gpu_rasterization_status() const {
335 return gpu_rasterization_status_;
336 }
hendrikwc2bbd612014-12-03 23:49:34337
[email protected]473f1f22014-05-22 08:19:17338 bool create_low_res_tiling() const {
339 return settings_.create_low_res_tiling && !use_gpu_rasterization_;
340 }
[email protected]b7635e02014-04-28 07:08:43341 ResourcePool* resource_pool() { return resource_pool_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27342 Renderer* renderer() { return renderer_.get(); }
[email protected]7a8bcd262014-01-15 12:54:58343 const RendererCapabilitiesImpl& GetRendererCapabilities() const;
[email protected]cd57cc5a2012-10-12 22:43:41344
[email protected]e0341352013-04-06 05:01:20345 virtual bool SwapBuffers(const FrameData& frame);
[email protected]97e9ccd62014-04-12 01:07:15346 virtual void WillBeginImplFrame(const BeginFrameArgs& args);
mithro51693e382015-05-07 23:52:41347 virtual void DidFinishImplFrame();
[email protected]c48536a52013-09-14 00:02:08348 void DidModifyTilePriorities();
[email protected]cd57cc5a2012-10-12 22:43:41349
[email protected]c1bb5af2013-03-13 19:06:27350 LayerTreeImpl* active_tree() { return active_tree_.get(); }
351 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
352 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
353 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
[email protected]71618ed2014-07-24 02:23:45354 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27355 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
[email protected]12a63da2014-06-13 06:06:22356 // Returns the tree LTH synchronizes with.
357 LayerTreeImpl* sync_tree() {
enneaf5bda32015-02-19 01:27:36358 // TODO(enne): This is bogus. It should return based on the value of
359 // Proxy::CommitToActiveTree and not whether the pending tree exists.
[email protected]fc20d142014-07-01 00:49:15360 return pending_tree_ ? pending_tree_.get() : active_tree_.get();
[email protected]12a63da2014-06-13 06:06:22361 }
[email protected]2f0d92f2013-06-11 04:07:20362 virtual void CreatePendingTree();
[email protected]fc20d142014-07-01 00:49:15363 virtual void ActivateSyncTree();
[email protected]cd57cc5a2012-10-12 22:43:41364
[email protected]c1bb5af2013-03-13 19:06:27365 // Shortcuts to layers on the active tree.
366 LayerImpl* RootLayer() const;
[email protected]adeda572014-01-31 00:49:47367 LayerImpl* InnerViewportScrollLayer() const;
368 LayerImpl* OuterViewportScrollLayer() const;
[email protected]c1bb5af2013-03-13 19:06:27369 LayerImpl* CurrentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41370
[email protected]f161ca9e2014-04-01 13:57:01371 int scroll_layer_id_when_mouse_over_scrollbar() const {
[email protected]f620b0e72013-10-01 21:38:24372 return scroll_layer_id_when_mouse_over_scrollbar_;
373 }
[email protected]f161ca9e2014-04-01 13:57:01374 bool scroll_affects_scroll_handler() const {
375 return scroll_affects_scroll_handler_;
376 }
[email protected]dab0a422014-08-13 16:09:46377 void QueueSwapPromiseForMainThreadScrollUpdate(
378 scoped_ptr<SwapPromise> swap_promise);
[email protected]f620b0e72013-10-01 21:38:24379
jdduke16dde6e2014-10-24 00:22:56380 bool IsActivelyScrolling() const;
[email protected]251699b2013-10-09 00:21:26381
[email protected]c1bb5af2013-03-13 19:06:27382 virtual void SetVisible(bool visible);
383 bool visible() const { return visible_; }
[email protected]cd57cc5a2012-10-12 22:43:41384
mithro719bf6792014-11-10 15:36:47385 bool AnimationsAreVisible() { return visible() && CanDraw(); }
386
[email protected]d7eb8c72013-03-23 22:57:13387 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
[email protected]6be422b2013-12-08 06:47:31388 void SetNeedsRedraw();
[email protected]d7eb8c72013-03-23 22:57:13389
[email protected]206a3922013-05-17 06:34:12390 ManagedMemoryPolicy ActualManagedMemoryPolicy() const;
391
[email protected]3f2ff112013-08-03 02:41:07392 size_t memory_allocation_limit_bytes() const;
[email protected]990e050a2013-09-23 18:50:21393 int memory_allocation_priority_cutoff() const;
[email protected]cd57cc5a2012-10-12 22:43:41394
[email protected]64348ea2014-01-29 22:58:26395 void SetViewportSize(const gfx::Size& device_viewport_size);
[email protected]4a6c091d2014-04-24 21:06:46396 gfx::Size device_viewport_size() const { return device_viewport_size_; }
[email protected]cd57cc5a2012-10-12 22:43:41397
[email protected]c1bb5af2013-03-13 19:06:27398 void SetDeviceScaleFactor(float device_scale_factor);
399 float device_scale_factor() const { return device_scale_factor_; }
[email protected]cd57cc5a2012-10-12 22:43:41400
aelias58eec0812014-12-04 01:04:40401 void SetPageScaleOnActiveTree(float page_scale_factor);
402
[email protected]54af03522013-09-05 00:43:28403 const gfx::Transform& DrawTransform() const;
[email protected]f224cc92013-06-06 23:23:32404
[email protected]c1bb5af2013-03-13 19:06:27405 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
[email protected]cd57cc5a2012-10-12 22:43:41406
[email protected]d7626ffd2013-03-29 00:17:42407 void set_max_memory_needed_bytes(size_t bytes) {
408 max_memory_needed_bytes_ = bytes;
409 }
410
[email protected]c1bb5af2013-03-13 19:06:27411 FrameRateCounter* fps_counter() {
412 return fps_counter_.get();
413 }
414 PaintTimeCounter* paint_time_counter() {
415 return paint_time_counter_.get();
416 }
417 MemoryHistory* memory_history() {
418 return memory_history_.get();
419 }
420 DebugRectHistory* debug_rect_history() {
421 return debug_rect_history_.get();
422 }
423 ResourceProvider* resource_provider() {
424 return resource_provider_.get();
425 }
426 TopControlsManager* top_controls_manager() {
427 return top_controls_manager_.get();
428 }
[email protected]4bb0f312014-02-25 02:02:32429 const GlobalStateThatImpactsTilePriority& global_tile_state() {
430 return global_tile_state_;
431 }
[email protected]ff762fb2012-12-12 19:18:37432
[email protected]c1bb5af2013-03-13 19:06:27433 Proxy* proxy() const { return proxy_; }
[email protected]cd57cc5a2012-10-12 22:43:41434
[email protected]c1bb5af2013-03-13 19:06:27435 AnimationRegistrar* animation_registrar() const {
436 return animation_registrar_.get();
437 }
[email protected]de4afb5e2012-12-20 00:11:34438
[email protected]6e7fdeb2013-07-09 14:28:38439 void SetDebugState(const LayerTreeDebugState& new_debug_state);
[email protected]c1bb5af2013-03-13 19:06:27440 const LayerTreeDebugState& debug_state() const { return debug_state_; }
[email protected]f511afb2012-11-30 01:55:20441
[email protected]a2b5ded2013-05-20 21:32:53442 gfx::Vector2dF accumulated_root_overscroll() const {
443 return accumulated_root_overscroll_;
444 }
[email protected]a2b5ded2013-05-20 21:32:53445
[email protected]c1bb5af2013-03-13 19:06:27446 bool pinch_gesture_active() const { return pinch_gesture_active_; }
[email protected]166db5c82013-01-09 23:54:31447
[email protected]c1bb5af2013-03-13 19:06:27448 void SetTreePriority(TreePriority priority);
vmpstr56ace232014-10-09 20:16:28449 TreePriority GetTreePriority() const;
[email protected]362f1e8b2013-01-21 16:54:30450
[email protected]04c5900d2014-08-18 13:38:36451 virtual BeginFrameArgs CurrentBeginFrameArgs() const;
[email protected]829ad972013-01-28 23:36:10452
[email protected]c92195e2014-05-07 18:18:49453 // Expected time between two begin impl frame calls.
ksakamotof1a56b752015-05-08 08:15:03454 base::TimeDelta begin_impl_frame_interval() const {
455 return begin_impl_frame_interval_;
456 }
[email protected]c92195e2014-05-07 18:18:49457
[email protected]d12aa932014-08-01 13:10:38458 void AsValueWithFrameInto(FrameData* frame,
ssid911e40e2015-02-09 17:55:20459 base::trace_event::TracedValue* value) const;
ssid911e40e2015-02-09 17:55:20460 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame(
[email protected]d12aa932014-08-01 13:10:38461 FrameData* frame) const;
ssid911e40e2015-02-09 17:55:20462 void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const;
[email protected]131a0c22013-02-12 18:31:08463
[email protected]c1bb5af2013-03-13 19:06:27464 bool page_scale_animation_active() const { return !!page_scale_animation_; }
[email protected]498ddd02013-02-28 23:59:25465
[email protected]741fba422013-09-20 03:34:14466 virtual void CreateUIResource(UIResourceId uid,
467 const UIResourceBitmap& bitmap);
[email protected]c9280762013-08-01 06:28:57468 // Deletes a UI resource. May safely be called more than once.
[email protected]741fba422013-09-20 03:34:14469 virtual void DeleteUIResource(UIResourceId uid);
[email protected]127bdc1a2013-09-11 01:44:48470 void EvictAllUIResources();
471 bool EvictedUIResourcesExist() const;
[email protected]c9280762013-08-01 06:28:57472
[email protected]741fba422013-09-20 03:34:14473 virtual ResourceProvider::ResourceId ResourceIdForUIResource(
474 UIResourceId uid) const;
[email protected]c9280762013-08-01 06:28:57475
[email protected]709c9542013-10-26 01:43:51476 virtual bool IsUIResourceOpaque(UIResourceId uid) const;
477
[email protected]efbdb3a2013-10-04 00:35:13478 struct UIResourceData {
479 ResourceProvider::ResourceId resource_id;
480 gfx::Size size;
[email protected]709c9542013-10-26 01:43:51481 bool opaque;
[email protected]efbdb3a2013-10-04 00:35:13482 };
483
[email protected]5e5648a2013-11-18 00:39:33484 void ScheduleMicroBenchmark(scoped_ptr<MicroBenchmarkImpl> benchmark);
485
[email protected]4a28a612013-11-27 02:06:33486 CompositorFrameMetadata MakeCompositorFrameMetadata() const;
[email protected]59fee302013-12-10 17:53:30487 // Viewport rectangle and clip in nonflipped window space. These rects
488 // should only be used by Renderer subclasses to populate glViewport/glClip
489 // and their software-mode equivalents.
490 gfx::Rect DeviceViewport() const;
491 gfx::Rect DeviceClip() const;
[email protected]4a28a612013-11-27 02:06:33492
[email protected]6be422b2013-12-08 06:47:31493 // When a SwapPromiseMonitor is created on the impl thread, it calls
494 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl.
495 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor()
496 // to unregister itself.
497 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor);
498 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor);
499
hendrikw0ab2fae32015-05-06 00:08:42500 void GetValidTilePrioritiesPictureLayerImpls(
501 const LayerTreeImpl* tree,
502 std::vector<PictureLayerImpl*>* layers) const;
[email protected]bf050582014-07-24 11:10:58503
weiliangc8dac5a62015-04-02 06:12:35504 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for
505 // ReadyToDraw. crbug.com/469175
vmpstr61ed94a12014-10-09 04:49:30506 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; }
507 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; }
508 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; }
509
enne69277cb2014-10-29 23:03:40510 // Only valid for synchronous (non-scheduled) single-threaded case.
511 void SynchronouslyInitializeAllTiles();
512
vmiuraa30e1ea2014-12-09 19:23:51513 virtual void CreateResourceAndTileTaskWorkerPool(
514 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
enne03dbe8ae2014-10-30 01:32:55515 scoped_ptr<ResourcePool>* resource_pool,
516 scoped_ptr<ResourcePool>* staging_resource_pool);
517
vmpstr5377520a2014-12-29 23:26:13518 bool prepare_tiles_needed() const { return tile_priorities_dirty_; }
519
vmpstr99aa853c2015-02-03 20:31:22520 FrameTimingTracker* frame_timing_tracker() {
521 return frame_timing_tracker_.get();
522 }
523
bokanaa2748312015-03-26 00:10:37524 gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl,
525 const gfx::Vector2dF& delta,
526 const gfx::Point& viewport_point,
527 bool is_wheel_scroll);
528
vmpstrd704c872015-04-03 20:29:51529 // Record main frame timing information.
530 // |start_of_main_frame_args| is the BeginFrameArgs of the beginning of the
531 // main frame (ie the frame that kicked off the main frame).
532 // |expected_next_main_frame_args| is the BeginFrameArgs of the frame that
533 // follows the completion of the main frame (whether it is activation or some
534 // other completion, such as early out). Note that if there is a main frame
535 // scheduled in that frame, then this BeginFrameArgs will become the main
536 // frame args. However, if no such frame is scheduled, then this _would_ be
537 // the main frame args if it was scheduled.
538 void RecordMainFrameTiming(
539 const BeginFrameArgs& start_of_main_frame_args,
540 const BeginFrameArgs& expected_next_main_frame_args);
541
[email protected]c1bb5af2013-03-13 19:06:27542 protected:
[email protected]372bad5f2013-03-21 16:38:43543 LayerTreeHostImpl(
544 const LayerTreeSettings& settings,
545 LayerTreeHostImplClient* client,
546 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57547 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05548 SharedBitmapManager* shared_bitmap_manager,
revemanf9a8a2342014-10-28 17:54:52549 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
reveman34b7a1522015-03-23 20:27:47550 TaskGraphRunner* task_graph_runner,
[email protected]dbe759a2013-12-02 19:23:02551 int id);
[email protected]cd57cc5a2012-10-12 22:43:41552
[email protected]c1bb5af2013-03-13 19:06:27553 // Virtual for testing.
[email protected]27152642014-03-11 20:42:00554 virtual void AnimateLayers(base::TimeTicks monotonic_time);
[email protected]de4afb5e2012-12-20 00:11:34555
sunnypsc61ff5192015-03-18 01:41:25556 bool is_likely_to_require_a_draw() const {
557 return is_likely_to_require_a_draw_;
558 }
559
danakj112d3a102015-04-14 18:24:49560 // Removes empty or orphan RenderPasses from the frame.
561 static void RemoveRenderPasses(FrameData* frame);
562
[email protected]c1bb5af2013-03-13 19:06:27563 LayerTreeHostImplClient* client_;
564 Proxy* proxy_;
[email protected]cd57cc5a2012-10-12 22:43:41565
[email protected]c1bb5af2013-03-13 19:06:27566 private:
bokanaa2748312015-03-26 00:10:37567 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
568 LayerImpl* layer_impl,
569 const gfx::PointF& viewport_point,
570 const gfx::Vector2dF& viewport_delta);
571
[email protected]ced667b2014-05-22 21:49:53572 void CreateAndSetRenderer();
573 void CreateAndSetTileManager();
574 void DestroyTileManager();
[email protected]50644642013-06-20 13:58:55575 void ReleaseTreeResources();
vmpstr9ce5c662015-02-05 23:29:26576 void RecreateTreeResources();
[email protected]2b154b22013-06-07 09:03:27577
enne03dbe8ae2014-10-30 01:32:55578 bool IsSynchronousSingleThreaded() const;
[email protected]ced667b2014-05-22 21:49:53579
bokanaa2748312015-03-26 00:10:37580 Viewport* viewport() { return viewport_.get(); }
581
bokan59379b092014-09-29 13:47:21582 // Scroll by preferring to move the outer viewport first, only moving the
583 // inner if the outer is at its scroll extents.
[email protected]adeda572014-01-31 00:49:47584 void ScrollViewportBy(gfx::Vector2dF scroll_delta);
bokan59379b092014-09-29 13:47:21585 // Scroll by preferring to move the inner viewport first, only moving the
586 // outer if the inner is at its scroll extents.
587 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta);
sunnyps7d073dc2015-04-16 23:29:12588
[email protected]c1bb5af2013-03-13 19:06:27589 void AnimatePageScale(base::TimeTicks monotonic_time);
590 void AnimateScrollbars(base::TimeTicks monotonic_time);
[email protected]ffb2720f2013-03-15 19:18:37591 void AnimateTopControls(base::TimeTicks monotonic_time);
[email protected]2d692992012-12-19 01:19:32592
[email protected]50761e92013-03-29 20:51:28593 void TrackDamageForAllSurfaces(
594 LayerImpl* root_draw_layer,
595 const LayerImplList& render_surface_layer_list);
[email protected]cd57cc5a2012-10-12 22:43:41596
[email protected]8be1a9bf2013-05-01 03:45:19597 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy);
598
[email protected]7ddfe7e82014-01-30 07:22:11599 // This function should only be called from PrepareToDraw, as DidDrawAllLayers
600 // must be called if this helper function is called. Returns DRAW_SUCCESS if
601 // the frame should be drawn.
[email protected]30d82142014-05-12 04:26:02602 DrawResult CalculateRenderPasses(FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41603
[email protected]c1bb5af2013-03-13 19:06:27604 void ClearCurrentlyScrollingLayer();
[email protected]cd57cc5a2012-10-12 22:43:41605
[email protected]f620b0e72013-10-01 21:38:24606 bool HandleMouseOverScrollbar(LayerImpl* layer_impl,
[email protected]14bc5d682014-01-17 07:26:47607 const gfx::PointF& device_viewport_point);
[email protected]f620b0e72013-10-01 21:38:24608
[email protected]f620b0e72013-10-01 21:38:24609 LayerImpl* FindScrollLayerForDeviceViewportPoint(
[email protected]14bc5d682014-01-17 07:26:47610 const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02611 InputHandler::ScrollInputType type,
[email protected]f620b0e72013-10-01 21:38:24612 LayerImpl* layer_hit_by_point,
[email protected]f161ca9e2014-04-01 13:57:01613 bool* scroll_on_main_thread,
[email protected]edcc1a12014-05-06 01:26:39614 bool* optional_has_ancestor_scroll_handler) const;
[email protected]14bc5d682014-01-17 07:26:47615 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02616 LayerImpl* layer_impl);
[email protected]930ff43b2014-05-02 05:24:00617 void StartScrollbarFadeRecursive(LayerImpl* layer);
boliu247624d2015-04-11 02:04:25618 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
[email protected]0309ba5e02013-06-26 04:11:08619 void EnforceManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
[email protected]0fc818e2013-03-18 06:45:20620
[email protected]127bdc1a2013-09-11 01:44:48621 void MarkUIResourceNotEvicted(UIResourceId uid);
622
[email protected]6be422b2013-12-08 06:47:31623 void NotifySwapPromiseMonitorsOfSetNeedsRedraw();
[email protected]dab0a422014-08-13 16:09:46624 void NotifySwapPromiseMonitorsOfForwardingToMainThread();
[email protected]6be422b2013-12-08 06:47:31625
loyso2c4002d2015-03-13 02:31:43626 void ScrollAnimationCreate(LayerImpl* layer_impl,
627 const gfx::ScrollOffset& target_offset,
628 const gfx::ScrollOffset& current_offset);
629 bool ScrollAnimationUpdateTarget(LayerImpl* layer_impl,
630 const gfx::Vector2dF& scroll_delta);
631
[email protected]efbdb3a2013-10-04 00:35:13632 typedef base::hash_map<UIResourceId, UIResourceData>
[email protected]c9280762013-08-01 06:28:57633 UIResourceMap;
634 UIResourceMap ui_resource_map_;
635
[email protected]127bdc1a2013-09-11 01:44:48636 // Resources that were evicted by EvictAllUIResources. Resources are removed
637 // from this when they are touched by a create or destroy from the UI resource
638 // request queue.
639 std::set<UIResourceId> evicted_ui_resources_;
640
[email protected]c1bb5af2013-03-13 19:06:27641 scoped_ptr<OutputSurface> output_surface_;
[email protected]fbe89f72013-05-21 07:24:24642
643 // |resource_provider_| and |tile_manager_| can be NULL, e.g. when using tile-
644 // free rendering - see OutputSurface::ForcedDrawToSoftwareDevice().
ennebdb6fd202015-03-10 06:01:57645 // |tile_manager_| can also be NULL when raster_enabled is false.
[email protected]c1bb5af2013-03-13 19:06:27646 scoped_ptr<ResourceProvider> resource_provider_;
[email protected]c1bb5af2013-03-13 19:06:27647 scoped_ptr<TileManager> tile_manager_;
senorblanco8d1b3ac2015-05-05 00:14:26648 bool content_is_suitable_for_gpu_rasterization_;
649 bool has_gpu_rasterization_trigger_;
[email protected]13525d62014-05-20 21:22:04650 bool use_gpu_rasterization_;
senorblancofb88a4e2015-05-08 17:28:41651 bool use_msaa_;
hendrikwc2bbd612014-12-03 23:49:34652 GpuRasterizationStatus gpu_rasterization_status_;
vmiuraa30e1ea2014-12-09 19:23:51653 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
[email protected]eece11e2014-04-12 03:07:16654 scoped_ptr<ResourcePool> resource_pool_;
[email protected]2cccfef2014-05-01 06:05:16655 scoped_ptr<ResourcePool> staging_resource_pool_;
[email protected]fbe89f72013-05-21 07:24:24656 scoped_ptr<Renderer> renderer_;
[email protected]3b31c6ac2012-12-06 21:27:29657
[email protected]1bcced22013-09-24 13:51:19658 GlobalStateThatImpactsTilePriority global_tile_state_;
659
[email protected]c1bb5af2013-03-13 19:06:27660 // Tree currently being drawn.
661 scoped_ptr<LayerTreeImpl> active_tree_;
[email protected]3b31c6ac2012-12-06 21:27:29662
[email protected]c1bb5af2013-03-13 19:06:27663 // In impl-side painting mode, tree with possibly incomplete rasterized
[email protected]4f48f6e2013-08-27 06:33:38664 // content. May be promoted to active by ActivatePendingTree().
[email protected]c1bb5af2013-03-13 19:06:27665 scoped_ptr<LayerTreeImpl> pending_tree_;
[email protected]48871fc2013-01-23 07:36:51666
[email protected]c1bb5af2013-03-13 19:06:27667 // In impl-side painting mode, inert tree with layers that can be recycled
668 // by the next sync from the main thread.
669 scoped_ptr<LayerTreeImpl> recycle_tree_;
[email protected]48871fc2013-01-23 07:36:51670
[email protected]200a9c062013-05-20 04:34:37671 InputHandlerClient* input_handler_client_;
[email protected]c1bb5af2013-03-13 19:06:27672 bool did_lock_scrolling_layer_;
673 bool should_bubble_scrolls_;
674 bool wheel_scrolling_;
[email protected]f161ca9e2014-04-01 13:57:01675 bool scroll_affects_scroll_handler_;
[email protected]f620b0e72013-10-01 21:38:24676 int scroll_layer_id_when_mouse_over_scrollbar_;
[email protected]dab0a422014-08-13 16:09:46677 ScopedPtrVector<SwapPromise> swap_promises_for_main_thread_scroll_update_;
[email protected]a23451e2013-06-07 20:58:26678
ccameron4163cc352014-11-13 19:06:36679 // An object to implement the ScrollElasticityHelper interface and
680 // hold all state related to elasticity. May be NULL if never requested.
681 scoped_ptr<ScrollElasticityHelper> scroll_elasticity_helper_;
682
[email protected]c48536a52013-09-14 00:02:08683 bool tile_priorities_dirty_;
[email protected]a23451e2013-06-07 20:58:26684
[email protected]1960a712013-04-30 17:06:47685 // The optional delegate for the root layer scroll offset.
686 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_;
enne65dc6212015-04-29 21:44:23687 const LayerTreeSettings settings_;
[email protected]c1bb5af2013-03-13 19:06:27688 LayerTreeDebugState debug_state_;
[email protected]c1bb5af2013-03-13 19:06:27689 bool visible_;
[email protected]3f2ff112013-08-03 02:41:07690 ManagedMemoryPolicy cached_managed_memory_policy_;
[email protected]cd57cc5a2012-10-12 22:43:41691
[email protected]a2b5ded2013-05-20 21:32:53692 gfx::Vector2dF accumulated_root_overscroll_;
[email protected]6e921bd2013-04-29 21:10:20693
[email protected]c1bb5af2013-03-13 19:06:27694 bool pinch_gesture_active_;
[email protected]2fa342b82013-09-24 03:19:13695 bool pinch_gesture_end_should_clear_scrolling_layer_;
[email protected]c1bb5af2013-03-13 19:06:27696 gfx::Point previous_pinch_anchor_;
[email protected]cd57cc5a2012-10-12 22:43:41697
[email protected]c1bb5af2013-03-13 19:06:27698 scoped_ptr<TopControlsManager> top_controls_manager_;
[email protected]3ba4cae2013-01-16 03:58:38699
[email protected]c1bb5af2013-03-13 19:06:27700 scoped_ptr<PageScaleAnimation> page_scale_animation_;
[email protected]cd57cc5a2012-10-12 22:43:41701
[email protected]c1bb5af2013-03-13 19:06:27702 scoped_ptr<FrameRateCounter> fps_counter_;
703 scoped_ptr<PaintTimeCounter> paint_time_counter_;
704 scoped_ptr<MemoryHistory> memory_history_;
705 scoped_ptr<DebugRectHistory> debug_rect_history_;
[email protected]cd57cc5a2012-10-12 22:43:41706
[email protected]ea468c6c2013-09-10 08:25:11707 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
708
[email protected]d7626ffd2013-03-29 00:17:42709 // The maximum memory that would be used by the prioritized resource
710 // manager, if there were no limit on memory usage.
711 size_t max_memory_needed_bytes_;
712
[email protected]54af03522013-09-05 00:43:28713 // Viewport size passed in from the main thread, in physical pixels. This
714 // value is the default size for all concepts of physical viewport (draw
715 // viewport, scrolling viewport and device viewport), but it can be
716 // overridden.
[email protected]f224cc92013-06-06 23:23:32717 gfx::Size device_viewport_size_;
718
719 // Conversion factor from CSS pixels to physical pixels when
720 // pageScaleFactor=1.
721 float device_scale_factor_;
722
[email protected]54af03522013-09-05 00:43:28723 // Optional top-level constraints that can be set by the OutputSurface.
724 // - external_transform_ applies a transform above the root layer
725 // - external_viewport_ is used DrawProperties, tile management and
726 // glViewport/window projection matrix.
727 // - external_clip_ specifies a top-level clip rect
[email protected]bd5324592014-07-31 09:09:33728 // - viewport_rect_for_tile_priority_ is the rect in view space used for
729 // tiling priority.
[email protected]f224cc92013-06-06 23:23:32730 gfx::Transform external_transform_;
731 gfx::Rect external_viewport_;
[email protected]54af03522013-09-05 00:43:28732 gfx::Rect external_clip_;
[email protected]bd5324592014-07-31 09:09:33733 gfx::Rect viewport_rect_for_tile_priority_;
[email protected]c05dfbb2014-07-10 22:49:04734 bool resourceless_software_draw_;
[email protected]f224cc92013-06-06 23:23:32735
[email protected]878705be2013-04-15 22:44:02736 gfx::Rect viewport_damage_rect_;
[email protected]e0341352013-04-06 05:01:20737
ksakamotof1a56b752015-05-08 08:15:03738 BeginFrameArgs current_begin_frame_args_;
739
740 // Expected time between two begin impl frame calls.
741 base::TimeDelta begin_impl_frame_interval_;
742
[email protected]c1bb5af2013-03-13 19:06:27743 scoped_ptr<AnimationRegistrar> animation_registrar_;
sunnypsae4316a2015-02-25 00:54:58744 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_;
sunnyps7d073dc2015-04-16 23:29:12745 std::set<VideoFrameController*> video_frame_controllers_;
[email protected]de4afb5e2012-12-20 00:11:34746
[email protected]372bad5f2013-03-21 16:38:43747 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
[email protected]5e5648a2013-11-18 00:39:33748 MicroBenchmarkControllerImpl micro_benchmark_controller_;
enne69277cb2014-10-29 23:03:40749 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_;
[email protected]372bad5f2013-03-21 16:38:43750
[email protected]5f07afc2013-07-19 05:17:18751 // Optional callback to notify of new tree activations.
[email protected]2022c672013-07-23 19:55:26752 base::Closure tree_activation_callback_;
[email protected]5f07afc2013-07-19 05:17:18753
[email protected]a7f35682013-10-22 23:05:57754 SharedBitmapManager* shared_bitmap_manager_;
revemanf9a8a2342014-10-28 17:54:52755 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
reveman34b7a1522015-03-23 20:27:47756 TaskGraphRunner* task_graph_runner_;
[email protected]dbe759a2013-12-02 19:23:02757 int id_;
[email protected]a7f35682013-10-22 23:05:57758
[email protected]6be422b2013-12-08 06:47:31759 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
[email protected]8aa39ecb2014-06-12 14:19:14760
vmpstr61ed94a12014-10-09 04:49:30761 bool requires_high_res_to_draw_;
vmpstr4973f5b2015-02-02 19:27:29762 bool is_likely_to_require_a_draw_;
vmpstr61ed94a12014-10-09 04:49:30763
vmpstr99aa853c2015-02-03 20:31:22764 scoped_ptr<FrameTimingTracker> frame_timing_tracker_;
765
bokanaa2748312015-03-26 00:10:37766 scoped_ptr<Viewport> viewport_;
767
[email protected]c1bb5af2013-03-13 19:06:27768 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41769};
770
[email protected]0023e8b2012-10-15 12:52:45771} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41772
[email protected]556fd292013-03-18 08:03:04773#endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_