OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <set> | 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 #include <unordered_map> | 13 #include <unordered_map> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/macros.h" | 16 #include "base/macros.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "cc/base/cc_export.h" | 18 #include "cc/base/cc_export.h" |
19 #include "cc/base/synced_property.h" | 19 #include "cc/base/synced_property.h" |
20 #include "cc/debug/frame_timing_tracker.h" | 20 #include "cc/debug/frame_timing_tracker.h" |
21 #include "cc/debug/micro_benchmark_controller_impl.h" | 21 #include "cc/debug/micro_benchmark_controller_impl.h" |
22 #include "cc/input/input_handler.h" | 22 #include "cc/input/input_handler.h" |
23 #include "cc/input/scrollbar_animation_controller.h" | 23 #include "cc/input/scrollbar_animation_controller.h" |
24 #include "cc/input/top_controls_manager_client.h" | 24 #include "cc/input/top_controls_manager_client.h" |
25 #include "cc/layers/layer_collections.h" | 25 #include "cc/layers/layer_collections.h" |
26 #include "cc/layers/render_pass_sink.h" | 26 #include "cc/layers/render_pass_sink.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Please call these 3 functions through | 104 // Please call these 3 functions through |
105 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 105 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
106 // SetNeedsOneBeginImplFrame(). | 106 // SetNeedsOneBeginImplFrame(). |
107 virtual void SetNeedsRedrawOnImplThread() = 0; | 107 virtual void SetNeedsRedrawOnImplThread() = 0; |
108 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 108 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
109 virtual void SetNeedsOneBeginImplFrameOnImplThread() = 0; | 109 virtual void SetNeedsOneBeginImplFrameOnImplThread() = 0; |
110 virtual void SetNeedsCommitOnImplThread() = 0; | 110 virtual void SetNeedsCommitOnImplThread() = 0; |
111 virtual void SetNeedsPrepareTilesOnImplThread() = 0; | 111 virtual void SetNeedsPrepareTilesOnImplThread() = 0; |
112 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; | 112 virtual void SetVideoNeedsBeginFrames(bool needs_begin_frames) = 0; |
113 virtual void PostAnimationEventsToMainThreadOnImplThread( | 113 virtual void PostAnimationEventsToMainThreadOnImplThread( |
114 scoped_ptr<AnimationEvents> events) = 0; | 114 std::unique_ptr<AnimationEvents> events) = 0; |
115 virtual bool IsInsideDraw() = 0; | 115 virtual bool IsInsideDraw() = 0; |
116 virtual void RenewTreePriority() = 0; | 116 virtual void RenewTreePriority() = 0; |
117 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, | 117 virtual void PostDelayedAnimationTaskOnImplThread(const base::Closure& task, |
118 base::TimeDelta delay) = 0; | 118 base::TimeDelta delay) = 0; |
119 virtual void DidActivateSyncTree() = 0; | 119 virtual void DidActivateSyncTree() = 0; |
120 virtual void WillPrepareTiles() = 0; | 120 virtual void WillPrepareTiles() = 0; |
121 virtual void DidPrepareTiles() = 0; | 121 virtual void DidPrepareTiles() = 0; |
122 | 122 |
123 // Called when page scale animation has completed on the impl thread. | 123 // Called when page scale animation has completed on the impl thread. |
124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; | 124 virtual void DidCompletePageScaleAnimationOnImplThread() = 0; |
125 | 125 |
126 // Called when output surface asks for a draw. | 126 // Called when output surface asks for a draw. |
127 virtual void OnDrawForOutputSurface(bool resourceless_software_draw) = 0; | 127 virtual void OnDrawForOutputSurface(bool resourceless_software_draw) = 0; |
128 | 128 |
129 virtual void PostFrameTimingEventsOnImplThread( | 129 virtual void PostFrameTimingEventsOnImplThread( |
130 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 130 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
131 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events) = 0; | 131 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> |
| 132 main_frame_events) = 0; |
132 | 133 |
133 protected: | 134 protected: |
134 virtual ~LayerTreeHostImplClient() {} | 135 virtual ~LayerTreeHostImplClient() {} |
135 }; | 136 }; |
136 | 137 |
137 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 138 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
138 // state. | 139 // state. |
139 class CC_EXPORT LayerTreeHostImpl | 140 class CC_EXPORT LayerTreeHostImpl |
140 : public InputHandler, | 141 : public InputHandler, |
141 public RendererClient, | 142 public RendererClient, |
142 public TileManagerClient, | 143 public TileManagerClient, |
143 public OutputSurfaceClient, | 144 public OutputSurfaceClient, |
144 public TopControlsManagerClient, | 145 public TopControlsManagerClient, |
145 public ScrollbarAnimationControllerClient, | 146 public ScrollbarAnimationControllerClient, |
146 public VideoFrameControllerClient, | 147 public VideoFrameControllerClient, |
147 public MutatorHostClient, | 148 public MutatorHostClient, |
148 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 149 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
149 public: | 150 public: |
150 static scoped_ptr<LayerTreeHostImpl> Create( | 151 static std::unique_ptr<LayerTreeHostImpl> Create( |
151 const LayerTreeSettings& settings, | 152 const LayerTreeSettings& settings, |
152 LayerTreeHostImplClient* client, | 153 LayerTreeHostImplClient* client, |
153 TaskRunnerProvider* task_runner_provider, | 154 TaskRunnerProvider* task_runner_provider, |
154 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 155 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
155 SharedBitmapManager* shared_bitmap_manager, | 156 SharedBitmapManager* shared_bitmap_manager, |
156 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 157 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
157 TaskGraphRunner* task_graph_runner, | 158 TaskGraphRunner* task_graph_runner, |
158 int id); | 159 int id); |
159 ~LayerTreeHostImpl() override; | 160 ~LayerTreeHostImpl() override; |
160 | 161 |
(...skipping 28 matching lines...) Expand all Loading... |
189 float page_scale, | 190 float page_scale, |
190 base::TimeDelta duration); | 191 base::TimeDelta duration); |
191 void SetNeedsAnimateInput() override; | 192 void SetNeedsAnimateInput() override; |
192 bool IsCurrentlyScrollingInnerViewport() const override; | 193 bool IsCurrentlyScrollingInnerViewport() const override; |
193 bool IsCurrentlyScrollingLayerAt( | 194 bool IsCurrentlyScrollingLayerAt( |
194 const gfx::Point& viewport_point, | 195 const gfx::Point& viewport_point, |
195 InputHandler::ScrollInputType type) const override; | 196 InputHandler::ScrollInputType type) const override; |
196 EventListenerProperties GetEventListenerProperties( | 197 EventListenerProperties GetEventListenerProperties( |
197 EventListenerClass event_class) const override; | 198 EventListenerClass event_class) const override; |
198 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; | 199 bool DoTouchEventsBlockScrollAt(const gfx::Point& viewport_port) override; |
199 scoped_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( | 200 std::unique_ptr<SwapPromiseMonitor> CreateLatencyInfoSwapPromiseMonitor( |
200 ui::LatencyInfo* latency) override; | 201 ui::LatencyInfo* latency) override; |
201 ScrollElasticityHelper* CreateScrollElasticityHelper() override; | 202 ScrollElasticityHelper* CreateScrollElasticityHelper() override; |
202 | 203 |
203 // TopControlsManagerClient implementation. | 204 // TopControlsManagerClient implementation. |
204 float TopControlsHeight() const override; | 205 float TopControlsHeight() const override; |
205 void SetCurrentTopControlsShownRatio(float offset) override; | 206 void SetCurrentTopControlsShownRatio(float offset) override; |
206 float CurrentTopControlsShownRatio() const override; | 207 float CurrentTopControlsShownRatio() const override; |
207 void DidChangeTopControlsPosition() override; | 208 void DidChangeTopControlsPosition() override; |
208 bool HaveRootScrollLayer() const override; | 209 bool HaveRootScrollLayer() const override; |
209 | 210 |
210 void UpdateViewportContainerSizes(); | 211 void UpdateViewportContainerSizes(); |
211 | 212 |
212 struct CC_EXPORT FrameData : public RenderPassSink { | 213 struct CC_EXPORT FrameData : public RenderPassSink { |
213 FrameData(); | 214 FrameData(); |
214 ~FrameData() override; | 215 ~FrameData() override; |
215 void AsValueInto(base::trace_event::TracedValue* value) const; | 216 void AsValueInto(base::trace_event::TracedValue* value) const; |
216 | 217 |
217 std::vector<gfx::Rect> occluding_screen_space_rects; | 218 std::vector<gfx::Rect> occluding_screen_space_rects; |
218 std::vector<gfx::Rect> non_occluding_screen_space_rects; | 219 std::vector<gfx::Rect> non_occluding_screen_space_rects; |
219 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; | 220 std::vector<FrameTimingTracker::FrameAndRectIds> composite_events; |
220 RenderPassList render_passes; | 221 RenderPassList render_passes; |
221 const LayerImplList* render_surface_layer_list; | 222 const LayerImplList* render_surface_layer_list; |
222 LayerImplList will_draw_layers; | 223 LayerImplList will_draw_layers; |
223 bool has_no_damage; | 224 bool has_no_damage; |
224 | 225 |
225 // RenderPassSink implementation. | 226 // RenderPassSink implementation. |
226 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; | 227 void AppendRenderPass(std::unique_ptr<RenderPass> render_pass) override; |
227 | 228 |
228 private: | 229 private: |
229 DISALLOW_COPY_AND_ASSIGN(FrameData); | 230 DISALLOW_COPY_AND_ASSIGN(FrameData); |
230 }; | 231 }; |
231 | 232 |
232 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); | 233 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); |
233 virtual void BeginCommit(); | 234 virtual void BeginCommit(); |
234 virtual void CommitComplete(); | 235 virtual void CommitComplete(); |
235 virtual void UpdateAnimationState(bool start_ready_animations); | 236 virtual void UpdateAnimationState(bool start_ready_animations); |
236 void ActivateAnimations(); | 237 void ActivateAnimations(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 const gfx::Rect ViewportRectForTilePriority() const; | 322 const gfx::Rect ViewportRectForTilePriority() const; |
322 | 323 |
323 // RendererClient implementation. | 324 // RendererClient implementation. |
324 void SetFullRootLayerDamage() override; | 325 void SetFullRootLayerDamage() override; |
325 | 326 |
326 // TileManagerClient implementation. | 327 // TileManagerClient implementation. |
327 void NotifyReadyToActivate() override; | 328 void NotifyReadyToActivate() override; |
328 void NotifyReadyToDraw() override; | 329 void NotifyReadyToDraw() override; |
329 void NotifyAllTileTasksCompleted() override; | 330 void NotifyAllTileTasksCompleted() override; |
330 void NotifyTileStateChanged(const Tile* tile) override; | 331 void NotifyTileStateChanged(const Tile* tile) override; |
331 scoped_ptr<RasterTilePriorityQueue> BuildRasterQueue( | 332 std::unique_ptr<RasterTilePriorityQueue> BuildRasterQueue( |
332 TreePriority tree_priority, | 333 TreePriority tree_priority, |
333 RasterTilePriorityQueue::Type type) override; | 334 RasterTilePriorityQueue::Type type) override; |
334 scoped_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( | 335 std::unique_ptr<EvictionTilePriorityQueue> BuildEvictionQueue( |
335 TreePriority tree_priority) override; | 336 TreePriority tree_priority) override; |
336 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override; | 337 void SetIsLikelyToRequireADraw(bool is_likely_to_require_a_draw) override; |
337 | 338 |
338 // ScrollbarAnimationControllerClient implementation. | 339 // ScrollbarAnimationControllerClient implementation. |
339 void PostDelayedScrollbarAnimationTask(const base::Closure& task, | 340 void PostDelayedScrollbarAnimationTask(const base::Closure& task, |
340 base::TimeDelta delay) override; | 341 base::TimeDelta delay) override; |
341 void SetNeedsAnimateForScrollbarAnimation() override; | 342 void SetNeedsAnimateForScrollbarAnimation() override; |
342 void SetNeedsRedrawForScrollbarAnimation() override; | 343 void SetNeedsRedrawForScrollbarAnimation() override; |
343 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override; | 344 ScrollbarSet ScrollbarsFor(int scroll_layer_id) const override; |
344 | 345 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 LayerImpl* OuterViewportScrollLayer() const; | 435 LayerImpl* OuterViewportScrollLayer() const; |
435 LayerImpl* CurrentlyScrollingLayer() const; | 436 LayerImpl* CurrentlyScrollingLayer() const; |
436 | 437 |
437 int scroll_layer_id_when_mouse_over_scrollbar() const { | 438 int scroll_layer_id_when_mouse_over_scrollbar() const { |
438 return scroll_layer_id_when_mouse_over_scrollbar_; | 439 return scroll_layer_id_when_mouse_over_scrollbar_; |
439 } | 440 } |
440 bool scroll_affects_scroll_handler() const { | 441 bool scroll_affects_scroll_handler() const { |
441 return scroll_affects_scroll_handler_; | 442 return scroll_affects_scroll_handler_; |
442 } | 443 } |
443 void QueueSwapPromiseForMainThreadScrollUpdate( | 444 void QueueSwapPromiseForMainThreadScrollUpdate( |
444 scoped_ptr<SwapPromise> swap_promise); | 445 std::unique_ptr<SwapPromise> swap_promise); |
445 | 446 |
446 bool IsActivelyScrolling() const; | 447 bool IsActivelyScrolling() const; |
447 | 448 |
448 virtual void SetVisible(bool visible); | 449 virtual void SetVisible(bool visible); |
449 bool visible() const { return visible_; } | 450 bool visible() const { return visible_; } |
450 | 451 |
451 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } | 452 void SetNeedsCommit() { client_->SetNeedsCommitOnImplThread(); } |
452 void SetNeedsOneBeginImplFrame(); | 453 void SetNeedsOneBeginImplFrame(); |
453 void SetNeedsRedraw(); | 454 void SetNeedsRedraw(); |
454 | 455 |
455 ManagedMemoryPolicy ActualManagedMemoryPolicy() const; | 456 ManagedMemoryPolicy ActualManagedMemoryPolicy() const; |
456 | 457 |
457 size_t memory_allocation_limit_bytes() const; | 458 size_t memory_allocation_limit_bytes() const; |
458 | 459 |
459 void SetViewportSize(const gfx::Size& device_viewport_size); | 460 void SetViewportSize(const gfx::Size& device_viewport_size); |
460 gfx::Size device_viewport_size() const { return device_viewport_size_; } | 461 gfx::Size device_viewport_size() const { return device_viewport_size_; } |
461 | 462 |
462 const gfx::Transform& DrawTransform() const; | 463 const gfx::Transform& DrawTransform() const; |
463 | 464 |
464 scoped_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); | 465 std::unique_ptr<ScrollAndScaleSet> ProcessScrollDeltas(); |
465 | 466 |
466 void set_max_memory_needed_bytes(size_t bytes) { | 467 void set_max_memory_needed_bytes(size_t bytes) { |
467 max_memory_needed_bytes_ = bytes; | 468 max_memory_needed_bytes_ = bytes; |
468 } | 469 } |
469 | 470 |
470 FrameRateCounter* fps_counter() { | 471 FrameRateCounter* fps_counter() { |
471 return fps_counter_.get(); | 472 return fps_counter_.get(); |
472 } | 473 } |
473 MemoryHistory* memory_history() { | 474 MemoryHistory* memory_history() { |
474 return memory_history_.get(); | 475 return memory_history_.get(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 507 |
507 // TODO(mithro): Remove this methods which exposes the internal | 508 // TODO(mithro): Remove this methods which exposes the internal |
508 // BeginFrameArgs to external callers. | 509 // BeginFrameArgs to external callers. |
509 virtual BeginFrameArgs CurrentBeginFrameArgs() const; | 510 virtual BeginFrameArgs CurrentBeginFrameArgs() const; |
510 | 511 |
511 // Expected time between two begin impl frame calls. | 512 // Expected time between two begin impl frame calls. |
512 base::TimeDelta CurrentBeginFrameInterval() const; | 513 base::TimeDelta CurrentBeginFrameInterval() const; |
513 | 514 |
514 void AsValueWithFrameInto(FrameData* frame, | 515 void AsValueWithFrameInto(FrameData* frame, |
515 base::trace_event::TracedValue* value) const; | 516 base::trace_event::TracedValue* value) const; |
516 scoped_ptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame( | 517 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValueWithFrame( |
517 FrameData* frame) const; | 518 FrameData* frame) const; |
518 void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const; | 519 void ActivationStateAsValueInto(base::trace_event::TracedValue* value) const; |
519 | 520 |
520 bool page_scale_animation_active() const { return !!page_scale_animation_; } | 521 bool page_scale_animation_active() const { return !!page_scale_animation_; } |
521 | 522 |
522 virtual void CreateUIResource(UIResourceId uid, | 523 virtual void CreateUIResource(UIResourceId uid, |
523 const UIResourceBitmap& bitmap); | 524 const UIResourceBitmap& bitmap); |
524 // Deletes a UI resource. May safely be called more than once. | 525 // Deletes a UI resource. May safely be called more than once. |
525 virtual void DeleteUIResource(UIResourceId uid); | 526 virtual void DeleteUIResource(UIResourceId uid); |
526 void EvictAllUIResources(); | 527 void EvictAllUIResources(); |
527 bool EvictedUIResourcesExist() const; | 528 bool EvictedUIResourcesExist() const; |
528 | 529 |
529 virtual ResourceId ResourceIdForUIResource(UIResourceId uid) const; | 530 virtual ResourceId ResourceIdForUIResource(UIResourceId uid) const; |
530 | 531 |
531 virtual bool IsUIResourceOpaque(UIResourceId uid) const; | 532 virtual bool IsUIResourceOpaque(UIResourceId uid) const; |
532 | 533 |
533 struct UIResourceData { | 534 struct UIResourceData { |
534 ResourceId resource_id; | 535 ResourceId resource_id; |
535 gfx::Size size; | 536 gfx::Size size; |
536 bool opaque; | 537 bool opaque; |
537 }; | 538 }; |
538 | 539 |
539 // Returns the amount of delta that can be applied to scroll_node, taking | 540 // Returns the amount of delta that can be applied to scroll_node, taking |
540 // page scale into account. | 541 // page scale into account. |
541 gfx::Vector2dF ComputeScrollDelta(ScrollNode* scroll_node, | 542 gfx::Vector2dF ComputeScrollDelta(ScrollNode* scroll_node, |
542 const gfx::Vector2dF& delta); | 543 const gfx::Vector2dF& delta); |
543 | 544 |
544 void ScheduleMicroBenchmark(scoped_ptr<MicroBenchmarkImpl> benchmark); | 545 void ScheduleMicroBenchmark(std::unique_ptr<MicroBenchmarkImpl> benchmark); |
545 | 546 |
546 CompositorFrameMetadata MakeCompositorFrameMetadata() const; | 547 CompositorFrameMetadata MakeCompositorFrameMetadata() const; |
547 // Viewport rectangle and clip in nonflipped window space. These rects | 548 // Viewport rectangle and clip in nonflipped window space. These rects |
548 // should only be used by Renderer subclasses to populate glViewport/glClip | 549 // should only be used by Renderer subclasses to populate glViewport/glClip |
549 // and their software-mode equivalents. | 550 // and their software-mode equivalents. |
550 gfx::Rect DeviceViewport() const; | 551 gfx::Rect DeviceViewport() const; |
551 gfx::Rect DeviceClip() const; | 552 gfx::Rect DeviceClip() const; |
552 | 553 |
553 // When a SwapPromiseMonitor is created on the impl thread, it calls | 554 // When a SwapPromiseMonitor is created on the impl thread, it calls |
554 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. | 555 // InsertSwapPromiseMonitor() to register itself with LayerTreeHostImpl. |
555 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() | 556 // When the monitor is destroyed, it calls RemoveSwapPromiseMonitor() |
556 // to unregister itself. | 557 // to unregister itself. |
557 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 558 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
558 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); | 559 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor); |
559 | 560 |
560 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for | 561 // TODO(weiliangc): Replace RequiresHighResToDraw with scheduler waits for |
561 // ReadyToDraw. crbug.com/469175 | 562 // ReadyToDraw. crbug.com/469175 |
562 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } | 563 void SetRequiresHighResToDraw() { requires_high_res_to_draw_ = true; } |
563 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } | 564 void ResetRequiresHighResToDraw() { requires_high_res_to_draw_ = false; } |
564 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } | 565 bool RequiresHighResToDraw() const { return requires_high_res_to_draw_; } |
565 | 566 |
566 // Only valid for synchronous (non-scheduled) single-threaded case. | 567 // Only valid for synchronous (non-scheduled) single-threaded case. |
567 void SynchronouslyInitializeAllTiles(); | 568 void SynchronouslyInitializeAllTiles(); |
568 | 569 |
569 bool SupportsImplScrolling() const; | 570 bool SupportsImplScrolling() const; |
570 bool CommitToActiveTree() const; | 571 bool CommitToActiveTree() const; |
571 | 572 |
572 virtual void CreateResourceAndTileTaskWorkerPool( | 573 virtual void CreateResourceAndTileTaskWorkerPool( |
573 scoped_ptr<TileTaskWorkerPool>* tile_task_worker_pool, | 574 std::unique_ptr<TileTaskWorkerPool>* tile_task_worker_pool, |
574 scoped_ptr<ResourcePool>* resource_pool); | 575 std::unique_ptr<ResourcePool>* resource_pool); |
575 | 576 |
576 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } | 577 bool prepare_tiles_needed() const { return tile_priorities_dirty_; } |
577 | 578 |
578 FrameTimingTracker* frame_timing_tracker() { | 579 FrameTimingTracker* frame_timing_tracker() { |
579 return frame_timing_tracker_.get(); | 580 return frame_timing_tracker_.get(); |
580 } | 581 } |
581 | 582 |
582 gfx::Vector2dF ScrollSingleNode(ScrollNode* scroll_node, | 583 gfx::Vector2dF ScrollSingleNode(ScrollNode* scroll_node, |
583 const gfx::Vector2dF& delta, | 584 const gfx::Vector2dF& delta, |
584 const gfx::Point& viewport_point, | 585 const gfx::Point& viewport_point, |
(...skipping 14 matching lines...) Expand all Loading... |
599 // other completion, such as early out). Note that if there is a main frame | 600 // other completion, such as early out). Note that if there is a main frame |
600 // scheduled in that frame, then this BeginFrameArgs will become the main | 601 // scheduled in that frame, then this BeginFrameArgs will become the main |
601 // frame args. However, if no such frame is scheduled, then this _would_ be | 602 // frame args. However, if no such frame is scheduled, then this _would_ be |
602 // the main frame args if it was scheduled. | 603 // the main frame args if it was scheduled. |
603 void RecordMainFrameTiming( | 604 void RecordMainFrameTiming( |
604 const BeginFrameArgs& start_of_main_frame_args, | 605 const BeginFrameArgs& start_of_main_frame_args, |
605 const BeginFrameArgs& expected_next_main_frame_args); | 606 const BeginFrameArgs& expected_next_main_frame_args); |
606 | 607 |
607 // Post the given frame timing events to the requester. | 608 // Post the given frame timing events to the requester. |
608 void PostFrameTimingEvents( | 609 void PostFrameTimingEvents( |
609 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, | 610 std::unique_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, |
610 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); | 611 std::unique_ptr<FrameTimingTracker::MainFrameTimingSet> |
| 612 main_frame_events); |
611 | 613 |
612 base::SingleThreadTaskRunner* GetTaskRunner() const { | 614 base::SingleThreadTaskRunner* GetTaskRunner() const { |
613 DCHECK(task_runner_provider_); | 615 DCHECK(task_runner_provider_); |
614 return task_runner_provider_->HasImplThread() | 616 return task_runner_provider_->HasImplThread() |
615 ? task_runner_provider_->ImplThreadTaskRunner() | 617 ? task_runner_provider_->ImplThreadTaskRunner() |
616 : task_runner_provider_->MainThreadTaskRunner(); | 618 : task_runner_provider_->MainThreadTaskRunner(); |
617 } | 619 } |
618 | 620 |
619 InputHandler::ScrollStatus TryScroll(const gfx::PointF& screen_space_point, | 621 InputHandler::ScrollStatus TryScroll(const gfx::PointF& screen_space_point, |
620 InputHandler::ScrollInputType type, | 622 InputHandler::ScrollInputType type, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; | 732 using UIResourceMap = std::unordered_map<UIResourceId, UIResourceData>; |
731 UIResourceMap ui_resource_map_; | 733 UIResourceMap ui_resource_map_; |
732 | 734 |
733 // Resources that were evicted by EvictAllUIResources. Resources are removed | 735 // Resources that were evicted by EvictAllUIResources. Resources are removed |
734 // from this when they are touched by a create or destroy from the UI resource | 736 // from this when they are touched by a create or destroy from the UI resource |
735 // request queue. | 737 // request queue. |
736 std::set<UIResourceId> evicted_ui_resources_; | 738 std::set<UIResourceId> evicted_ui_resources_; |
737 | 739 |
738 OutputSurface* output_surface_; | 740 OutputSurface* output_surface_; |
739 | 741 |
740 scoped_ptr<ResourceProvider> resource_provider_; | 742 std::unique_ptr<ResourceProvider> resource_provider_; |
741 bool content_is_suitable_for_gpu_rasterization_; | 743 bool content_is_suitable_for_gpu_rasterization_; |
742 bool has_gpu_rasterization_trigger_; | 744 bool has_gpu_rasterization_trigger_; |
743 bool use_gpu_rasterization_; | 745 bool use_gpu_rasterization_; |
744 bool use_msaa_; | 746 bool use_msaa_; |
745 GpuRasterizationStatus gpu_rasterization_status_; | 747 GpuRasterizationStatus gpu_rasterization_status_; |
746 bool tree_resources_for_gpu_rasterization_dirty_; | 748 bool tree_resources_for_gpu_rasterization_dirty_; |
747 scoped_ptr<TileTaskWorkerPool> tile_task_worker_pool_; | 749 std::unique_ptr<TileTaskWorkerPool> tile_task_worker_pool_; |
748 scoped_ptr<ResourcePool> resource_pool_; | 750 std::unique_ptr<ResourcePool> resource_pool_; |
749 scoped_ptr<Renderer> renderer_; | 751 std::unique_ptr<Renderer> renderer_; |
750 scoped_ptr<ImageDecodeController> image_decode_controller_; | 752 std::unique_ptr<ImageDecodeController> image_decode_controller_; |
751 | 753 |
752 GlobalStateThatImpactsTilePriority global_tile_state_; | 754 GlobalStateThatImpactsTilePriority global_tile_state_; |
753 | 755 |
754 // Tree currently being drawn. | 756 // Tree currently being drawn. |
755 scoped_ptr<LayerTreeImpl> active_tree_; | 757 std::unique_ptr<LayerTreeImpl> active_tree_; |
756 | 758 |
757 // In impl-side painting mode, tree with possibly incomplete rasterized | 759 // In impl-side painting mode, tree with possibly incomplete rasterized |
758 // content. May be promoted to active by ActivatePendingTree(). | 760 // content. May be promoted to active by ActivatePendingTree(). |
759 scoped_ptr<LayerTreeImpl> pending_tree_; | 761 std::unique_ptr<LayerTreeImpl> pending_tree_; |
760 | 762 |
761 // In impl-side painting mode, inert tree with layers that can be recycled | 763 // In impl-side painting mode, inert tree with layers that can be recycled |
762 // by the next sync from the main thread. | 764 // by the next sync from the main thread. |
763 scoped_ptr<LayerTreeImpl> recycle_tree_; | 765 std::unique_ptr<LayerTreeImpl> recycle_tree_; |
764 | 766 |
765 InputHandlerClient* input_handler_client_; | 767 InputHandlerClient* input_handler_client_; |
766 bool did_lock_scrolling_layer_; | 768 bool did_lock_scrolling_layer_; |
767 bool wheel_scrolling_; | 769 bool wheel_scrolling_; |
768 bool scroll_affects_scroll_handler_; | 770 bool scroll_affects_scroll_handler_; |
769 int scroll_layer_id_when_mouse_over_scrollbar_; | 771 int scroll_layer_id_when_mouse_over_scrollbar_; |
770 std::vector<scoped_ptr<SwapPromise>> | 772 std::vector<std::unique_ptr<SwapPromise>> |
771 swap_promises_for_main_thread_scroll_update_; | 773 swap_promises_for_main_thread_scroll_update_; |
772 | 774 |
773 // An object to implement the ScrollElasticityHelper interface and | 775 // An object to implement the ScrollElasticityHelper interface and |
774 // hold all state related to elasticity. May be NULL if never requested. | 776 // hold all state related to elasticity. May be NULL if never requested. |
775 scoped_ptr<ScrollElasticityHelper> scroll_elasticity_helper_; | 777 std::unique_ptr<ScrollElasticityHelper> scroll_elasticity_helper_; |
776 | 778 |
777 bool tile_priorities_dirty_; | 779 bool tile_priorities_dirty_; |
778 | 780 |
779 const LayerTreeSettings settings_; | 781 const LayerTreeSettings settings_; |
780 LayerTreeDebugState debug_state_; | 782 LayerTreeDebugState debug_state_; |
781 bool visible_; | 783 bool visible_; |
782 ManagedMemoryPolicy cached_managed_memory_policy_; | 784 ManagedMemoryPolicy cached_managed_memory_policy_; |
783 | 785 |
784 const bool is_synchronous_single_threaded_; | 786 const bool is_synchronous_single_threaded_; |
785 scoped_ptr<TileManager> tile_manager_; | 787 std::unique_ptr<TileManager> tile_manager_; |
786 | 788 |
787 gfx::Vector2dF accumulated_root_overscroll_; | 789 gfx::Vector2dF accumulated_root_overscroll_; |
788 | 790 |
789 bool pinch_gesture_active_; | 791 bool pinch_gesture_active_; |
790 bool pinch_gesture_end_should_clear_scrolling_layer_; | 792 bool pinch_gesture_end_should_clear_scrolling_layer_; |
791 | 793 |
792 scoped_ptr<TopControlsManager> top_controls_manager_; | 794 std::unique_ptr<TopControlsManager> top_controls_manager_; |
793 | 795 |
794 scoped_ptr<PageScaleAnimation> page_scale_animation_; | 796 std::unique_ptr<PageScaleAnimation> page_scale_animation_; |
795 | 797 |
796 scoped_ptr<FrameRateCounter> fps_counter_; | 798 std::unique_ptr<FrameRateCounter> fps_counter_; |
797 scoped_ptr<MemoryHistory> memory_history_; | 799 std::unique_ptr<MemoryHistory> memory_history_; |
798 scoped_ptr<DebugRectHistory> debug_rect_history_; | 800 std::unique_ptr<DebugRectHistory> debug_rect_history_; |
799 | 801 |
800 scoped_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; | 802 std::unique_ptr<TextureMailboxDeleter> texture_mailbox_deleter_; |
801 | 803 |
802 // The maximum memory that would be used by the prioritized resource | 804 // The maximum memory that would be used by the prioritized resource |
803 // manager, if there were no limit on memory usage. | 805 // manager, if there were no limit on memory usage. |
804 size_t max_memory_needed_bytes_; | 806 size_t max_memory_needed_bytes_; |
805 | 807 |
806 // Viewport size passed in from the main thread, in physical pixels. This | 808 // Viewport size passed in from the main thread, in physical pixels. This |
807 // value is the default size for all concepts of physical viewport (draw | 809 // value is the default size for all concepts of physical viewport (draw |
808 // viewport, scrolling viewport and device viewport), but it can be | 810 // viewport, scrolling viewport and device viewport), but it can be |
809 // overridden. | 811 // overridden. |
810 gfx::Size device_viewport_size_; | 812 gfx::Size device_viewport_size_; |
811 | 813 |
812 // Optional top-level constraints that can be set by the OutputSurface. | 814 // Optional top-level constraints that can be set by the OutputSurface. |
813 // - external_transform_ applies a transform above the root layer | 815 // - external_transform_ applies a transform above the root layer |
814 // - external_viewport_ is used DrawProperties, tile management and | 816 // - external_viewport_ is used DrawProperties, tile management and |
815 // glViewport/window projection matrix. | 817 // glViewport/window projection matrix. |
816 // - external_clip_ specifies a top-level clip rect | 818 // - external_clip_ specifies a top-level clip rect |
817 // - viewport_rect_for_tile_priority_ is the rect in view space used for | 819 // - viewport_rect_for_tile_priority_ is the rect in view space used for |
818 // tiling priority. | 820 // tiling priority. |
819 gfx::Transform external_transform_; | 821 gfx::Transform external_transform_; |
820 gfx::Rect external_viewport_; | 822 gfx::Rect external_viewport_; |
821 gfx::Rect external_clip_; | 823 gfx::Rect external_clip_; |
822 gfx::Rect viewport_rect_for_tile_priority_; | 824 gfx::Rect viewport_rect_for_tile_priority_; |
823 bool resourceless_software_draw_; | 825 bool resourceless_software_draw_; |
824 | 826 |
825 bool output_is_secure_; | 827 bool output_is_secure_; |
826 | 828 |
827 gfx::Rect viewport_damage_rect_; | 829 gfx::Rect viewport_damage_rect_; |
828 | 830 |
829 scoped_ptr<AnimationHost> animation_host_; | 831 std::unique_ptr<AnimationHost> animation_host_; |
830 std::set<VideoFrameController*> video_frame_controllers_; | 832 std::set<VideoFrameController*> video_frame_controllers_; |
831 | 833 |
832 // Map from scroll layer ID to scrollbar animation controller. | 834 // Map from scroll layer ID to scrollbar animation controller. |
833 // There is one animation controller per pair of overlay scrollbars. | 835 // There is one animation controller per pair of overlay scrollbars. |
834 std::unordered_map<int, scoped_ptr<ScrollbarAnimationController>> | 836 std::unordered_map<int, std::unique_ptr<ScrollbarAnimationController>> |
835 scrollbar_animation_controllers_; | 837 scrollbar_animation_controllers_; |
836 | 838 |
837 RenderingStatsInstrumentation* rendering_stats_instrumentation_; | 839 RenderingStatsInstrumentation* rendering_stats_instrumentation_; |
838 MicroBenchmarkControllerImpl micro_benchmark_controller_; | 840 MicroBenchmarkControllerImpl micro_benchmark_controller_; |
839 scoped_ptr<SynchronousTaskGraphRunner> | 841 std::unique_ptr<SynchronousTaskGraphRunner> |
840 single_thread_synchronous_task_graph_runner_; | 842 single_thread_synchronous_task_graph_runner_; |
841 | 843 |
842 // Optional callback to notify of new tree activations. | 844 // Optional callback to notify of new tree activations. |
843 base::Closure tree_activation_callback_; | 845 base::Closure tree_activation_callback_; |
844 | 846 |
845 SharedBitmapManager* shared_bitmap_manager_; | 847 SharedBitmapManager* shared_bitmap_manager_; |
846 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 848 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
847 TaskGraphRunner* task_graph_runner_; | 849 TaskGraphRunner* task_graph_runner_; |
848 int id_; | 850 int id_; |
849 | 851 |
850 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 852 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
851 | 853 |
852 bool requires_high_res_to_draw_; | 854 bool requires_high_res_to_draw_; |
853 bool is_likely_to_require_a_draw_; | 855 bool is_likely_to_require_a_draw_; |
854 | 856 |
855 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; | 857 std::unique_ptr<FrameTimingTracker> frame_timing_tracker_; |
856 | 858 |
857 scoped_ptr<Viewport> viewport_; | 859 std::unique_ptr<Viewport> viewport_; |
858 | 860 |
859 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 861 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
860 }; | 862 }; |
861 | 863 |
862 } // namespace cc | 864 } // namespace cc |
863 | 865 |
864 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 866 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |