[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 1 | // Copyright 2011 The Chromium Authors. All rights reserved. |
[email protected] | 0fb2500 | 2012-10-12 07:20:02 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 4 | |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 5 | #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
| 6 | #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 7 | |
[email protected] | 127bdc1a | 2013-09-11 01:44:48 | [diff] [blame] | 8 | #include <set> |
[email protected] | bf691c2 | 2013-03-26 21:15:06 | [diff] [blame] | 9 | #include <string> |
| 10 | #include <vector> |
| 11 | |
[email protected] | c4040a52 | 2012-10-21 15:01:40 | [diff] [blame] | 12 | #include "base/basictypes.h" |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 13 | #include "base/containers/hash_tables.h" |
[email protected] | c4040a52 | 2012-10-21 15:01:40 | [diff] [blame] | 14 | #include "base/memory/scoped_ptr.h" |
[email protected] | 1b0df50 | 2013-06-27 23:39:58 | [diff] [blame] | 15 | #include "base/time/time.h" |
[email protected] | 95e4e1a0 | 2013-03-18 07:09:09 | [diff] [blame] | 16 | #include "cc/animation/animation_events.h" |
| 17 | #include "cc/animation/animation_registrar.h" |
[email protected] | 930ff43b | 2014-05-02 05:24:00 | [diff] [blame] | 18 | #include "cc/animation/scrollbar_animation_controller.h" |
[email protected] | 681ccff | 2013-03-18 06:13:52 | [diff] [blame] | 19 | #include "cc/base/cc_export.h" |
aelias | 58eec081 | 2014-12-04 01:04:40 | [diff] [blame] | 20 | #include "cc/base/synced_property.h" |
vmpstr | 99aa853c | 2015-02-03 20:31:22 | [diff] [blame] | 21 | #include "cc/debug/frame_timing_tracker.h" |
[email protected] | 5e5648a | 2013-11-18 00:39:33 | [diff] [blame] | 22 | #include "cc/debug/micro_benchmark_controller_impl.h" |
[email protected] | 3052b10f | 2013-03-18 07:41:21 | [diff] [blame] | 23 | #include "cc/input/input_handler.h" |
[email protected] | 1960a71 | 2013-04-30 17:06:47 | [diff] [blame] | 24 | #include "cc/input/layer_scroll_offset_delegate.h" |
[email protected] | 3052b10f | 2013-03-18 07:41:21 | [diff] [blame] | 25 | #include "cc/input/top_controls_manager_client.h" |
[email protected] | 50761e9 | 2013-03-29 20:51:28 | [diff] [blame] | 26 | #include "cc/layers/layer_lists.h" |
[email protected] | cc3cfaa | 2013-03-18 09:05:52 | [diff] [blame] | 27 | #include "cc/layers/render_pass_sink.h" |
[email protected] | df3c24c9 | 2013-06-19 03:54:35 | [diff] [blame] | 28 | #include "cc/output/begin_frame_args.h" |
[email protected] | fd32d12 | 2013-06-29 13:11:04 | [diff] [blame] | 29 | #include "cc/output/managed_memory_policy.h" |
[email protected] | 7f0d825f | 2013-03-18 07:24:30 | [diff] [blame] | 30 | #include "cc/output/output_surface_client.h" |
| 31 | #include "cc/output/renderer.h" |
[email protected] | 89e8267a | 2013-03-18 07:50:56 | [diff] [blame] | 32 | #include "cc/quads/render_pass.h" |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 33 | #include "cc/resources/resource_provider.h" |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 34 | #include "cc/resources/ui_resource_client.h" |
mithro | 0bdb49d | 2015-05-27 13:08:01 | [diff] [blame] | 35 | #include "cc/scheduler/begin_frame_tracker.h" |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 36 | #include "cc/scheduler/commit_earlyout_reason.h" |
[email protected] | 30d8214 | 2014-05-12 04:26:02 | [diff] [blame] | 37 | #include "cc/scheduler/draw_result.h" |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 38 | #include "cc/scheduler/video_frame_controller.h" |
danakj | 92015685 | 2015-05-18 20:22:29 | [diff] [blame] | 39 | #include "cc/tiles/tile_manager.h" |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 40 | #include "cc/trees/layer_tree_settings.h" |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 41 | #include "cc/trees/mutator_host_client.h" |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 42 | #include "cc/trees/proxy.h" |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 43 | #include "skia/ext/refptr.h" |
[email protected] | ddf9df8 | 2012-10-16 06:52:46 | [diff] [blame] | 44 | #include "third_party/skia/include/core/SkColor.h" |
heejin.r.chung | d28506ba | 2014-10-23 16:36:20 | [diff] [blame] | 45 | #include "ui/gfx/geometry/rect.h" |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 46 | |
loyso | 2c4002d | 2015-03-13 02:31:43 | [diff] [blame] | 47 | namespace gfx { |
| 48 | class ScrollOffset; |
| 49 | } |
| 50 | |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 51 | namespace cc { |
| 52 | |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 53 | class AnimationHost; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 54 | class CompletionEvent; |
[email protected] | bf189f6 | 2012-12-18 03:42:11 | [diff] [blame] | 55 | class CompositorFrameMetadata; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 56 | class DebugRectHistory; |
[email protected] | bf05058 | 2014-07-24 11:10:58 | [diff] [blame] | 57 | class EvictionTilePriorityQueue; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 58 | class FrameRateCounter; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 59 | class LayerImpl; |
[email protected] | 8bef4057 | 2012-12-11 21:38:08 | [diff] [blame] | 60 | class LayerTreeImpl; |
[email protected] | ec7541d | 2014-04-09 01:23:53 | [diff] [blame] | 61 | class MemoryHistory; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 62 | class PageScaleAnimation; |
[email protected] | 0edbfbe9f | 2013-01-17 03:33:03 | [diff] [blame] | 63 | class PaintTimeCounter; |
[email protected] | 8aa39ecb | 2014-06-12 14:19:14 | [diff] [blame] | 64 | class PictureLayerImpl; |
[email protected] | bf05058 | 2014-07-24 11:10:58 | [diff] [blame] | 65 | class RasterTilePriorityQueue; |
vmiura | a30e1ea | 2014-12-09 19:23:51 | [diff] [blame] | 66 | class TileTaskWorkerPool; |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 67 | class RenderPassDrawQuad; |
[email protected] | ec7541d | 2014-04-09 01:23:53 | [diff] [blame] | 68 | class RenderingStatsInstrumentation; |
[email protected] | eece11e | 2014-04-12 03:07:16 | [diff] [blame] | 69 | class ResourcePool; |
ccameron | 4163cc35 | 2014-11-13 19:06:36 | [diff] [blame] | 70 | class ScrollElasticityHelper; |
[email protected] | bf1cfd9a | 2013-09-26 05:43:02 | [diff] [blame] | 71 | class ScrollbarLayerImplBase; |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 72 | class SwapPromise; |
| 73 | class SwapPromiseMonitor; |
[email protected] | ea468c6c | 2013-09-10 08:25:11 | [diff] [blame] | 74 | class TextureMailboxDeleter; |
[email protected] | 3ba4cae | 2013-01-16 03:58:38 | [diff] [blame] | 75 | class TopControlsManager; |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 76 | class UIResourceBitmap; |
[email protected] | 741fba42 | 2013-09-20 03:34:14 | [diff] [blame] | 77 | class UIResourceRequest; |
jamesr | 9b8fda3 | 2015-03-16 19:11:05 | [diff] [blame] | 78 | struct ScrollAndScaleSet; |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 79 | class Viewport; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 80 | |
hendrikw | c2bbd61 | 2014-12-03 23:49:34 | [diff] [blame] | 81 | enum class GpuRasterizationStatus { |
| 82 | ON, |
| 83 | ON_FORCED, |
| 84 | OFF_DEVICE, |
| 85 | OFF_VIEWPORT, |
senorblanco | fb88a4e | 2015-05-08 17:28:41 | [diff] [blame] | 86 | MSAA_CONTENT, |
hendrikw | c2bbd61 | 2014-12-03 23:49:34 | [diff] [blame] | 87 | OFF_CONTENT |
| 88 | }; |
| 89 | |
[email protected] | 96baf3e | 2012-10-22 23:09:55 | [diff] [blame] | 90 | // LayerTreeHost->Proxy callback interface. |
| 91 | class LayerTreeHostImplClient { |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 92 | public: |
[email protected] | fa33903 | 2014-02-18 22:11:59 | [diff] [blame] | 93 | virtual void UpdateRendererCapabilitiesOnImplThread() = 0; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 94 | virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
[email protected] | 3dc0c77 | 2014-04-26 10:06:05 | [diff] [blame] | 95 | virtual void CommitVSyncParameters(base::TimeTicks timebase, |
| 96 | base::TimeDelta interval) = 0; |
| 97 | virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; |
[email protected] | c1490266 | 2014-04-18 05:06:11 | [diff] [blame] | 98 | virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; |
[email protected] | 4d7e46a | 2013-11-08 05:33:40 | [diff] [blame] | 99 | virtual void DidSwapBuffersOnImplThread() = 0; |
[email protected] | c1490266 | 2014-04-18 05:06:11 | [diff] [blame] | 100 | virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 101 | virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
[email protected] | 4f48f6e | 2013-08-27 06:33:38 | [diff] [blame] | 102 | virtual void NotifyReadyToActivate() = 0; |
ernstm | dfac03e1 | 2014-11-11 20:18:05 | [diff] [blame] | 103 | virtual void NotifyReadyToDraw() = 0; |
[email protected] | 43b8f98 | 2014-04-30 21:24:33 | [diff] [blame] | 104 | // Please call these 3 functions through |
| 105 | // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
| 106 | // SetNeedsAnimate(). |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 107 | virtual void SetNeedsRedrawOnImplThread() = 0; |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 108 | virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
[email protected] | 43b8f98 | 2014-04-30 21:24:33 | [diff] [blame] | 109 | virtual void SetNeedsAnimateOnImplThread() = 0; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 110 | virtual void SetNeedsCommitOnImplThread() = 0; |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 111 | virtual void SetNeedsPrepareTilesOnImplThread() = 0; |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 112 | virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 113 | virtual void PostAnimationEventsToMainThreadOnImplThread( |
[email protected] | 85b5750 | 2014-03-11 15:37:48 | [diff] [blame] | 114 | scoped_ptr<AnimationEventsVector> events) = 0; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 115 | virtual bool IsInsideDraw() = 0; |
| 116 | virtual void RenewTreePriority() = 0; |
sunnyps | ae4316a | 2015-02-25 00:54:58 | [diff] [blame] | 117 | virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
| 118 | base::TimeDelta delay) = 0; |
[email protected] | fc20d14 | 2014-07-01 00:49:15 | [diff] [blame] | 119 | virtual void DidActivateSyncTree() = 0; |
brianderson | 6874981 | 2015-07-07 22:39:39 | [diff] [blame] | 120 | virtual void WillPrepareTiles() = 0; |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 121 | virtual void DidPrepareTiles() = 0; |
[email protected] | bf691c2 | 2013-03-26 21:15:06 | [diff] [blame] | 122 | |
rouslan | f7ebd883 | 2015-01-22 01:54:14 | [diff] [blame] | 123 | // Called when page scale animation has completed on the impl thread. |
| 124 | virtual void DidCompletePageScaleAnimationOnImplThread() = 0; |
| 125 | |
sunnyps | eab5ac9 | 2015-04-02 20:26:13 | [diff] [blame] | 126 | // Called when output surface asks for a draw. |
| 127 | virtual void OnDrawForOutputSurface() = 0; |
| 128 | |
mpb | ed24c2c | 2015-06-05 20:57:13 | [diff] [blame] | 129 | virtual void PostFrameTimingEventsOnImplThread( |
| 130 | scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 131 | scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) = 0; |
| 132 | |
[email protected] | bf691c2 | 2013-03-26 21:15:06 | [diff] [blame] | 133 | protected: |
| 134 | virtual ~LayerTreeHostImplClient() {} |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 135 | }; |
| 136 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 137 | // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
| 138 | // state. |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 139 | class CC_EXPORT LayerTreeHostImpl |
| 140 | : public InputHandler, |
| 141 | public RendererClient, |
| 142 | public TileManagerClient, |
| 143 | public OutputSurfaceClient, |
| 144 | public TopControlsManagerClient, |
[email protected] | 930ff43b | 2014-05-02 05:24:00 | [diff] [blame] | 145 | public ScrollbarAnimationControllerClient, |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 146 | public VideoFrameControllerClient, |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 147 | public MutatorHostClient, |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 148 | public base::SupportsWeakPtr<LayerTreeHostImpl> { |
[email protected] | e216fef0 | 2013-03-20 22:56:10 | [diff] [blame] | 149 | public: |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 150 | static scoped_ptr<LayerTreeHostImpl> Create( |
| 151 | const LayerTreeSettings& settings, |
| 152 | LayerTreeHostImplClient* client, |
[email protected] | 372bad5f | 2013-03-21 16:38:43 | [diff] [blame] | 153 | Proxy* proxy, |
[email protected] | a7f3568 | 2013-10-22 23:05:57 | [diff] [blame] | 154 | RenderingStatsInstrumentation* rendering_stats_instrumentation, |
reveman | 22dd929 | 2014-10-13 20:52:05 | [diff] [blame] | 155 | SharedBitmapManager* shared_bitmap_manager, |
reveman | f9a8a234 | 2014-10-28 17:54:52 | [diff] [blame] | 156 | gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 157 | TaskGraphRunner* task_graph_runner, |
[email protected] | dbe759a | 2013-12-02 19:23:02 | [diff] [blame] | 158 | int id); |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 159 | ~LayerTreeHostImpl() override; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 160 | |
[email protected] | 5ff3c978 | 2013-04-29 17:35:12 | [diff] [blame] | 161 | // InputHandler implementation |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 162 | void BindToClient(InputHandlerClient* client) override; |
| 163 | InputHandler::ScrollStatus ScrollBegin( |
[email protected] | 47a723f | 2014-03-05 12:42:49 | [diff] [blame] | 164 | const gfx::Point& viewport_point, |
mostynb | f68776d8 | 2014-10-06 18:07:37 | [diff] [blame] | 165 | InputHandler::ScrollInputType type) override; |
hush | 1c87323 | 2015-06-23 21:22:11 | [diff] [blame] | 166 | InputHandler::ScrollStatus RootScrollBegin( |
| 167 | InputHandler::ScrollInputType type) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 168 | InputHandler::ScrollStatus ScrollAnimated( |
[email protected] | 749cbc6 | 2014-07-10 01:06:35 | [diff] [blame] | 169 | const gfx::Point& viewport_point, |
mostynb | f68776d8 | 2014-10-06 18:07:37 | [diff] [blame] | 170 | const gfx::Vector2dF& scroll_delta) override; |
ccameron | 36d091f | 2014-11-07 03:18:50 | [diff] [blame] | 171 | InputHandlerScrollResult ScrollBy( |
| 172 | const gfx::Point& viewport_point, |
| 173 | const gfx::Vector2dF& scroll_delta) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 174 | bool ScrollVerticallyByPage(const gfx::Point& viewport_point, |
| 175 | ScrollDirection direction) override; |
| 176 | void SetRootLayerScrollOffsetDelegate( |
mostynb | f68776d8 | 2014-10-06 18:07:37 | [diff] [blame] | 177 | LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 178 | void OnRootLayerDelegatedScrollOffsetChanged() override; |
| 179 | void ScrollEnd() override; |
| 180 | InputHandler::ScrollStatus FlingScrollBegin() override; |
| 181 | void MouseMoveAt(const gfx::Point& viewport_point) override; |
| 182 | void PinchGestureBegin() override; |
| 183 | void PinchGestureUpdate(float magnify_delta, |
| 184 | const gfx::Point& anchor) override; |
| 185 | void PinchGestureEnd() override; |
bokan | fcdbc18 | 2014-11-21 21:53:33 | [diff] [blame] | 186 | void StartPageScaleAnimation(const gfx::Vector2d& target_offset, |
| 187 | bool anchor_point, |
| 188 | float page_scale, |
| 189 | base::TimeDelta duration); |
hush | b0ee8dc | 2015-06-10 00:48:57 | [diff] [blame] | 190 | void SetNeedsAnimateInput() override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 191 | bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point, |
| 192 | InputHandler::ScrollInputType type) override; |
ccameron | 3b60736 | 2015-02-02 22:46:29 | [diff] [blame] | 193 | bool HaveWheelEventHandlersAt(const gfx::Point& viewport_point) override; |
rbyers | 18779d82 | 2015-02-05 06:22:06 | [diff] [blame] | 194 | bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 195 | scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
mostynb | f68776d8 | 2014-10-06 18:07:37 | [diff] [blame] | 196 | ui::LatencyInfo* latency) override; |
ccameron | 4163cc35 | 2014-11-13 19:06:36 | [diff] [blame] | 197 | ScrollElasticityHelper* CreateScrollElasticityHelper() override; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 198 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 199 | // TopControlsManagerClient implementation. |
aelias | 6004fe0 | 2015-02-07 21:43:01 | [diff] [blame] | 200 | float TopControlsHeight() const override; |
| 201 | void SetCurrentTopControlsShownRatio(float offset) override; |
| 202 | float CurrentTopControlsShownRatio() const override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 203 | void DidChangeTopControlsPosition() override; |
| 204 | bool HaveRootScrollLayer() const override; |
[email protected] | 3ba4cae | 2013-01-16 03:58:38 | [diff] [blame] | 205 | |
aelias | 6004fe0 | 2015-02-07 21:43:01 | [diff] [blame] | 206 | void UpdateViewportContainerSizes(); |
| 207 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 208 | struct CC_EXPORT FrameData : public RenderPassSink { |
| 209 | FrameData(); |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 210 | ~FrameData() override; |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 211 | void AsValueInto(base::trace_event::TracedValue* value) const; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 212 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 213 | std::vector<gfx::Rect> occluding_screen_space_rects; |
| 214 | std::vector<gfx::Rect> non_occluding_screen_space_rects; |
vmpstr | 99aa853c | 2015-02-03 20:31:22 | [diff] [blame] | 215 | std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 216 | RenderPassList render_passes; |
| 217 | RenderPassIdHashMap render_passes_by_id; |
[email protected] | 50761e9 | 2013-03-29 20:51:28 | [diff] [blame] | 218 | const LayerImplList* render_surface_layer_list; |
| 219 | LayerImplList will_draw_layers; |
[email protected] | e034135 | 2013-04-06 05:01:20 | [diff] [blame] | 220 | bool has_no_damage; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 221 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 222 | // RenderPassSink implementation. |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 223 | void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 224 | }; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 225 | |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 226 | virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 227 | virtual void BeginCommit(); |
| 228 | virtual void CommitComplete(); |
[email protected] | 2715264 | 2014-03-11 20:42:00 | [diff] [blame] | 229 | virtual void Animate(base::TimeTicks monotonic_time); |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 230 | virtual void UpdateAnimationState(bool start_ready_animations); |
[email protected] | b33348f | 2014-04-30 18:17:34 | [diff] [blame] | 231 | void ActivateAnimations(); |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 232 | void MainThreadHasStoppedFlinging(); |
[email protected] | b8384e2 | 2013-12-03 02:20:48 | [diff] [blame] | 233 | void DidAnimateScrollOffset(); |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 234 | void SetViewportDamage(const gfx::Rect& damage_rect); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 235 | |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 236 | void SetTreeLayerFilterMutated(int layer_id, |
| 237 | LayerTreeImpl* tree, |
| 238 | const FilterOperations& filters); |
| 239 | void SetTreeLayerOpacityMutated(int layer_id, |
| 240 | LayerTreeImpl* tree, |
| 241 | float opacity); |
| 242 | void SetTreeLayerTransformMutated(int layer_id, |
| 243 | LayerTreeImpl* tree, |
| 244 | const gfx::Transform& transform); |
| 245 | void SetTreeLayerScrollOffsetMutated(int layer_id, |
| 246 | LayerTreeImpl* tree, |
| 247 | const gfx::ScrollOffset& scroll_offset); |
| 248 | |
| 249 | // LayerTreeMutatorsClient implementation. |
| 250 | bool IsLayerInTree(int layer_id, LayerTreeType tree_type) const override; |
| 251 | void SetMutatorsNeedCommit() override; |
| 252 | void SetLayerFilterMutated(int layer_id, |
| 253 | LayerTreeType tree_type, |
| 254 | const FilterOperations& filters) override; |
| 255 | void SetLayerOpacityMutated(int layer_id, |
| 256 | LayerTreeType tree_type, |
| 257 | float opacity) override; |
| 258 | void SetLayerTransformMutated(int layer_id, |
| 259 | LayerTreeType tree_type, |
| 260 | const gfx::Transform& transform) override; |
| 261 | void SetLayerScrollOffsetMutated( |
| 262 | int layer_id, |
| 263 | LayerTreeType tree_type, |
| 264 | const gfx::ScrollOffset& scroll_offset) override; |
loyso | ce3bb82 | 2015-07-08 02:40:47 | [diff] [blame^] | 265 | void ScrollOffsetAnimationFinished() override; |
| 266 | gfx::ScrollOffset GetScrollOffsetForAnimation(int layer_id) const override; |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 267 | |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 268 | virtual void PrepareTiles(); |
[email protected] | 8947cbe | 2012-11-28 05:27:43 | [diff] [blame] | 269 | |
[email protected] | 2aae9679 | 2014-05-15 23:10:50 | [diff] [blame] | 270 | // Returns DRAW_SUCCESS unless problems occured preparing the frame, and we |
| 271 | // should try to avoid displaying the frame. If PrepareToDraw is called, |
| 272 | // DidDrawAllLayers must also be called, regardless of whether DrawLayers is |
| 273 | // called between the two. |
| 274 | virtual DrawResult PrepareToDraw(FrameData* frame); |
mithro | 248d172 | 2015-05-05 05:23:45 | [diff] [blame] | 275 | virtual void DrawLayers(FrameData* frame); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 276 | // Must be called if and only if PrepareToDraw was called. |
| 277 | void DidDrawAllLayers(const FrameData& frame); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 278 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 279 | const LayerTreeSettings& settings() const { return settings_; } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 280 | |
[email protected] | 0309ba5e0 | 2013-06-26 04:11:08 | [diff] [blame] | 281 | // Evict all textures by enforcing a memory policy with an allocation of 0. |
| 282 | void EvictTexturesForTesting(); |
| 283 | |
[email protected] | 4f48f6e | 2013-08-27 06:33:38 | [diff] [blame] | 284 | // When blocking, this prevents client_->NotifyReadyToActivate() from being |
| 285 | // called. When disabled, it calls client_->NotifyReadyToActivate() |
| 286 | // immediately if any notifications had been blocked while blocking. |
| 287 | virtual void BlockNotifyReadyToActivateForTesting(bool block); |
| 288 | |
[email protected] | 34bff212 | 2014-05-16 04:09:34 | [diff] [blame] | 289 | // Resets all of the trees to an empty state. |
| 290 | void ResetTreesForTesting(); |
| 291 | |
vmpstr | 380db09 | 2015-06-02 00:50:18 | [diff] [blame] | 292 | size_t SourceAnimationFrameNumberForTesting() const; |
| 293 | |
[email protected] | c05dfbb | 2014-07-10 22:49:04 | [diff] [blame] | 294 | DrawMode GetDrawMode() const; |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 295 | |
| 296 | // Viewport size in draw space: this size is in physical pixels and is used |
| 297 | // for draw properties, tilings, quads and render passes. |
| 298 | gfx::Size DrawViewportSize() const; |
| 299 | |
[email protected] | bd532459 | 2014-07-31 09:09:33 | [diff] [blame] | 300 | // Viewport rect in view space used for tiling prioritization. |
| 301 | const gfx::Rect ViewportRectForTilePriority() const; |
| 302 | |
[email protected] | 59fee30 | 2013-12-10 17:53:30 | [diff] [blame] | 303 | // RendererClient implementation. |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 304 | void SetFullRootLayerDamage() override; |
[email protected] | 8947cbe | 2012-11-28 05:27:43 | [diff] [blame] | 305 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 306 | // TileManagerClient implementation. |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 307 | void NotifyReadyToActivate() override; |
ernstm | dfac03e1 | 2014-11-11 20:18:05 | [diff] [blame] | 308 | void NotifyReadyToDraw() override; |
ericrk | 5804924 | 2015-06-22 20:32:15 | [diff] [blame] | 309 | void NotifyAllTileTasksCompleted() override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 310 | void NotifyTileStateChanged(const Tile* tile) override; |
vmpstr | b404063 | 2015-01-23 17:53:41 | [diff] [blame] | 311 | scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( |
| 312 | TreePriority tree_priority, |
| 313 | RasterTilePriorityQueue::Type type) override; |
vmpstr | 997b00e | 2015-01-23 21:03:07 | [diff] [blame] | 314 | scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( |
| 315 | TreePriority tree_priority) override; |
vmpstr | 4973f5b | 2015-02-02 19:27:29 | [diff] [blame] | 316 | void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 317 | |
[email protected] | 930ff43b | 2014-05-02 05:24:00 | [diff] [blame] | 318 | // ScrollbarAnimationControllerClient implementation. |
sunnyps | ae4316a | 2015-02-25 00:54:58 | [diff] [blame] | 319 | void StartAnimatingScrollbarAnimationController( |
| 320 | ScrollbarAnimationController* controller) override; |
| 321 | void StopAnimatingScrollbarAnimationController( |
| 322 | ScrollbarAnimationController* controller) override; |
| 323 | void PostDelayedScrollbarAnimationTask(const base::Closure& task, |
| 324 | base::TimeDelta delay) override; |
| 325 | void SetNeedsRedrawForScrollbarAnimation() override; |
[email protected] | 930ff43b | 2014-05-02 05:24:00 | [diff] [blame] | 326 | |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 327 | // VideoBeginFrameSource implementation. |
| 328 | void AddVideoFrameController(VideoFrameController* controller) override; |
| 329 | void RemoveVideoFrameController(VideoFrameController* controller) override; |
| 330 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 331 | // OutputSurfaceClient implementation. |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 332 | void CommitVSyncParameters(base::TimeTicks timebase, |
| 333 | base::TimeDelta interval) override; |
| 334 | void SetNeedsRedrawRect(const gfx::Rect& rect) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 335 | void SetExternalDrawConstraints( |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 336 | const gfx::Transform& transform, |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 337 | const gfx::Rect& viewport, |
| 338 | const gfx::Rect& clip, |
[email protected] | bd532459 | 2014-07-31 09:09:33 | [diff] [blame] | 339 | const gfx::Rect& viewport_rect_for_tile_priority, |
| 340 | const gfx::Transform& transform_for_tile_priority, |
mostynb | f68776d8 | 2014-10-06 18:07:37 | [diff] [blame] | 341 | bool resourceless_software_draw) override; |
dcheng | 716bedf | 2014-10-21 09:51:08 | [diff] [blame] | 342 | void DidLoseOutputSurface() override; |
| 343 | void DidSwapBuffers() override; |
| 344 | void DidSwapBuffersComplete() override; |
| 345 | void ReclaimResources(const CompositorFrameAck* ack) override; |
| 346 | void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; |
| 347 | void SetTreeActivationCallback(const base::Closure& callback) override; |
sunnyps | eab5ac9 | 2015-04-02 20:26:13 | [diff] [blame] | 348 | void OnDraw() override; |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 349 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 350 | // Called from LayerTreeImpl. |
| 351 | void OnCanDrawStateChangedForTree(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 352 | |
[email protected] | b5174d71 | 2013-08-28 08:10:43 | [diff] [blame] | 353 | // Implementation. |
[email protected] | 12a63da | 2014-06-13 06:06:22 | [diff] [blame] | 354 | int id() const { return id_; } |
[email protected] | 6133cc23 | 2013-07-30 18:47:07 | [diff] [blame] | 355 | bool CanDraw() const; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 356 | OutputSurface* output_surface() const { return output_surface_.get(); } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 357 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 358 | std::string LayerTreeAsJson() const; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 359 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 360 | void FinishAllRendering(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 361 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 362 | virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 363 | TileManager* tile_manager() { return tile_manager_.get(); } |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 364 | |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 365 | void SetHasGpuRasterizationTrigger(bool flag) { |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 366 | has_gpu_rasterization_trigger_ = flag; |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 367 | UpdateGpuRasterizationStatus(); |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 368 | } |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 369 | void SetContentIsSuitableForGpuRasterization(bool flag) { |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 370 | content_is_suitable_for_gpu_rasterization_ = flag; |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 371 | UpdateGpuRasterizationStatus(); |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 372 | } |
vmiura | 4e7e199c | 2015-05-15 16:16:20 | [diff] [blame] | 373 | bool CanUseGpuRasterization(); |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 374 | void UpdateTreeResourcesForGpuRasterizationIfNeeded(); |
[email protected] | 13525d6 | 2014-05-20 21:22:04 | [diff] [blame] | 375 | bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
senorblanco | fb88a4e | 2015-05-08 17:28:41 | [diff] [blame] | 376 | bool use_msaa() const { return use_msaa_; } |
hendrikw | c2bbd61 | 2014-12-03 23:49:34 | [diff] [blame] | 377 | |
| 378 | GpuRasterizationStatus gpu_rasterization_status() const { |
| 379 | return gpu_rasterization_status_; |
| 380 | } |
hendrikw | c2bbd61 | 2014-12-03 23:49:34 | [diff] [blame] | 381 | |
[email protected] | 473f1f2 | 2014-05-22 08:19:17 | [diff] [blame] | 382 | bool create_low_res_tiling() const { |
| 383 | return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
| 384 | } |
[email protected] | b7635e0 | 2014-04-28 07:08:43 | [diff] [blame] | 385 | ResourcePool* resource_pool() { return resource_pool_.get(); } |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 386 | Renderer* renderer() { return renderer_.get(); } |
[email protected] | 7a8bcd26 | 2014-01-15 12:54:58 | [diff] [blame] | 387 | const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 388 | |
[email protected] | e034135 | 2013-04-06 05:01:20 | [diff] [blame] | 389 | virtual bool SwapBuffers(const FrameData& frame); |
[email protected] | 97e9ccd6 | 2014-04-12 01:07:15 | [diff] [blame] | 390 | virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
mithro | 51693e38 | 2015-05-07 23:52:41 | [diff] [blame] | 391 | virtual void DidFinishImplFrame(); |
[email protected] | c48536a5 | 2013-09-14 00:02:08 | [diff] [blame] | 392 | void DidModifyTilePriorities(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 393 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 394 | LayerTreeImpl* active_tree() { return active_tree_.get(); } |
| 395 | const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
| 396 | LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
| 397 | const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
[email protected] | 71618ed | 2014-07-24 02:23:45 | [diff] [blame] | 398 | LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 399 | const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
[email protected] | 12a63da | 2014-06-13 06:06:22 | [diff] [blame] | 400 | // Returns the tree LTH synchronizes with. |
| 401 | LayerTreeImpl* sync_tree() { |
enne | af5bda3 | 2015-02-19 01:27:36 | [diff] [blame] | 402 | // TODO(enne): This is bogus. It should return based on the value of |
| 403 | // Proxy::CommitToActiveTree and not whether the pending tree exists. |
[email protected] | fc20d14 | 2014-07-01 00:49:15 | [diff] [blame] | 404 | return pending_tree_ ? pending_tree_.get() : active_tree_.get(); |
[email protected] | 12a63da | 2014-06-13 06:06:22 | [diff] [blame] | 405 | } |
[email protected] | 2f0d92f | 2013-06-11 04:07:20 | [diff] [blame] | 406 | virtual void CreatePendingTree(); |
[email protected] | fc20d14 | 2014-07-01 00:49:15 | [diff] [blame] | 407 | virtual void ActivateSyncTree(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 408 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 409 | // Shortcuts to layers on the active tree. |
| 410 | LayerImpl* RootLayer() const; |
[email protected] | adeda57 | 2014-01-31 00:49:47 | [diff] [blame] | 411 | LayerImpl* InnerViewportScrollLayer() const; |
| 412 | LayerImpl* OuterViewportScrollLayer() const; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 413 | LayerImpl* CurrentlyScrollingLayer() const; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 414 | |
[email protected] | f161ca9e | 2014-04-01 13:57:01 | [diff] [blame] | 415 | int scroll_layer_id_when_mouse_over_scrollbar() const { |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 416 | return scroll_layer_id_when_mouse_over_scrollbar_; |
| 417 | } |
[email protected] | f161ca9e | 2014-04-01 13:57:01 | [diff] [blame] | 418 | bool scroll_affects_scroll_handler() const { |
| 419 | return scroll_affects_scroll_handler_; |
| 420 | } |
[email protected] | dab0a42 | 2014-08-13 16:09:46 | [diff] [blame] | 421 | void QueueSwapPromiseForMainThreadScrollUpdate( |
| 422 | scoped_ptr<SwapPromise> swap_promise); |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 423 | |
jdduke | 16dde6e | 2014-10-24 00:22:56 | [diff] [blame] | 424 | bool IsActivelyScrolling() const; |
[email protected] | 251699b | 2013-10-09 00:21:26 | [diff] [blame] | 425 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 426 | virtual void SetVisible(bool visible); |
| 427 | bool visible() const { return visible_; } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 428 | |
mithro | 719bf679 | 2014-11-10 15:36:47 | [diff] [blame] | 429 | bool AnimationsAreVisible() { return visible() && CanDraw(); } |
| 430 | |
[email protected] | d7eb8c7 | 2013-03-23 22:57:13 | [diff] [blame] | 431 | void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
hush | b0ee8dc | 2015-06-10 00:48:57 | [diff] [blame] | 432 | void SetNeedsAnimate(); |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 433 | void SetNeedsRedraw(); |
[email protected] | d7eb8c7 | 2013-03-23 22:57:13 | [diff] [blame] | 434 | |
[email protected] | 206a392 | 2013-05-17 06:34:12 | [diff] [blame] | 435 | ManagedMemoryPolicy ActualManagedMemoryPolicy() const; |
| 436 | |
[email protected] | 3f2ff11 | 2013-08-03 02:41:07 | [diff] [blame] | 437 | size_t memory_allocation_limit_bytes() const; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 438 | |
[email protected] | 64348ea | 2014-01-29 22:58:26 | [diff] [blame] | 439 | void SetViewportSize(const gfx::Size& device_viewport_size); |
[email protected] | 4a6c091d | 2014-04-24 21:06:46 | [diff] [blame] | 440 | gfx::Size device_viewport_size() const { return device_viewport_size_; } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 441 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 442 | void SetDeviceScaleFactor(float device_scale_factor); |
| 443 | float device_scale_factor() const { return device_scale_factor_; } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 444 | |
aelias | 58eec081 | 2014-12-04 01:04:40 | [diff] [blame] | 445 | void SetPageScaleOnActiveTree(float page_scale_factor); |
| 446 | |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 447 | const gfx::Transform& DrawTransform() const; |
[email protected] | f224cc9 | 2013-06-06 23:23:32 | [diff] [blame] | 448 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 449 | scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 450 | |
[email protected] | d7626ffd | 2013-03-29 00:17:42 | [diff] [blame] | 451 | void set_max_memory_needed_bytes(size_t bytes) { |
| 452 | max_memory_needed_bytes_ = bytes; |
| 453 | } |
| 454 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 455 | FrameRateCounter* fps_counter() { |
| 456 | return fps_counter_.get(); |
| 457 | } |
| 458 | PaintTimeCounter* paint_time_counter() { |
| 459 | return paint_time_counter_.get(); |
| 460 | } |
| 461 | MemoryHistory* memory_history() { |
| 462 | return memory_history_.get(); |
| 463 | } |
| 464 | DebugRectHistory* debug_rect_history() { |
| 465 | return debug_rect_history_.get(); |
| 466 | } |
| 467 | ResourceProvider* resource_provider() { |
| 468 | return resource_provider_.get(); |
| 469 | } |
| 470 | TopControlsManager* top_controls_manager() { |
| 471 | return top_controls_manager_.get(); |
| 472 | } |
[email protected] | 4bb0f31 | 2014-02-25 02:02:32 | [diff] [blame] | 473 | const GlobalStateThatImpactsTilePriority& global_tile_state() { |
| 474 | return global_tile_state_; |
| 475 | } |
[email protected] | ff762fb | 2012-12-12 19:18:37 | [diff] [blame] | 476 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 477 | Proxy* proxy() const { return proxy_; } |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 478 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 479 | AnimationRegistrar* animation_registrar() const { |
| 480 | return animation_registrar_.get(); |
| 481 | } |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 482 | AnimationHost* animation_host() const { return animation_host_.get(); } |
[email protected] | de4afb5e | 2012-12-20 00:11:34 | [diff] [blame] | 483 | |
[email protected] | 6e7fdeb | 2013-07-09 14:28:38 | [diff] [blame] | 484 | void SetDebugState(const LayerTreeDebugState& new_debug_state); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 485 | const LayerTreeDebugState& debug_state() const { return debug_state_; } |
[email protected] | f511afb | 2012-11-30 01:55:20 | [diff] [blame] | 486 | |
[email protected] | a2b5ded | 2013-05-20 21:32:53 | [diff] [blame] | 487 | gfx::Vector2dF accumulated_root_overscroll() const { |
| 488 | return accumulated_root_overscroll_; |
| 489 | } |
[email protected] | a2b5ded | 2013-05-20 21:32:53 | [diff] [blame] | 490 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 491 | bool pinch_gesture_active() const { return pinch_gesture_active_; } |
[email protected] | 166db5c8 | 2013-01-09 23:54:31 | [diff] [blame] | 492 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 493 | void SetTreePriority(TreePriority priority); |
vmpstr | 56ace23 | 2014-10-09 20:16:28 | [diff] [blame] | 494 | TreePriority GetTreePriority() const; |
[email protected] | 362f1e8b | 2013-01-21 16:54:30 | [diff] [blame] | 495 | |
mithro | 0bdb49d | 2015-05-27 13:08:01 | [diff] [blame] | 496 | // TODO(mithro): Remove this methods which exposes the internal |
| 497 | // BeginFrameArgs to external callers. |
[email protected] | 04c5900d | 2014-08-18 13:38:36 | [diff] [blame] | 498 | virtual BeginFrameArgs CurrentBeginFrameArgs() const; |
[email protected] | 829ad97 | 2013-01-28 23:36:10 | [diff] [blame] | 499 | |
[email protected] | c92195e | 2014-05-07 18:18:49 | [diff] [blame] | 500 | // Expected time between two begin impl frame calls. |
mithro | 0bdb49d | 2015-05-27 13:08:01 | [diff] [blame] | 501 | base::TimeDelta CurrentBeginFrameInterval() const; |
[email protected] | c92195e | 2014-05-07 18:18:49 | [diff] [blame] | 502 | |
[email protected] | d12aa93 | 2014-08-01 13:10:38 | [diff] [blame] | 503 | void AsValueWithFrameInto(FrameData* frame, |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 504 | base::trace_event::TracedValue* value) const; |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 505 | scoped_refptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame( |
[email protected] | d12aa93 | 2014-08-01 13:10:38 | [diff] [blame] | 506 | FrameData* frame) const; |
ssid | 911e40e | 2015-02-09 17:55:20 | [diff] [blame] | 507 | void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const; |
[email protected] | 131a0c2 | 2013-02-12 18:31:08 | [diff] [blame] | 508 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 509 | bool page_scale_animation_active() const { return !!page_scale_animation_; } |
[email protected] | 498ddd0 | 2013-02-28 23:59:25 | [diff] [blame] | 510 | |
[email protected] | 741fba42 | 2013-09-20 03:34:14 | [diff] [blame] | 511 | virtual void CreateUIResource(UIResourceId uid, |
| 512 | const UIResourceBitmap& bitmap); |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 513 | // Deletes a UI resource. May safely be called more than once. |
[email protected] | 741fba42 | 2013-09-20 03:34:14 | [diff] [blame] | 514 | virtual void DeleteUIResource(UIResourceId uid); |
[email protected] | 127bdc1a | 2013-09-11 01:44:48 | [diff] [blame] | 515 | void EvictAllUIResources(); |
| 516 | bool EvictedUIResourcesExist() const; |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 517 | |
jbauman | bbd425e | 2015-05-19 00:33:35 | [diff] [blame] | 518 | virtual ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 519 | |
[email protected] | 709c954 | 2013-10-26 01:43:51 | [diff] [blame] | 520 | virtual bool IsUIResourceOpaque(UIResourceId uid) const; |
| 521 | |
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 522 | struct UIResourceData { |
jbauman | bbd425e | 2015-05-19 00:33:35 | [diff] [blame] | 523 | ResourceId resource_id; |
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 524 | gfx::Size size; |
[email protected] | 709c954 | 2013-10-26 01:43:51 | [diff] [blame] | 525 | bool opaque; |
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 526 | }; |
| 527 | |
[email protected] | 5e5648a | 2013-11-18 00:39:33 | [diff] [blame] | 528 | void ScheduleMicroBenchmark(scoped_ptr<MicroBenchmarkImpl> benchmark); |
| 529 | |
[email protected] | 4a28a61 | 2013-11-27 02:06:33 | [diff] [blame] | 530 | CompositorFrameMetadata MakeCompositorFrameMetadata() const; |
[email protected] | 59fee30 | 2013-12-10 17:53:30 | [diff] [blame] | 531 | // Viewport rectangle and clip in nonflipped window space. These rects |
| 532 | // should only be used by Renderer subclasses to populate glViewport/glClip |
| 533 | // and their software-mode equivalents. |
| 534 | gfx::Rect DeviceViewport() const; |
| 535 | gfx::Rect DeviceClip() const; |
[email protected] | 4a28a61 | 2013-11-27 02:06:33 | [diff] [blame] | 536 | |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 537 | // When a SwapPromiseMonitor is created on the impl thread, it calls |
| 538 | // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. |
| 539 | // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() |
| 540 | // to unregister itself. |
| 541 | void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
| 542 | void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
| 543 | |
weiliangc | 8dac5a6 | 2015-04-02 06:12:35 | [diff] [blame] | 544 | // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for |
| 545 | // ReadyToDraw. crbug.com/469175 |
vmpstr | 61ed94a1 | 2014-10-09 04:49:30 | [diff] [blame] | 546 | void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } |
| 547 | void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } |
| 548 | bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } |
| 549 | |
enne | 69277cb | 2014-10-29 23:03:40 | [diff] [blame] | 550 | // Only valid for synchronous (non-scheduled) single-threaded case. |
| 551 | void SynchronouslyInitializeAllTiles(); |
| 552 | |
vmiura | a30e1ea | 2014-12-09 19:23:51 | [diff] [blame] | 553 | virtual void CreateResourceAndTileTaskWorkerPool( |
| 554 | scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
enne | 03dbe8ae | 2014-10-30 01:32:55 | [diff] [blame] | 555 | scoped_ptr<ResourcePool>* resource_pool, |
| 556 | scoped_ptr<ResourcePool>* staging_resource_pool); |
| 557 | |
vmpstr | 5377520a | 2014-12-29 23:26:13 | [diff] [blame] | 558 | bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
| 559 | |
vmpstr | 99aa853c | 2015-02-03 20:31:22 | [diff] [blame] | 560 | FrameTimingTracker* frame_timing_tracker() { |
| 561 | return frame_timing_tracker_.get(); |
| 562 | } |
| 563 | |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 564 | gfx::Vector2dF ScrollLayer(LayerImpl* layer_impl, |
| 565 | const gfx::Vector2dF& delta, |
| 566 | const gfx::Point& viewport_point, |
tdresser | 3e773d7a | 2015-07-07 22:16:14 | [diff] [blame] | 567 | bool is_direct_manipulation); |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 568 | |
vmpstr | d704c87 | 2015-04-03 20:29:51 | [diff] [blame] | 569 | // Record main frame timing information. |
| 570 | // |start_of_main_frame_args| is the BeginFrameArgs of the beginning of the |
| 571 | // main frame (ie the frame that kicked off the main frame). |
| 572 | // |expected_next_main_frame_args| is the BeginFrameArgs of the frame that |
| 573 | // follows the completion of the main frame (whether it is activation or some |
| 574 | // other completion, such as early out). Note that if there is a main frame |
| 575 | // scheduled in that frame, then this BeginFrameArgs will become the main |
| 576 | // frame args. However, if no such frame is scheduled, then this _would_ be |
| 577 | // the main frame args if it was scheduled. |
| 578 | void RecordMainFrameTiming( |
| 579 | const BeginFrameArgs& start_of_main_frame_args, |
| 580 | const BeginFrameArgs& expected_next_main_frame_args); |
| 581 | |
mpb | ed24c2c | 2015-06-05 20:57:13 | [diff] [blame] | 582 | // Post the given frame timing events to the requester. |
| 583 | void PostFrameTimingEvents( |
| 584 | scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
| 585 | scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); |
| 586 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 587 | protected: |
[email protected] | 372bad5f | 2013-03-21 16:38:43 | [diff] [blame] | 588 | LayerTreeHostImpl( |
| 589 | const LayerTreeSettings& settings, |
| 590 | LayerTreeHostImplClient* client, |
| 591 | Proxy* proxy, |
[email protected] | a7f3568 | 2013-10-22 23:05:57 | [diff] [blame] | 592 | RenderingStatsInstrumentation* rendering_stats_instrumentation, |
reveman | 22dd929 | 2014-10-13 20:52:05 | [diff] [blame] | 593 | SharedBitmapManager* shared_bitmap_manager, |
reveman | f9a8a234 | 2014-10-28 17:54:52 | [diff] [blame] | 594 | gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 595 | TaskGraphRunner* task_graph_runner, |
[email protected] | dbe759a | 2013-12-02 19:23:02 | [diff] [blame] | 596 | int id); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 597 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 598 | // Virtual for testing. |
[email protected] | 2715264 | 2014-03-11 20:42:00 | [diff] [blame] | 599 | virtual void AnimateLayers(base::TimeTicks monotonic_time); |
[email protected] | de4afb5e | 2012-12-20 00:11:34 | [diff] [blame] | 600 | |
sunnyps | c61ff519 | 2015-03-18 01:41:25 | [diff] [blame] | 601 | bool is_likely_to_require_a_draw() const { |
| 602 | return is_likely_to_require_a_draw_; |
| 603 | } |
| 604 | |
danakj | 112d3a10 | 2015-04-14 18:24:49 | [diff] [blame] | 605 | // Removes empty or orphan RenderPasses from the frame. |
| 606 | static void RemoveRenderPasses(FrameData* frame); |
| 607 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 608 | LayerTreeHostImplClient* client_; |
| 609 | Proxy* proxy_; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 610 | |
mithro | 0bdb49d | 2015-05-27 13:08:01 | [diff] [blame] | 611 | BeginFrameTracker current_begin_frame_tracker_; |
| 612 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 613 | private: |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 614 | gfx::Vector2dF ScrollLayerWithViewportSpaceDelta( |
| 615 | LayerImpl* layer_impl, |
| 616 | const gfx::PointF& viewport_point, |
| 617 | const gfx::Vector2dF& viewport_delta); |
| 618 | |
[email protected] | ced667b | 2014-05-22 21:49:53 | [diff] [blame] | 619 | void CreateAndSetRenderer(); |
| 620 | void CreateAndSetTileManager(); |
| 621 | void DestroyTileManager(); |
[email protected] | 5064464 | 2013-06-20 13:58:55 | [diff] [blame] | 622 | void ReleaseTreeResources(); |
vmpstr | 9ce5c66 | 2015-02-05 23:29:26 | [diff] [blame] | 623 | void RecreateTreeResources(); |
[email protected] | 2b154b2 | 2013-06-07 09:03:27 | [diff] [blame] | 624 | |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 625 | void UpdateGpuRasterizationStatus(); |
| 626 | |
enne | 03dbe8ae | 2014-10-30 01:32:55 | [diff] [blame] | 627 | bool IsSynchronousSingleThreaded() const; |
[email protected] | ced667b | 2014-05-22 21:49:53 | [diff] [blame] | 628 | |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 629 | Viewport* viewport() { return viewport_.get(); } |
| 630 | |
bokan | 59379b09 | 2014-09-29 13:47:21 | [diff] [blame] | 631 | // Scroll by preferring to move the outer viewport first, only moving the |
| 632 | // inner if the outer is at its scroll extents. |
[email protected] | adeda57 | 2014-01-31 00:49:47 | [diff] [blame] | 633 | void ScrollViewportBy(gfx::Vector2dF scroll_delta); |
bokan | 59379b09 | 2014-09-29 13:47:21 | [diff] [blame] | 634 | // Scroll by preferring to move the inner viewport first, only moving the |
| 635 | // outer if the inner is at its scroll extents. |
| 636 | void ScrollViewportInnerFirst(gfx::Vector2dF scroll_delta); |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 637 | |
hush | 1c87323 | 2015-06-23 21:22:11 | [diff] [blame] | 638 | InputHandler::ScrollStatus ScrollBeginImpl( |
| 639 | LayerImpl* scrolling_layer_impl, |
| 640 | InputHandler::ScrollInputType type); |
| 641 | |
hush | b0ee8dc | 2015-06-10 00:48:57 | [diff] [blame] | 642 | void AnimateInput(base::TimeTicks monotonic_time); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 643 | void AnimatePageScale(base::TimeTicks monotonic_time); |
| 644 | void AnimateScrollbars(base::TimeTicks monotonic_time); |
[email protected] | ffb2720f | 2013-03-15 19:18:37 | [diff] [blame] | 645 | void AnimateTopControls(base::TimeTicks monotonic_time); |
[email protected] | 2d69299 | 2012-12-19 01:19:32 | [diff] [blame] | 646 | |
[email protected] | 50761e9 | 2013-03-29 20:51:28 | [diff] [blame] | 647 | void TrackDamageForAllSurfaces( |
| 648 | LayerImpl* root_draw_layer, |
| 649 | const LayerImplList& render_surface_layer_list); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 650 | |
[email protected] | 8be1a9bf | 2013-05-01 03:45:19 | [diff] [blame] | 651 | void UpdateTileManagerMemoryPolicy(const ManagedMemoryPolicy& policy); |
| 652 | |
[email protected] | 7ddfe7e8 | 2014-01-30 07:22:11 | [diff] [blame] | 653 | // This function should only be called from PrepareToDraw, as DidDrawAllLayers |
| 654 | // must be called if this helper function is called. Returns DRAW_SUCCESS if |
| 655 | // the frame should be drawn. |
[email protected] | 30d8214 | 2014-05-12 04:26:02 | [diff] [blame] | 656 | DrawResult CalculateRenderPasses(FrameData* frame); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 657 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 658 | void ClearCurrentlyScrollingLayer(); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 659 | |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 660 | bool HandleMouseOverScrollbar(LayerImpl* layer_impl, |
[email protected] | 14bc5d68 | 2014-01-17 07:26:47 | [diff] [blame] | 661 | const gfx::PointF& device_viewport_point); |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 662 | |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 663 | LayerImpl* FindScrollLayerForDeviceViewportPoint( |
[email protected] | 14bc5d68 | 2014-01-17 07:26:47 | [diff] [blame] | 664 | const gfx::PointF& device_viewport_point, |
[email protected] | bf1cfd9a | 2013-09-26 05:43:02 | [diff] [blame] | 665 | InputHandler::ScrollInputType type, |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 666 | LayerImpl* layer_hit_by_point, |
[email protected] | f161ca9e | 2014-04-01 13:57:01 | [diff] [blame] | 667 | bool* scroll_on_main_thread, |
[email protected] | edcc1a1 | 2014-05-06 01:26:39 | [diff] [blame] | 668 | bool* optional_has_ancestor_scroll_handler) const; |
[email protected] | 14bc5d68 | 2014-01-17 07:26:47 | [diff] [blame] | 669 | float DeviceSpaceDistanceToLayer(const gfx::PointF& device_viewport_point, |
[email protected] | bf1cfd9a | 2013-09-26 05:43:02 | [diff] [blame] | 670 | LayerImpl* layer_impl); |
[email protected] | 930ff43b | 2014-05-02 05:24:00 | [diff] [blame] | 671 | void StartScrollbarFadeRecursive(LayerImpl* layer); |
boliu | 247624d | 2015-04-11 02:04:25 | [diff] [blame] | 672 | void SetManagedMemoryPolicy(const ManagedMemoryPolicy& policy); |
[email protected] | 0fc818e | 2013-03-18 06:45:20 | [diff] [blame] | 673 | |
[email protected] | 127bdc1a | 2013-09-11 01:44:48 | [diff] [blame] | 674 | void MarkUIResourceNotEvicted(UIResourceId uid); |
| 675 | |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 676 | void NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
[email protected] | dab0a42 | 2014-08-13 16:09:46 | [diff] [blame] | 677 | void NotifySwapPromiseMonitorsOfForwardingToMainThread(); |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 678 | |
loyso | 2c4002d | 2015-03-13 02:31:43 | [diff] [blame] | 679 | void ScrollAnimationCreate(LayerImpl* layer_impl, |
| 680 | const gfx::ScrollOffset& target_offset, |
| 681 | const gfx::ScrollOffset& current_offset); |
| 682 | bool ScrollAnimationUpdateTarget(LayerImpl* layer_impl, |
| 683 | const gfx::Vector2dF& scroll_delta); |
| 684 | |
vmpstr | e4344fd | 2015-06-30 23:32:22 | [diff] [blame] | 685 | base::SingleThreadTaskRunner* GetTaskRunner() const { |
| 686 | DCHECK(proxy_); |
| 687 | return proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() |
| 688 | : proxy_->MainThreadTaskRunner(); |
| 689 | } |
| 690 | |
[email protected] | efbdb3a | 2013-10-04 00:35:13 | [diff] [blame] | 691 | typedef base::hash_map<UIResourceId, UIResourceData> |
[email protected] | c928076 | 2013-08-01 06:28:57 | [diff] [blame] | 692 | UIResourceMap; |
| 693 | UIResourceMap ui_resource_map_; |
| 694 | |
[email protected] | 127bdc1a | 2013-09-11 01:44:48 | [diff] [blame] | 695 | // Resources that were evicted by EvictAllUIResources. Resources are removed |
| 696 | // from this when they are touched by a create or destroy from the UI resource |
| 697 | // request queue. |
| 698 | std::set<UIResourceId> evicted_ui_resources_; |
| 699 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 700 | scoped_ptr<OutputSurface> output_surface_; |
[email protected] | fbe89f7 | 2013-05-21 07:24:24 | [diff] [blame] | 701 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 702 | scoped_ptr<ResourceProvider> resource_provider_; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 703 | scoped_ptr<TileManager> tile_manager_; |
senorblanco | 8d1b3ac | 2015-05-05 00:14:26 | [diff] [blame] | 704 | bool content_is_suitable_for_gpu_rasterization_; |
| 705 | bool has_gpu_rasterization_trigger_; |
[email protected] | 13525d6 | 2014-05-20 21:22:04 | [diff] [blame] | 706 | bool use_gpu_rasterization_; |
senorblanco | fb88a4e | 2015-05-08 17:28:41 | [diff] [blame] | 707 | bool use_msaa_; |
hendrikw | c2bbd61 | 2014-12-03 23:49:34 | [diff] [blame] | 708 | GpuRasterizationStatus gpu_rasterization_status_; |
senorblanco | 9c04acb | 2015-05-15 19:41:32 | [diff] [blame] | 709 | bool tree_resources_for_gpu_rasterization_dirty_; |
vmiura | a30e1ea | 2014-12-09 19:23:51 | [diff] [blame] | 710 | scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; |
[email protected] | eece11e | 2014-04-12 03:07:16 | [diff] [blame] | 711 | scoped_ptr<ResourcePool> resource_pool_; |
[email protected] | 2cccfef | 2014-05-01 06:05:16 | [diff] [blame] | 712 | scoped_ptr<ResourcePool> staging_resource_pool_; |
[email protected] | fbe89f7 | 2013-05-21 07:24:24 | [diff] [blame] | 713 | scoped_ptr<Renderer> renderer_; |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 714 | |
[email protected] | 1bcced2 | 2013-09-24 13:51:19 | [diff] [blame] | 715 | GlobalStateThatImpactsTilePriority global_tile_state_; |
| 716 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 717 | // Tree currently being drawn. |
| 718 | scoped_ptr<LayerTreeImpl> active_tree_; |
[email protected] | 3b31c6ac | 2012-12-06 21:27:29 | [diff] [blame] | 719 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 720 | // In impl-side painting mode, tree with possibly incomplete rasterized |
[email protected] | 4f48f6e | 2013-08-27 06:33:38 | [diff] [blame] | 721 | // content. May be promoted to active by ActivatePendingTree(). |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 722 | scoped_ptr<LayerTreeImpl> pending_tree_; |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 723 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 724 | // In impl-side painting mode, inert tree with layers that can be recycled |
| 725 | // by the next sync from the main thread. |
| 726 | scoped_ptr<LayerTreeImpl> recycle_tree_; |
[email protected] | 48871fc | 2013-01-23 07:36:51 | [diff] [blame] | 727 | |
[email protected] | 200a9c06 | 2013-05-20 04:34:37 | [diff] [blame] | 728 | InputHandlerClient* input_handler_client_; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 729 | bool did_lock_scrolling_layer_; |
| 730 | bool should_bubble_scrolls_; |
| 731 | bool wheel_scrolling_; |
[email protected] | f161ca9e | 2014-04-01 13:57:01 | [diff] [blame] | 732 | bool scroll_affects_scroll_handler_; |
[email protected] | f620b0e7 | 2013-10-01 21:38:24 | [diff] [blame] | 733 | int scroll_layer_id_when_mouse_over_scrollbar_; |
[email protected] | dab0a42 | 2014-08-13 16:09:46 | [diff] [blame] | 734 | ScopedPtrVector<SwapPromise> swap_promises_for_main_thread_scroll_update_; |
[email protected] | a23451e | 2013-06-07 20:58:26 | [diff] [blame] | 735 | |
ccameron | 4163cc35 | 2014-11-13 19:06:36 | [diff] [blame] | 736 | // An object to implement the ScrollElasticityHelper interface and |
| 737 | // hold all state related to elasticity. May be NULL if never requested. |
| 738 | scoped_ptr<ScrollElasticityHelper> scroll_elasticity_helper_; |
| 739 | |
[email protected] | c48536a5 | 2013-09-14 00:02:08 | [diff] [blame] | 740 | bool tile_priorities_dirty_; |
[email protected] | a23451e | 2013-06-07 20:58:26 | [diff] [blame] | 741 | |
[email protected] | 1960a71 | 2013-04-30 17:06:47 | [diff] [blame] | 742 | // The optional delegate for the root layer scroll offset. |
| 743 | LayerScrollOffsetDelegate* root_layer_scroll_offset_delegate_; |
hush | b0ee8dc | 2015-06-10 00:48:57 | [diff] [blame] | 744 | LayerScrollOffsetDelegate::AnimationCallback root_layer_animation_callback_; |
| 745 | |
enne | 65dc621 | 2015-04-29 21:44:23 | [diff] [blame] | 746 | const LayerTreeSettings settings_; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 747 | LayerTreeDebugState debug_state_; |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 748 | bool visible_; |
[email protected] | 3f2ff11 | 2013-08-03 02:41:07 | [diff] [blame] | 749 | ManagedMemoryPolicy cached_managed_memory_policy_; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 750 | |
[email protected] | a2b5ded | 2013-05-20 21:32:53 | [diff] [blame] | 751 | gfx::Vector2dF accumulated_root_overscroll_; |
[email protected] | 6e921bd | 2013-04-29 21:10:20 | [diff] [blame] | 752 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 753 | bool pinch_gesture_active_; |
[email protected] | 2fa342b8 | 2013-09-24 03:19:13 | [diff] [blame] | 754 | bool pinch_gesture_end_should_clear_scrolling_layer_; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 755 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 756 | scoped_ptr<TopControlsManager> top_controls_manager_; |
[email protected] | 3ba4cae | 2013-01-16 03:58:38 | [diff] [blame] | 757 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 758 | scoped_ptr<PageScaleAnimation> page_scale_animation_; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 759 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 760 | scoped_ptr<FrameRateCounter> fps_counter_; |
| 761 | scoped_ptr<PaintTimeCounter> paint_time_counter_; |
| 762 | scoped_ptr<MemoryHistory> memory_history_; |
| 763 | scoped_ptr<DebugRectHistory> debug_rect_history_; |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 764 | |
[email protected] | ea468c6c | 2013-09-10 08:25:11 | [diff] [blame] | 765 | scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
| 766 | |
[email protected] | d7626ffd | 2013-03-29 00:17:42 | [diff] [blame] | 767 | // The maximum memory that would be used by the prioritized resource |
| 768 | // manager, if there were no limit on memory usage. |
| 769 | size_t max_memory_needed_bytes_; |
| 770 | |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 771 | // Viewport size passed in from the main thread, in physical pixels. This |
| 772 | // value is the default size for all concepts of physical viewport (draw |
| 773 | // viewport, scrolling viewport and device viewport), but it can be |
| 774 | // overridden. |
[email protected] | f224cc9 | 2013-06-06 23:23:32 | [diff] [blame] | 775 | gfx::Size device_viewport_size_; |
| 776 | |
| 777 | // Conversion factor from CSS pixels to physical pixels when |
| 778 | // pageScaleFactor=1. |
| 779 | float device_scale_factor_; |
| 780 | |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 781 | // Optional top-level constraints that can be set by the OutputSurface. |
| 782 | // - external_transform_ applies a transform above the root layer |
| 783 | // - external_viewport_ is used DrawProperties, tile management and |
| 784 | // glViewport/window projection matrix. |
| 785 | // - external_clip_ specifies a top-level clip rect |
[email protected] | bd532459 | 2014-07-31 09:09:33 | [diff] [blame] | 786 | // - viewport_rect_for_tile_priority_ is the rect in view space used for |
| 787 | // tiling priority. |
[email protected] | f224cc9 | 2013-06-06 23:23:32 | [diff] [blame] | 788 | gfx::Transform external_transform_; |
| 789 | gfx::Rect external_viewport_; |
[email protected] | 54af0352 | 2013-09-05 00:43:28 | [diff] [blame] | 790 | gfx::Rect external_clip_; |
[email protected] | bd532459 | 2014-07-31 09:09:33 | [diff] [blame] | 791 | gfx::Rect viewport_rect_for_tile_priority_; |
[email protected] | c05dfbb | 2014-07-10 22:49:04 | [diff] [blame] | 792 | bool resourceless_software_draw_; |
[email protected] | f224cc9 | 2013-06-06 23:23:32 | [diff] [blame] | 793 | |
[email protected] | 878705be | 2013-04-15 22:44:02 | [diff] [blame] | 794 | gfx::Rect viewport_damage_rect_; |
[email protected] | e034135 | 2013-04-06 05:01:20 | [diff] [blame] | 795 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 796 | scoped_ptr<AnimationRegistrar> animation_registrar_; |
loyso | bb93befc | 2015-07-03 00:19:50 | [diff] [blame] | 797 | scoped_ptr<AnimationHost> animation_host_; |
sunnyps | ae4316a | 2015-02-25 00:54:58 | [diff] [blame] | 798 | std::set<ScrollbarAnimationController*> scrollbar_animation_controllers_; |
sunnyps | 7d073dc | 2015-04-16 23:29:12 | [diff] [blame] | 799 | std::set<VideoFrameController*> video_frame_controllers_; |
[email protected] | de4afb5e | 2012-12-20 00:11:34 | [diff] [blame] | 800 | |
[email protected] | 372bad5f | 2013-03-21 16:38:43 | [diff] [blame] | 801 | RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
[email protected] | 5e5648a | 2013-11-18 00:39:33 | [diff] [blame] | 802 | MicroBenchmarkControllerImpl micro_benchmark_controller_; |
enne | 69277cb | 2014-10-29 23:03:40 | [diff] [blame] | 803 | scoped_ptr<TaskGraphRunner> single_thread_synchronous_task_graph_runner_; |
[email protected] | 372bad5f | 2013-03-21 16:38:43 | [diff] [blame] | 804 | |
[email protected] | 5f07afc | 2013-07-19 05:17:18 | [diff] [blame] | 805 | // Optional callback to notify of new tree activations. |
[email protected] | 2022c67 | 2013-07-23 19:55:26 | [diff] [blame] | 806 | base::Closure tree_activation_callback_; |
[email protected] | 5f07afc | 2013-07-19 05:17:18 | [diff] [blame] | 807 | |
[email protected] | a7f3568 | 2013-10-22 23:05:57 | [diff] [blame] | 808 | SharedBitmapManager* shared_bitmap_manager_; |
reveman | f9a8a234 | 2014-10-28 17:54:52 | [diff] [blame] | 809 | gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
reveman | 34b7a152 | 2015-03-23 20:27:47 | [diff] [blame] | 810 | TaskGraphRunner* task_graph_runner_; |
[email protected] | dbe759a | 2013-12-02 19:23:02 | [diff] [blame] | 811 | int id_; |
[email protected] | a7f3568 | 2013-10-22 23:05:57 | [diff] [blame] | 812 | |
[email protected] | 6be422b | 2013-12-08 06:47:31 | [diff] [blame] | 813 | std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
[email protected] | 8aa39ecb | 2014-06-12 14:19:14 | [diff] [blame] | 814 | |
vmpstr | 61ed94a1 | 2014-10-09 04:49:30 | [diff] [blame] | 815 | bool requires_high_res_to_draw_; |
vmpstr | 4973f5b | 2015-02-02 19:27:29 | [diff] [blame] | 816 | bool is_likely_to_require_a_draw_; |
vmpstr | 61ed94a1 | 2014-10-09 04:49:30 | [diff] [blame] | 817 | |
vmpstr | 99aa853c | 2015-02-03 20:31:22 | [diff] [blame] | 818 | scoped_ptr<FrameTimingTracker> frame_timing_tracker_; |
| 819 | |
bokan | aa274831 | 2015-03-26 00:10:37 | [diff] [blame] | 820 | scoped_ptr<Viewport> viewport_; |
| 821 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 822 | DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 823 | }; |
| 824 | |
[email protected] | 0023e8b | 2012-10-15 12:52:45 | [diff] [blame] | 825 | } // namespace cc |
[email protected] | cd57cc5a | 2012-10-12 22:43:41 | [diff] [blame] | 826 | |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 827 | #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |