blob: 848cddf5e7d09ea1a58d538d4e1ef71a5a4aadd9 [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"
jamesr9b8fda32015-03-16 19:11:0534#include "cc/resources/ui_resource_client.h"
mithro0bdb49d2015-05-27 13:08:0135#include "cc/scheduler/begin_frame_tracker.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"
danakj920156852015-05-18 20:22:2939#include "cc/tiles/tile_manager.h"
jamesr9b8fda32015-03-16 19:11:0540#include "cc/trees/layer_tree_settings.h"
41#include "cc/trees/proxy.h"
[email protected]c9280762013-08-01 06:28:5742#include "skia/ext/refptr.h"
[email protected]ddf9df82012-10-16 06:52:4643#include "third_party/skia/include/core/SkColor.h"
heejin.r.chungd28506ba2014-10-23 16:36:2044#include "ui/gfx/geometry/rect.h"
[email protected]cd57cc5a2012-10-12 22:43:4145
loyso2c4002d2015-03-13 02:31:4346namespace gfx {
47class ScrollOffset;
48}
49
[email protected]cd57cc5a2012-10-12 22:43:4150namespace cc {
51
[email protected]96baf3e2012-10-22 23:09:5552class CompletionEvent;
[email protected]bf189f62012-12-18 03:42:1153class CompositorFrameMetadata;
[email protected]96baf3e2012-10-22 23:09:5554class DebugRectHistory;
[email protected]bf050582014-07-24 11:10:5855class EvictionTilePriorityQueue;
[email protected]96baf3e2012-10-22 23:09:5556class FrameRateCounter;
[email protected]96baf3e2012-10-22 23:09:5557class LayerImpl;
[email protected]8bef40572012-12-11 21:38:0858class LayerTreeImpl;
[email protected]ec7541d2014-04-09 01:23:5359class MemoryHistory;
[email protected]96baf3e2012-10-22 23:09:5560class PageScaleAnimation;
[email protected]0edbfbe9f2013-01-17 03:33:0361class PaintTimeCounter;
[email protected]8aa39ecb2014-06-12 14:19:1462class PictureLayerImpl;
[email protected]bf050582014-07-24 11:10:5863class RasterTilePriorityQueue;
vmiuraa30e1ea2014-12-09 19:23:5164class TileTaskWorkerPool;
[email protected]96baf3e2012-10-22 23:09:5565class RenderPassDrawQuad;
[email protected]ec7541d2014-04-09 01:23:5366class RenderingStatsInstrumentation;
[email protected]eece11e2014-04-12 03:07:1667class ResourcePool;
ccameron4163cc352014-11-13 19:06:3668class ScrollElasticityHelper;
[email protected]bf1cfd9a2013-09-26 05:43:0269class ScrollbarLayerImplBase;
jamesr9b8fda32015-03-16 19:11:0570class SwapPromise;
71class SwapPromiseMonitor;
[email protected]ea468c6c2013-09-10 08:25:1172class TextureMailboxDeleter;
[email protected]3ba4cae2013-01-16 03:58:3873class TopControlsManager;
[email protected]c9280762013-08-01 06:28:5774class UIResourceBitmap;
[email protected]741fba422013-09-20 03:34:1475class UIResourceRequest;
jamesr9b8fda32015-03-16 19:11:0576struct ScrollAndScaleSet;
bokanaa2748312015-03-26 00:10:3777class Viewport;
[email protected]cd57cc5a2012-10-12 22:43:4178
hendrikwc2bbd612014-12-03 23:49:3479enum class GpuRasterizationStatus {
80 ON,
81 ON_FORCED,
82 OFF_DEVICE,
83 OFF_VIEWPORT,
senorblancofb88a4e2015-05-08 17:28:4184 MSAA_CONTENT,
hendrikwc2bbd612014-12-03 23:49:3485 OFF_CONTENT
86};
87
[email protected]96baf3e2012-10-22 23:09:5588// LayerTreeHost->Proxy callback interface.
89class LayerTreeHostImplClient {
[email protected]c1bb5af2013-03-13 19:06:2790 public:
[email protected]fa339032014-02-18 22:11:5991 virtual void UpdateRendererCapabilitiesOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2792 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
[email protected]3dc0c772014-04-26 10:06:0593 virtual void CommitVSyncParameters(base::TimeTicks timebase,
94 base::TimeDelta interval) = 0;
95 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0;
[email protected]c14902662014-04-18 05:06:1196 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0;
[email protected]4d7e46a2013-11-08 05:33:4097 virtual void DidSwapBuffersOnImplThread() = 0;
[email protected]c14902662014-04-18 05:06:1198 virtual void DidSwapBuffersCompleteOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:2799 virtual void OnCanDrawStateChanged(bool can_draw) = 0;
[email protected]4f48f6e2013-08-27 06:33:38100 virtual void NotifyReadyToActivate() = 0;
ernstmdfac03e12014-11-11 20:18:05101 virtual void NotifyReadyToDraw() = 0;
[email protected]43b8f982014-04-30 21:24:33102 // Please call these 3 functions through
103 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
104 // SetNeedsAnimate().
[email protected]c1bb5af2013-03-13 19:06:27105 virtual void SetNeedsRedrawOnImplThread() = 0;
[email protected]0023fc72014-01-10 20:05:06106 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0;
[email protected]43b8f982014-04-30 21:24:33107 virtual void SetNeedsAnimateOnImplThread() = 0;
[email protected]c1bb5af2013-03-13 19:06:27108 virtual void SetNeedsCommitOnImplThread() = 0;
vmiura59ea9b4042014-12-09 20:50:39109 virtual void SetNeedsPrepareTilesOnImplThread() = 0;
sunnyps7d073dc2015-04-16 23:29:12110 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0;
[email protected]c1bb5af2013-03-13 19:06:27111 virtual void PostAnimationEventsToMainThreadOnImplThread(
[email protected]85b57502014-03-11 15:37:48112 scoped_ptr<AnimationEventsVector> events) = 0;
[email protected]c1bb5af2013-03-13 19:06:27113 virtual bool IsInsideDraw() = 0;
114 virtual void RenewTreePriority() = 0;
sunnypsae4316a2015-02-25 00:54:58115 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task,
116 base::TimeDelta delay) = 0;
[email protected]fc20d142014-07-01 00:49:15117 virtual void DidActivateSyncTree() = 0;
vmiura59ea9b4042014-12-09 20:50:39118 virtual void DidPrepareTiles() = 0;
[email protected]bf691c22013-03-26 21:15:06119
rouslanf7ebd8832015-01-22 01:54:14120 // Called when page scale animation has completed on the impl thread.
121 virtual void DidCompletePageScaleAnimationOnImplThread() = 0;
122
sunnypseab5ac92015-04-02 20:26:13123 // Called when output surface asks for a draw.
124 virtual void OnDrawForOutputSurface() = 0;
125
mpbed24c2c2015-06-05 20:57:13126 virtual void PostFrameTimingEventsOnImplThread(
127 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
128 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) = 0;
129
[email protected]bf691c22013-03-26 21:15:06130 protected:
131 virtual ~LayerTreeHostImplClient() {}
[email protected]cd57cc5a2012-10-12 22:43:41132};
133
[email protected]c1bb5af2013-03-13 19:06:27134// LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
135// state.
[email protected]200a9c062013-05-20 04:34:37136class CC_EXPORT LayerTreeHostImpl
137 : public InputHandler,
138 public RendererClient,
139 public TileManagerClient,
140 public OutputSurfaceClient,
141 public TopControlsManagerClient,
[email protected]930ff43b2014-05-02 05:24:00142 public ScrollbarAnimationControllerClient,
sunnyps7d073dc2015-04-16 23:29:12143 public VideoFrameControllerClient,
[email protected]200a9c062013-05-20 04:34:37144 public base::SupportsWeakPtr<LayerTreeHostImpl> {
[email protected]e216fef02013-03-20 22:56:10145 public:
[email protected]c1bb5af2013-03-13 19:06:27146 static scoped_ptr<LayerTreeHostImpl> Create(
147 const LayerTreeSettings& settings,
148 LayerTreeHostImplClient* client,
[email protected]372bad5f2013-03-21 16:38:43149 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57150 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05151 SharedBitmapManager* shared_bitmap_manager,
revemanf9a8a2342014-10-28 17:54:52152 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
reveman34b7a1522015-03-23 20:27:47153 TaskGraphRunner* task_graph_runner,
[email protected]dbe759a2013-12-02 19:23:02154 int id);
dcheng716bedf2014-10-21 09:51:08155 ~LayerTreeHostImpl() override;
[email protected]cd57cc5a2012-10-12 22:43:41156
[email protected]5ff3c9782013-04-29 17:35:12157 // InputHandler implementation
dcheng716bedf2014-10-21 09:51:08158 void BindToClient(InputHandlerClient* client) override;
159 InputHandler::ScrollStatus ScrollBegin(
[email protected]47a723f2014-03-05 12:42:49160 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37161 InputHandler::ScrollInputType type) override;
dcheng716bedf2014-10-21 09:51:08162 InputHandler::ScrollStatus ScrollAnimated(
[email protected]749cbc62014-07-10 01:06:35163 const gfx::Point& viewport_point,
mostynbf68776d82014-10-06 18:07:37164 const gfx::Vector2dF& scroll_delta) override;
ccameron36d091f2014-11-07 03:18:50165 InputHandlerScrollResult ScrollBy(
166 const gfx::Point& viewport_point,
167 const gfx::Vector2dF& scroll_delta) override;
dcheng716bedf2014-10-21 09:51:08168 bool ScrollVerticallyByPage(const gfx::Point& viewport_point,
169 ScrollDirection direction) override;
170 void SetRootLayerScrollOffsetDelegate(
mostynbf68776d82014-10-06 18:07:37171 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) override;
dcheng716bedf2014-10-21 09:51:08172 void OnRootLayerDelegatedScrollOffsetChanged() override;
173 void ScrollEnd() override;
174 InputHandler::ScrollStatus FlingScrollBegin() override;
175 void MouseMoveAt(const gfx::Point& viewport_point) override;
176 void PinchGestureBegin() override;
177 void PinchGestureUpdate(float magnify_delta,
178 const gfx::Point& anchor) override;
179 void PinchGestureEnd() override;
bokanfcdbc182014-11-21 21:53:33180 void StartPageScaleAnimation(const gfx::Vector2d& target_offset,
181 bool anchor_point,
182 float page_scale,
183 base::TimeDelta duration);
hushb0ee8dc2015-06-10 00:48:57184 void SetNeedsAnimateInput() override;
dcheng716bedf2014-10-21 09:51:08185 bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
186 InputHandler::ScrollInputType type) override;
ccameron3b607362015-02-02 22:46:29187 bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override;
rbyers18779d822015-02-05 06:22:06188 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override;
dcheng716bedf2014-10-21 09:51:08189 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor(
mostynbf68776d82014-10-06 18:07:37190 ui::LatencyInfo* latency) override;
ccameron4163cc352014-11-13 19:06:36191 ScrollElasticityHelper* CreateScrollElasticityHelper() override;
[email protected]cd57cc5a2012-10-12 22:43:41192
[email protected]c1bb5af2013-03-13 19:06:27193 // TopControlsManagerClient implementation.
aelias6004fe02015-02-07 21:43:01194 float TopControlsHeight() const override;
195 void SetCurrentTopControlsShownRatio(float offset) override;
196 float CurrentTopControlsShownRatio() const override;
dcheng716bedf2014-10-21 09:51:08197 void DidChangeTopControlsPosition() override;
198 bool HaveRootScrollLayer() const override;
[email protected]3ba4cae2013-01-16 03:58:38199
aelias6004fe02015-02-07 21:43:01200 void UpdateViewportContainerSizes();
201
[email protected]c1bb5af2013-03-13 19:06:27202 struct CC_EXPORT FrameData : public RenderPassSink {
203 FrameData();
dcheng716bedf2014-10-21 09:51:08204 ~FrameData() override;
ssid911e40e2015-02-09 17:55:20205 void AsValueInto(base::trace_event::TracedValue* value) const;
[email protected]cd57cc5a2012-10-12 22:43:41206
[email protected]c1bb5af2013-03-13 19:06:27207 std::vector<gfx::Rect> occluding_screen_space_rects;
208 std::vector<gfx::Rect> non_occluding_screen_space_rects;
vmpstr99aa853c2015-02-03 20:31:22209 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events;
[email protected]c1bb5af2013-03-13 19:06:27210 RenderPassList render_passes;
211 RenderPassIdHashMap render_passes_by_id;
[email protected]50761e92013-03-29 20:51:28212 const LayerImplList* render_surface_layer_list;
213 LayerImplList will_draw_layers;
[email protected]e0341352013-04-06 05:01:20214 bool has_no_damage;
[email protected]cd57cc5a2012-10-12 22:43:41215
[email protected]c1bb5af2013-03-13 19:06:27216 // RenderPassSink implementation.
dcheng716bedf2014-10-21 09:51:08217 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
[email protected]c1bb5af2013-03-13 19:06:27218 };
[email protected]cd57cc5a2012-10-12 22:43:41219
mithrof7a21502014-12-17 03:24:48220 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason);
[email protected]c1bb5af2013-03-13 19:06:27221 virtual void BeginCommit();
222 virtual void CommitComplete();
[email protected]27152642014-03-11 20:42:00223 virtual void Animate(base::TimeTicks monotonic_time);
[email protected]3d9f7432013-04-06 00:35:18224 virtual void UpdateAnimationState(bool start_ready_animations);
[email protected]b33348f2014-04-30 18:17:34225 void ActivateAnimations();
[email protected]200a9c062013-05-20 04:34:37226 void MainThreadHasStoppedFlinging();
[email protected]b8384e22013-12-03 02:20:48227 void DidAnimateScrollOffset();
[email protected]0023fc72014-01-10 20:05:06228 void SetViewportDamage(const gfx::Rect& damage_rect);
[email protected]cd57cc5a2012-10-12 22:43:41229
vmiura59ea9b4042014-12-09 20:50:39230 virtual void PrepareTiles();
[email protected]8947cbe2012-11-28 05:27:43231
[email protected]2aae96792014-05-15 23:10:50232 // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we
233 // should try to avoid displaying the frame. If PrepareToDraw is called,
234 // DidDrawAllLayers must also be called, regardless of whether DrawLayers is
235 // called between the two.
236 virtual DrawResult PrepareToDraw(FrameData* frame);
mithro248d1722015-05-05 05:23:45237 virtual void DrawLayers(FrameData* frame);
[email protected]c1bb5af2013-03-13 19:06:27238 // Must be called if and only if PrepareToDraw was called.
239 void DidDrawAllLayers(const FrameData& frame);
[email protected]cd57cc5a2012-10-12 22:43:41240
[email protected]c1bb5af2013-03-13 19:06:27241 const LayerTreeSettings& settings() const { return settings_; }
[email protected]cd57cc5a2012-10-12 22:43:41242
[email protected]0309ba5e02013-06-26 04:11:08243 // Evict all textures by enforcing a memory policy with an allocation of 0.
244 void EvictTexturesForTesting();
245
[email protected]4f48f6e2013-08-27 06:33:38246 // When blocking, this prevents client_->NotifyReadyToActivate() from being
247 // called. When disabled, it calls client_->NotifyReadyToActivate()
248 // immediately if any notifications had been blocked while blocking.
249 virtual void BlockNotifyReadyToActivateForTesting(bool block);
250
[email protected]34bff2122014-05-16 04:09:34251 // Resets all of the trees to an empty state.
252 void ResetTreesForTesting();
253
vmpstr380db092015-06-02 00:50:18254 size_t SourceAnimationFrameNumberForTesting() const;
255
[email protected]c05dfbb2014-07-10 22:49:04256 DrawMode GetDrawMode() const;
[email protected]54af03522013-09-05 00:43:28257
258 // Viewport size in draw space: this size is in physical pixels and is used
259 // for draw properties, tilings, quads and render passes.
260 gfx::Size DrawViewportSize() const;
261
[email protected]bd5324592014-07-31 09:09:33262 // Viewport rect in view space used for tiling prioritization.
263 const gfx::Rect ViewportRectForTilePriority() const;
264
[email protected]59fee302013-12-10 17:53:30265 // RendererClient implementation.
dcheng716bedf2014-10-21 09:51:08266 void SetFullRootLayerDamage() override;
[email protected]8947cbe2012-11-28 05:27:43267
[email protected]c1bb5af2013-03-13 19:06:27268 // TileManagerClient implementation.
dcheng716bedf2014-10-21 09:51:08269 void NotifyReadyToActivate() override;
ernstmdfac03e12014-11-11 20:18:05270 void NotifyReadyToDraw() override;
ericrk58049242015-06-22 20:32:15271 void NotifyAllTileTasksCompleted() override;
dcheng716bedf2014-10-21 09:51:08272 void NotifyTileStateChanged(const Tile* tile) override;
vmpstrb4040632015-01-23 17:53:41273 scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue(
274 TreePriority tree_priority,
275 RasterTilePriorityQueue::Type type) override;
vmpstr997b00e2015-01-23 21:03:07276 scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue(
277 TreePriority tree_priority) override;
vmpstr4973f5b2015-02-02 19:27:29278 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override;
[email protected]cd57cc5a2012-10-12 22:43:41279
[email protected]930ff43b2014-05-02 05:24:00280 // ScrollbarAnimationControllerClient implementation.
sunnypsae4316a2015-02-25 00:54:58281 void StartAnimatingScrollbarAnimationController(
282 ScrollbarAnimationController* controller) override;
283 void StopAnimatingScrollbarAnimationController(
284 ScrollbarAnimationController* controller) override;
285 void PostDelayedScrollbarAnimationTask(const base::Closure& task,
286 base::TimeDelta delay) override;
287 void SetNeedsRedrawForScrollbarAnimation() override;
[email protected]930ff43b2014-05-02 05:24:00288
sunnyps7d073dc2015-04-16 23:29:12289 // VideoBeginFrameSource implementation.
290 void AddVideoFrameController(VideoFrameController* controller) override;
291 void RemoveVideoFrameController(VideoFrameController* controller) override;
292
[email protected]c1bb5af2013-03-13 19:06:27293 // OutputSurfaceClient implementation.
dcheng716bedf2014-10-21 09:51:08294 void CommitVSyncParameters(base::TimeTicks timebase,
295 base::TimeDelta interval) override;
296 void SetNeedsRedrawRect(const gfx::Rect& rect) override;
dcheng716bedf2014-10-21 09:51:08297 void SetExternalDrawConstraints(
[email protected]54af03522013-09-05 00:43:28298 const gfx::Transform& transform,
[email protected]0023fc72014-01-10 20:05:06299 const gfx::Rect& viewport,
300 const gfx::Rect& clip,
[email protected]bd5324592014-07-31 09:09:33301 const gfx::Rect& viewport_rect_for_tile_priority,
302 const gfx::Transform& transform_for_tile_priority,
mostynbf68776d82014-10-06 18:07:37303 bool resourceless_software_draw) override;
dcheng716bedf2014-10-21 09:51:08304 void DidLoseOutputSurface() override;
305 void DidSwapBuffers() override;
306 void DidSwapBuffersComplete() override;
307 void ReclaimResources(const CompositorFrameAck* ack) override;
308 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
309 void SetTreeActivationCallback(const base::Closure& callback) override;
sunnypseab5ac92015-04-02 20:26:13310 void OnDraw() override;
[email protected]3b31c6ac2012-12-06 21:27:29311
[email protected]c1bb5af2013-03-13 19:06:27312 // Called from LayerTreeImpl.
313 void OnCanDrawStateChangedForTree();
[email protected]cd57cc5a2012-10-12 22:43:41314
[email protected]b5174d712013-08-28 08:10:43315 // Implementation.
[email protected]12a63da2014-06-13 06:06:22316 int id() const { return id_; }
[email protected]6133cc232013-07-30 18:47:07317 bool CanDraw() const;
[email protected]c1bb5af2013-03-13 19:06:27318 OutputSurface* output_surface() const { return output_surface_.get(); }
[email protected]cd57cc5a2012-10-12 22:43:41319
[email protected]c1bb5af2013-03-13 19:06:27320 std::string LayerTreeAsJson() const;
[email protected]cd57cc5a2012-10-12 22:43:41321
[email protected]c1bb5af2013-03-13 19:06:27322 void FinishAllRendering();
[email protected]cd57cc5a2012-10-12 22:43:41323
[email protected]c1bb5af2013-03-13 19:06:27324 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface);
[email protected]c1bb5af2013-03-13 19:06:27325 TileManager* tile_manager() { return tile_manager_.get(); }
senorblanco8d1b3ac2015-05-05 00:14:26326
senorblanco9c04acb2015-05-15 19:41:32327 void SetHasGpuRasterizationTrigger(bool flag) {
senorblanco8d1b3ac2015-05-05 00:14:26328 has_gpu_rasterization_trigger_ = flag;
senorblanco9c04acb2015-05-15 19:41:32329 UpdateGpuRasterizationStatus();
senorblanco8d1b3ac2015-05-05 00:14:26330 }
senorblanco9c04acb2015-05-15 19:41:32331 void SetContentIsSuitableForGpuRasterization(bool flag) {
senorblanco8d1b3ac2015-05-05 00:14:26332 content_is_suitable_for_gpu_rasterization_ = flag;
senorblanco9c04acb2015-05-15 19:41:32333 UpdateGpuRasterizationStatus();
senorblanco8d1b3ac2015-05-05 00:14:26334 }
vmiura4e7e199c2015-05-15 16:16:20335 bool CanUseGpuRasterization();
senorblanco9c04acb2015-05-15 19:41:32336 void UpdateTreeResourcesForGpuRasterizationIfNeeded();
[email protected]13525d62014-05-20 21:22:04337 bool use_gpu_rasterization() const { return use_gpu_rasterization_; }
senorblancofb88a4e2015-05-08 17:28:41338 bool use_msaa() const { return use_msaa_; }
hendrikwc2bbd612014-12-03 23:49:34339
340 GpuRasterizationStatus gpu_rasterization_status() const {
341 return gpu_rasterization_status_;
342 }
hendrikwc2bbd612014-12-03 23:49:34343
[email protected]473f1f22014-05-22 08:19:17344 bool create_low_res_tiling() const {
345 return settings_.create_low_res_tiling && !use_gpu_rasterization_;
346 }
[email protected]b7635e02014-04-28 07:08:43347 ResourcePool* resource_pool() { return resource_pool_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27348 Renderer* renderer() { return renderer_.get(); }
[email protected]7a8bcd262014-01-15 12:54:58349 const RendererCapabilitiesImpl& GetRendererCapabilities() const;
[email protected]cd57cc5a2012-10-12 22:43:41350
[email protected]e0341352013-04-06 05:01:20351 virtual bool SwapBuffers(const FrameData& frame);
[email protected]97e9ccd62014-04-12 01:07:15352 virtual void WillBeginImplFrame(const BeginFrameArgs& args);
mithro51693e382015-05-07 23:52:41353 virtual void DidFinishImplFrame();
[email protected]c48536a52013-09-14 00:02:08354 void DidModifyTilePriorities();
[email protected]cd57cc5a2012-10-12 22:43:41355
[email protected]c1bb5af2013-03-13 19:06:27356 LayerTreeImpl* active_tree() { return active_tree_.get(); }
357 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
358 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
359 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
[email protected]71618ed2014-07-24 02:23:45360 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); }
[email protected]c1bb5af2013-03-13 19:06:27361 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
[email protected]12a63da2014-06-13 06:06:22362 // Returns the tree LTH synchronizes with.
363 LayerTreeImpl* sync_tree() {
enneaf5bda32015-02-19 01:27:36364 // TODO(enne): This is bogus. It should return based on the value of
365 // Proxy::CommitToActiveTree and not whether the pending tree exists.
[email protected]fc20d142014-07-01 00:49:15366 return pending_tree_ ? pending_tree_.get() : active_tree_.get();
[email protected]12a63da2014-06-13 06:06:22367 }
[email protected]2f0d92f2013-06-11 04:07:20368 virtual void CreatePendingTree();
[email protected]fc20d142014-07-01 00:49:15369 virtual void ActivateSyncTree();
[email protected]cd57cc5a2012-10-12 22:43:41370
[email protected]c1bb5af2013-03-13 19:06:27371 // Shortcuts to layers on the active tree.
372 LayerImpl* RootLayer() const;
[email protected]adeda572014-01-31 00:49:47373 LayerImpl* InnerViewportScrollLayer() const;
374 LayerImpl* OuterViewportScrollLayer() const;
[email protected]c1bb5af2013-03-13 19:06:27375 LayerImpl* CurrentlyScrollingLayer() const;
[email protected]cd57cc5a2012-10-12 22:43:41376
[email protected]f161ca9e2014-04-01 13:57:01377 int scroll_layer_id_when_mouse_over_scrollbar() const {
[email protected]f620b0e72013-10-01 21:38:24378 return scroll_layer_id_when_mouse_over_scrollbar_;
379 }
[email protected]f161ca9e2014-04-01 13:57:01380 bool scroll_affects_scroll_handler() const {
381 return scroll_affects_scroll_handler_;
382 }
[email protected]dab0a422014-08-13 16:09:46383 void QueueSwapPromiseForMainThreadScrollUpdate(
384 scoped_ptr<SwapPromise> swap_promise);
[email protected]f620b0e72013-10-01 21:38:24385
jdduke16dde6e2014-10-24 00:22:56386 bool IsActivelyScrolling() const;
[email protected]251699b2013-10-09 00:21:26387
[email protected]c1bb5af2013-03-13 19:06:27388 virtual void SetVisible(bool visible);
389 bool visible() const { return visible_; }
[email protected]cd57cc5a2012-10-12 22:43:41390
mithro719bf6792014-11-10 15:36:47391 bool AnimationsAreVisible() { return visible() && CanDraw(); }
392
[email protected]d7eb8c72013-03-23 22:57:13393 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); }
hushb0ee8dc2015-06-10 00:48:57394 void SetNeedsAnimate();
[email protected]6be422b2013-12-08 06:47:31395 void SetNeedsRedraw();
[email protected]d7eb8c72013-03-23 22:57:13396
[email protected]206a3922013-05-17 06:34:12397 ManagedMemoryPolicy ActualManagedMemoryPolicy() const;
398
[email protected]3f2ff112013-08-03 02:41:07399 size_t memory_allocation_limit_bytes() const;
[email protected]990e050a2013-09-23 18:50:21400 int memory_allocation_priority_cutoff() const;
[email protected]cd57cc5a2012-10-12 22:43:41401
[email protected]64348ea2014-01-29 22:58:26402 void SetViewportSize(const gfx::Size& device_viewport_size);
[email protected]4a6c091d2014-04-24 21:06:46403 gfx::Size device_viewport_size() const { return device_viewport_size_; }
[email protected]cd57cc5a2012-10-12 22:43:41404
[email protected]c1bb5af2013-03-13 19:06:27405 void SetDeviceScaleFactor(float device_scale_factor);
406 float device_scale_factor() const { return device_scale_factor_; }
[email protected]cd57cc5a2012-10-12 22:43:41407
aelias58eec0812014-12-04 01:04:40408 void SetPageScaleOnActiveTree(float page_scale_factor);
409
[email protected]54af03522013-09-05 00:43:28410 const gfx::Transform& DrawTransform() const;
[email protected]f224cc92013-06-06 23:23:32411
[email protected]c1bb5af2013-03-13 19:06:27412 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas();
[email protected]cd57cc5a2012-10-12 22:43:41413
[email protected]d7626ffd2013-03-29 00:17:42414 void set_max_memory_needed_bytes(size_t bytes) {
415 max_memory_needed_bytes_ = bytes;
416 }
417
[email protected]c1bb5af2013-03-13 19:06:27418 FrameRateCounter* fps_counter() {
419 return fps_counter_.get();
420 }
421 PaintTimeCounter* paint_time_counter() {
422 return paint_time_counter_.get();
423 }
424 MemoryHistory* memory_history() {
425 return memory_history_.get();
426 }
427 DebugRectHistory* debug_rect_history() {
428 return debug_rect_history_.get();
429 }
430 ResourceProvider* resource_provider() {
431 return resource_provider_.get();
432 }
433 TopControlsManager* top_controls_manager() {
434 return top_controls_manager_.get();
435 }
[email protected]4bb0f312014-02-25 02:02:32436 const GlobalStateThatImpactsTilePriority& global_tile_state() {
437 return global_tile_state_;
438 }
[email protected]ff762fb2012-12-12 19:18:37439
[email protected]c1bb5af2013-03-13 19:06:27440 Proxy* proxy() const { return proxy_; }
[email protected]cd57cc5a2012-10-12 22:43:41441
[email protected]c1bb5af2013-03-13 19:06:27442 AnimationRegistrar* animation_registrar() const {
443 return animation_registrar_.get();
444 }
[email protected]de4afb5e2012-12-20 00:11:34445
[email protected]6e7fdeb2013-07-09 14:28:38446 void SetDebugState(const LayerTreeDebugState& new_debug_state);
[email protected]c1bb5af2013-03-13 19:06:27447 const LayerTreeDebugState& debug_state() const { return debug_state_; }
[email protected]f511afb2012-11-30 01:55:20448
[email protected]a2b5ded2013-05-20 21:32:53449 gfx::Vector2dF accumulated_root_overscroll() const {
450 return accumulated_root_overscroll_;
451 }
[email protected]a2b5ded2013-05-20 21:32:53452
[email protected]c1bb5af2013-03-13 19:06:27453 bool pinch_gesture_active() const { return pinch_gesture_active_; }
[email protected]166db5c82013-01-09 23:54:31454
[email protected]c1bb5af2013-03-13 19:06:27455 void SetTreePriority(TreePriority priority);
vmpstr56ace232014-10-09 20:16:28456 TreePriority GetTreePriority() const;
[email protected]362f1e8b2013-01-21 16:54:30457
mithro0bdb49d2015-05-27 13:08:01458 // TODO(mithro): Remove this methods which exposes the internal
459 // BeginFrameArgs to external callers.
[email protected]04c5900d2014-08-18 13:38:36460 virtual BeginFrameArgs CurrentBeginFrameArgs() const;
[email protected]829ad972013-01-28 23:36:10461
[email protected]c92195e2014-05-07 18:18:49462 // Expected time between two begin impl frame calls.
mithro0bdb49d2015-05-27 13:08:01463 base::TimeDelta CurrentBeginFrameInterval() const;
[email protected]c92195e2014-05-07 18:18:49464
[email protected]d12aa932014-08-01 13:10:38465 void AsValueWithFrameInto(FrameData* frame,
ssid911e40e2015-02-09 17:55:20466 base::trace_event::TracedValue* value) const;
ssid911e40e2015-02-09 17:55:20467 scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame(
[email protected]d12aa932014-08-01 13:10:38468 FrameData* frame) const;
ssid911e40e2015-02-09 17:55:20469 void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const;
[email protected]131a0c22013-02-12 18:31:08470
[email protected]c1bb5af2013-03-13 19:06:27471 bool page_scale_animation_active() const { return !!page_scale_animation_; }
[email protected]498ddd02013-02-28 23:59:25472
[email protected]741fba422013-09-20 03:34:14473 virtual void CreateUIResource(UIResourceId uid,
474 const UIResourceBitmap& bitmap);
[email protected]c9280762013-08-01 06:28:57475 // Deletes a UI resource. May safely be called more than once.
[email protected]741fba422013-09-20 03:34:14476 virtual void DeleteUIResource(UIResourceId uid);
[email protected]127bdc1a2013-09-11 01:44:48477 void EvictAllUIResources();
478 bool EvictedUIResourcesExist() const;
[email protected]c9280762013-08-01 06:28:57479
jbaumanbbd425e2015-05-19 00:33:35480 virtual ResourceId ResourceIdForUIResource(UIResourceId uid) const;
[email protected]c9280762013-08-01 06:28:57481
[email protected]709c9542013-10-26 01:43:51482 virtual bool IsUIResourceOpaque(UIResourceId uid) const;
483
[email protected]efbdb3a2013-10-04 00:35:13484 struct UIResourceData {
jbaumanbbd425e2015-05-19 00:33:35485 ResourceId resource_id;
[email protected]efbdb3a2013-10-04 00:35:13486 gfx::Size size;
[email protected]709c9542013-10-26 01:43:51487 bool opaque;
[email protected]efbdb3a2013-10-04 00:35:13488 };
489
[email protected]5e5648a2013-11-18 00:39:33490 void ScheduleMicroBenchmark(scoped_ptr<MicroBenchmarkImpl> benchmark);
491
[email protected]4a28a612013-11-27 02:06:33492 CompositorFrameMetadata MakeCompositorFrameMetadata() const;
[email protected]59fee302013-12-10 17:53:30493 // Viewport rectangle and clip in nonflipped window space. These rects
494 // should only be used by Renderer subclasses to populate glViewport/glClip
495 // and their software-mode equivalents.
496 gfx::Rect DeviceViewport() const;
497 gfx::Rect DeviceClip() const;
[email protected]4a28a612013-11-27 02:06:33498
[email protected]6be422b2013-12-08 06:47:31499 // When a SwapPromiseMonitor is created on the impl thread, it calls
500 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl.
501 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor()
502 // to unregister itself.
503 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor);
504 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor);
505
weiliangc8dac5a62015-04-02 06:12:35506 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for
507 // ReadyToDraw. crbug.com/469175
vmpstr61ed94a12014-10-09 04:49:30508 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; }
509 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; }
510 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; }
511
enne69277cb2014-10-29 23:03:40512 // Only valid for synchronous (non-scheduled) single-threaded case.
513 void SynchronouslyInitializeAllTiles();
514
vmiuraa30e1ea2014-12-09 19:23:51515 virtual void CreateResourceAndTileTaskWorkerPool(
516 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool,
enne03dbe8ae2014-10-30 01:32:55517 scoped_ptr<ResourcePool>* resource_pool,
518 scoped_ptr<ResourcePool>* staging_resource_pool);
519
vmpstr5377520a2014-12-29 23:26:13520 bool prepare_tiles_needed() const { return tile_priorities_dirty_; }
521
vmpstr99aa853c2015-02-03 20:31:22522 FrameTimingTracker* frame_timing_tracker() {
523 return frame_timing_tracker_.get();
524 }
525
bokanaa2748312015-03-26 00:10:37526 gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl,
527 const gfx::Vector2dF& delta,
528 const gfx::Point& viewport_point,
529 bool is_wheel_scroll);
530
vmpstrd704c872015-04-03 20:29:51531 // Record main frame timing information.
532 // |start_of_main_frame_args| is the BeginFrameArgs of the beginning of the
533 // main frame (ie the frame that kicked off the main frame).
534 // |expected_next_main_frame_args| is the BeginFrameArgs of the frame that
535 // follows the completion of the main frame (whether it is activation or some
536 // other completion, such as early out). Note that if there is a main frame
537 // scheduled in that frame, then this BeginFrameArgs will become the main
538 // frame args. However, if no such frame is scheduled, then this _would_ be
539 // the main frame args if it was scheduled.
540 void RecordMainFrameTiming(
541 const BeginFrameArgs& start_of_main_frame_args,
542 const BeginFrameArgs& expected_next_main_frame_args);
543
mpbed24c2c2015-06-05 20:57:13544 // Post the given frame timing events to the requester.
545 void PostFrameTimingEvents(
546 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
547 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events);
548
[email protected]c1bb5af2013-03-13 19:06:27549 protected:
[email protected]372bad5f2013-03-21 16:38:43550 LayerTreeHostImpl(
551 const LayerTreeSettings& settings,
552 LayerTreeHostImplClient* client,
553 Proxy* proxy,
[email protected]a7f35682013-10-22 23:05:57554 RenderingStatsInstrumentation* rendering_stats_instrumentation,
reveman22dd9292014-10-13 20:52:05555 SharedBitmapManager* shared_bitmap_manager,
revemanf9a8a2342014-10-28 17:54:52556 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
reveman34b7a1522015-03-23 20:27:47557 TaskGraphRunner* task_graph_runner,
[email protected]dbe759a2013-12-02 19:23:02558 int id);
[email protected]cd57cc5a2012-10-12 22:43:41559
[email protected]c1bb5af2013-03-13 19:06:27560 // Virtual for testing.
[email protected]27152642014-03-11 20:42:00561 virtual void AnimateLayers(base::TimeTicks monotonic_time);
[email protected]de4afb5e2012-12-20 00:11:34562
sunnypsc61ff5192015-03-18 01:41:25563 bool is_likely_to_require_a_draw() const {
564 return is_likely_to_require_a_draw_;
565 }
566
danakj112d3a102015-04-14 18:24:49567 // Removes empty or orphan RenderPasses from the frame.
568 static void RemoveRenderPasses(FrameData* frame);
569
[email protected]c1bb5af2013-03-13 19:06:27570 LayerTreeHostImplClient* client_;
571 Proxy* proxy_;
[email protected]cd57cc5a2012-10-12 22:43:41572
mithro0bdb49d2015-05-27 13:08:01573 BeginFrameTracker current_begin_frame_tracker_;
574
[email protected]c1bb5af2013-03-13 19:06:27575 private:
bokanaa2748312015-03-26 00:10:37576 gfx::Vector2dF ScrollLayerWithViewportSpaceDelta(
577 LayerImpl* layer_impl,
578 const gfx::PointF& viewport_point,
579 const gfx::Vector2dF& viewport_delta);
580
[email protected]ced667b2014-05-22 21:49:53581 void CreateAndSetRenderer();
582 void CreateAndSetTileManager();
583 void DestroyTileManager();
[email protected]50644642013-06-20 13:58:55584 void ReleaseTreeResources();
vmpstr9ce5c662015-02-05 23:29:26585 void RecreateTreeResources();
[email protected]2b154b22013-06-07 09:03:27586
senorblanco9c04acb2015-05-15 19:41:32587 void UpdateGpuRasterizationStatus();
588
enne03dbe8ae2014-10-30 01:32:55589 bool IsSynchronousSingleThreaded() const;
[email protected]ced667b2014-05-22 21:49:53590
bokanaa2748312015-03-26 00:10:37591 Viewport* viewport() { return viewport_.get(); }
592
bokan59379b092014-09-29 13:47:21593 // Scroll by preferring to move the outer viewport first, only moving the
594 // inner if the outer is at its scroll extents.
[email protected]adeda572014-01-31 00:49:47595 void ScrollViewportBy(gfx::Vector2dF scroll_delta);
bokan59379b092014-09-29 13:47:21596 // Scroll by preferring to move the inner viewport first, only moving the
597 // outer if the inner is at its scroll extents.
598 void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta);
sunnyps7d073dc2015-04-16 23:29:12599
hushb0ee8dc2015-06-10 00:48:57600 void AnimateInput(base::TimeTicks monotonic_time);
[email protected]c1bb5af2013-03-13 19:06:27601 void AnimatePageScale(base::TimeTicks monotonic_time);
602 void AnimateScrollbars(base::TimeTicks monotonic_time);
[email protected]ffb2720f2013-03-15 19:18:37603 void AnimateTopControls(base::TimeTicks monotonic_time);
[email protected]2d692992012-12-19 01:19:32604
[email protected]50761e92013-03-29 20:51:28605 void TrackDamageForAllSurfaces(
606 LayerImpl* root_draw_layer,
607 const LayerImplList& render_surface_layer_list);
[email protected]cd57cc5a2012-10-12 22:43:41608
[email protected]8be1a9bf2013-05-01 03:45:19609 void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy);
610
[email protected]7ddfe7e82014-01-30 07:22:11611 // This function should only be called from PrepareToDraw, as DidDrawAllLayers
612 // must be called if this helper function is called. Returns DRAW_SUCCESS if
613 // the frame should be drawn.
[email protected]30d82142014-05-12 04:26:02614 DrawResult CalculateRenderPasses(FrameData* frame);
[email protected]cd57cc5a2012-10-12 22:43:41615
[email protected]c1bb5af2013-03-13 19:06:27616 void ClearCurrentlyScrollingLayer();
[email protected]cd57cc5a2012-10-12 22:43:41617
[email protected]f620b0e72013-10-01 21:38:24618 bool HandleMouseOverScrollbar(LayerImpl* layer_impl,
[email protected]14bc5d682014-01-17 07:26:47619 const gfx::PointF& device_viewport_point);
[email protected]f620b0e72013-10-01 21:38:24620
[email protected]f620b0e72013-10-01 21:38:24621 LayerImpl* FindScrollLayerForDeviceViewportPoint(
[email protected]14bc5d682014-01-17 07:26:47622 const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02623 InputHandler::ScrollInputType type,
[email protected]f620b0e72013-10-01 21:38:24624 LayerImpl* layer_hit_by_point,
[email protected]f161ca9e2014-04-01 13:57:01625 bool* scroll_on_main_thread,
[email protected]edcc1a12014-05-06 01:26:39626 bool* optional_has_ancestor_scroll_handler) const;
[email protected]14bc5d682014-01-17 07:26:47627 float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point,
[email protected]bf1cfd9a2013-09-26 05:43:02628 LayerImpl* layer_impl);
[email protected]930ff43b2014-05-02 05:24:00629 void StartScrollbarFadeRecursive(LayerImpl* layer);
boliu247624d2015-04-11 02:04:25630 void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy);
[email protected]0fc818e2013-03-18 06:45:20631
[email protected]127bdc1a2013-09-11 01:44:48632 void MarkUIResourceNotEvicted(UIResourceId uid);
633
[email protected]6be422b2013-12-08 06:47:31634 void NotifySwapPromiseMonitorsOfSetNeedsRedraw();
[email protected]dab0a422014-08-13 16:09:46635 void NotifySwapPromiseMonitorsOfForwardingToMainThread();
[email protected]6be422b2013-12-08 06:47:31636
loyso2c4002d2015-03-13 02:31:43637 void ScrollAnimationCreate(LayerImpl* layer_impl,
638 const gfx::ScrollOffset& target_offset,
639 const gfx::ScrollOffset& current_offset);
640 bool ScrollAnimationUpdateTarget(LayerImpl* layer_impl,
641 const gfx::Vector2dF& scroll_delta);
642
[email protected]efbdb3a2013-10-04 00:35:13643 typedef base::hash_map<UIResourceId, UIResourceData>
[email protected]c9280762013-08-01 06:28:57644 UIResourceMap;
645 UIResourceMap ui_resource_map_;
646
[email protected]127bdc1a2013-09-11 01:44:48647 // Resources that were evicted by EvictAllUIResources. Resources are removed
648 // from this when they are touched by a create or destroy from the UI resource
649 // request queue.
650 std::set<UIResourceId> evicted_ui_resources_;
651
[email protected]c1bb5af2013-03-13 19:06:27652 scoped_ptr<OutputSurface> output_surface_;
[email protected]fbe89f72013-05-21 07:24:24653
[email protected]c1bb5af2013-03-13 19:06:27654 scoped_ptr<ResourceProvider> resource_provider_;
[email protected]c1bb5af2013-03-13 19:06:27655 scoped_ptr<TileManager> tile_manager_;
senorblanco8d1b3ac2015-05-05 00:14:26656 bool content_is_suitable_for_gpu_rasterization_;
657 bool has_gpu_rasterization_trigger_;
[email protected]13525d62014-05-20 21:22:04658 bool use_gpu_rasterization_;
senorblancofb88a4e2015-05-08 17:28:41659 bool use_msaa_;
hendrikwc2bbd612014-12-03 23:49:34660 GpuRasterizationStatus gpu_rasterization_status_;
senorblanco9c04acb2015-05-15 19:41:32661 bool tree_resources_for_gpu_rasterization_dirty_;
vmiuraa30e1ea2014-12-09 19:23:51662 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_;
[email protected]eece11e2014-04-12 03:07:16663 scoped_ptr<ResourcePool> resource_pool_;
[email protected]2cccfef2014-05-01 06:05:16664 scoped_ptr<ResourcePool> staging_resource_pool_;
[email protected]fbe89f72013-05-21 07:24:24665 scoped_ptr<Renderer> renderer_;
[email protected]3b31c6ac2012-12-06 21:27:29666
[email protected]1bcced22013-09-24 13:51:19667 GlobalStateThatImpactsTilePriority global_tile_state_;
668
[email protected]c1bb5af2013-03-13 19:06:27669 // Tree currently being drawn.
670 scoped_ptr<LayerTreeImpl> active_tree_;
[email protected]3b31c6ac2012-12-06 21:27:29671
[email protected]c1bb5af2013-03-13 19:06:27672 // In impl-side painting mode, tree with possibly incomplete rasterized
[email protected]4f48f6e2013-08-27 06:33:38673 // content. May be promoted to active by ActivatePendingTree().
[email protected]c1bb5af2013-03-13 19:06:27674 scoped_ptr<LayerTreeImpl> pending_tree_;
[email protected]48871fc2013-01-23 07:36:51675
[email protected]c1bb5af2013-03-13 19:06:27676 // In impl-side painting mode, inert tree with layers that can be recycled
677 // by the next sync from the main thread.
678 scoped_ptr<LayerTreeImpl> recycle_tree_;
[email protected]48871fc2013-01-23 07:36:51679
[email protected]200a9c062013-05-20 04:34:37680 InputHandlerClient* input_handler_client_;
[email protected]c1bb5af2013-03-13 19:06:27681 bool did_lock_scrolling_layer_;
682 bool should_bubble_scrolls_;
683 bool wheel_scrolling_;
[email protected]f161ca9e2014-04-01 13:57:01684 bool scroll_affects_scroll_handler_;
[email protected]f620b0e72013-10-01 21:38:24685 int scroll_layer_id_when_mouse_over_scrollbar_;
[email protected]dab0a422014-08-13 16:09:46686 ScopedPtrVector<SwapPromise> swap_promises_for_main_thread_scroll_update_;
[email protected]a23451e2013-06-07 20:58:26687
ccameron4163cc352014-11-13 19:06:36688 // An object to implement the ScrollElasticityHelper interface and
689 // hold all state related to elasticity. May be NULL if never requested.
690 scoped_ptr<ScrollElasticityHelper> scroll_elasticity_helper_;
691
[email protected]c48536a52013-09-14 00:02:08692 bool tile_priorities_dirty_;
[email protected]a23451e2013-06-07 20:58:26693
[email protected]1960a712013-04-30 17:06:47694 // The optional delegate for the root layer scroll offset.
695 LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_;
hushb0ee8dc2015-06-10 00:48:57696 LayerScrollOffsetDelegate::AnimationCallback root_layer_animation_callback_;
697
enne65dc6212015-04-29 21:44:23698 const LayerTreeSettings settings_;
[email protected]c1bb5af2013-03-13 19:06:27699 LayerTreeDebugState debug_state_;
[email protected]c1bb5af2013-03-13 19:06:27700 bool visible_;
[email protected]3f2ff112013-08-03 02:41:07701 ManagedMemoryPolicy cached_managed_memory_policy_;
[email protected]cd57cc5a2012-10-12 22:43:41702
[email protected]a2b5ded2013-05-20 21:32:53703 gfx::Vector2dF accumulated_root_overscroll_;
[email protected]6e921bd2013-04-29 21:10:20704
[email protected]c1bb5af2013-03-13 19:06:27705 bool pinch_gesture_active_;
[email protected]2fa342b82013-09-24 03:19:13706 bool pinch_gesture_end_should_clear_scrolling_layer_;
[email protected]c1bb5af2013-03-13 19:06:27707 gfx::Point previous_pinch_anchor_;
[email protected]cd57cc5a2012-10-12 22:43:41708
[email protected]c1bb5af2013-03-13 19:06:27709 scoped_ptr<TopControlsManager> top_controls_manager_;
[email protected]3ba4cae2013-01-16 03:58:38710
[email protected]c1bb5af2013-03-13 19:06:27711 scoped_ptr<PageScaleAnimation> page_scale_animation_;
[email protected]cd57cc5a2012-10-12 22:43:41712
[email protected]c1bb5af2013-03-13 19:06:27713 scoped_ptr<FrameRateCounter> fps_counter_;
714 scoped_ptr<PaintTimeCounter> paint_time_counter_;
715 scoped_ptr<MemoryHistory> memory_history_;
716 scoped_ptr<DebugRectHistory> debug_rect_history_;
[email protected]cd57cc5a2012-10-12 22:43:41717
[email protected]ea468c6c2013-09-10 08:25:11718 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_;
719
[email protected]d7626ffd2013-03-29 00:17:42720 // The maximum memory that would be used by the prioritized resource
721 // manager, if there were no limit on memory usage.
722 size_t max_memory_needed_bytes_;
723
[email protected]54af03522013-09-05 00:43:28724 // Viewport size passed in from the main thread, in physical pixels. This
725 // value is the default size for all concepts of physical viewport (draw
726 // viewport, scrolling viewport and device viewport), but it can be
727 // overridden.
[email protected]f224cc92013-06-06 23:23:32728 gfx::Size device_viewport_size_;
729
730 // Conversion factor from CSS pixels to physical pixels when
731 // pageScaleFactor=1.
732 float device_scale_factor_;
733
[email protected]54af03522013-09-05 00:43:28734 // Optional top-level constraints that can be set by the OutputSurface.
735 // - external_transform_ applies a transform above the root layer
736 // - external_viewport_ is used DrawProperties, tile management and
737 // glViewport/window projection matrix.
738 // - external_clip_ specifies a top-level clip rect
[email protected]bd5324592014-07-31 09:09:33739 // - viewport_rect_for_tile_priority_ is the rect in view space used for
740 // tiling priority.
[email protected]f224cc92013-06-06 23:23:32741 gfx::Transform external_transform_;
742 gfx::Rect external_viewport_;
[email protected]54af03522013-09-05 00:43:28743 gfx::Rect external_clip_;
[email protected]bd5324592014-07-31 09:09:33744 gfx::Rect viewport_rect_for_tile_priority_;
[email protected]c05dfbb2014-07-10 22:49:04745 bool resourceless_software_draw_;
[email protected]f224cc92013-06-06 23:23:32746
[email protected]878705be2013-04-15 22:44:02747 gfx::Rect viewport_damage_rect_;
[email protected]e0341352013-04-06 05:01:20748
[email protected]c1bb5af2013-03-13 19:06:27749 scoped_ptr<AnimationRegistrar> animation_registrar_;
sunnypsae4316a2015-02-25 00:54:58750 std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_;
sunnyps7d073dc2015-04-16 23:29:12751 std::set<VideoFrameController*> video_frame_controllers_;
[email protected]de4afb5e2012-12-20 00:11:34752
[email protected]372bad5f2013-03-21 16:38:43753 RenderingStatsInstrumentation* rendering_stats_instrumentation_;
[email protected]5e5648a2013-11-18 00:39:33754 MicroBenchmarkControllerImpl micro_benchmark_controller_;
enne69277cb2014-10-29 23:03:40755 scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_;
[email protected]372bad5f2013-03-21 16:38:43756
[email protected]5f07afc2013-07-19 05:17:18757 // Optional callback to notify of new tree activations.
[email protected]2022c672013-07-23 19:55:26758 base::Closure tree_activation_callback_;
[email protected]5f07afc2013-07-19 05:17:18759
[email protected]a7f35682013-10-22 23:05:57760 SharedBitmapManager* shared_bitmap_manager_;
revemanf9a8a2342014-10-28 17:54:52761 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
reveman34b7a1522015-03-23 20:27:47762 TaskGraphRunner* task_graph_runner_;
[email protected]dbe759a2013-12-02 19:23:02763 int id_;
[email protected]a7f35682013-10-22 23:05:57764
[email protected]6be422b2013-12-08 06:47:31765 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
[email protected]8aa39ecb2014-06-12 14:19:14766
vmpstr61ed94a12014-10-09 04:49:30767 bool requires_high_res_to_draw_;
vmpstr4973f5b2015-02-02 19:27:29768 bool is_likely_to_require_a_draw_;
vmpstr61ed94a12014-10-09 04:49:30769
vmpstr99aa853c2015-02-03 20:31:22770 scoped_ptr<FrameTimingTracker> frame_timing_tracker_;
771
bokanaa2748312015-03-26 00:10:37772 scoped_ptr<Viewport> viewport_;
773
[email protected]c1bb5af2013-03-13 19:06:27774 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
[email protected]cd57cc5a2012-10-12 22:43:41775};
776
[email protected]0023e8b2012-10-15 12:52:45777} // namespace cc
[email protected]cd57cc5a2012-10-12 22:43:41778
[email protected]556fd292013-03-18 08:03:04779#endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_