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 <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "cc/layers/layer_lists.h" | 25 #include "cc/layers/layer_lists.h" |
26 #include "cc/layers/render_pass_sink.h" | 26 #include "cc/layers/render_pass_sink.h" |
27 #include "cc/output/begin_frame_args.h" | 27 #include "cc/output/begin_frame_args.h" |
28 #include "cc/output/managed_memory_policy.h" | 28 #include "cc/output/managed_memory_policy.h" |
29 #include "cc/output/output_surface_client.h" | 29 #include "cc/output/output_surface_client.h" |
30 #include "cc/output/renderer.h" | 30 #include "cc/output/renderer.h" |
31 #include "cc/quads/render_pass.h" | 31 #include "cc/quads/render_pass.h" |
32 #include "cc/resources/resource_provider.h" | 32 #include "cc/resources/resource_provider.h" |
33 #include "cc/resources/tile_manager.h" | 33 #include "cc/resources/tile_manager.h" |
34 #include "cc/scheduler/draw_result.h" | 34 #include "cc/scheduler/draw_result.h" |
35 #include "cc/scheduler/frame_source.h" | |
35 #include "skia/ext/refptr.h" | 36 #include "skia/ext/refptr.h" |
36 #include "third_party/skia/include/core/SkColor.h" | 37 #include "third_party/skia/include/core/SkColor.h" |
37 #include "ui/gfx/rect.h" | 38 #include "ui/gfx/rect.h" |
38 | 39 |
39 namespace cc { | 40 namespace cc { |
40 | 41 |
41 class CompletionEvent; | 42 class CompletionEvent; |
42 class CompositorFrameMetadata; | 43 class CompositorFrameMetadata; |
43 class DebugRectHistory; | 44 class DebugRectHistory; |
44 class FrameRateCounter; | 45 class FrameRateCounter; |
(...skipping 18 matching lines...) Expand all Loading... | |
63 class LayerTreeHostImplClient { | 64 class LayerTreeHostImplClient { |
64 public: | 65 public: |
65 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; | 66 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; |
66 virtual void DidLoseOutputSurfaceOnImplThread() = 0; | 67 virtual void DidLoseOutputSurfaceOnImplThread() = 0; |
67 virtual void CommitVSyncParameters(base::TimeTicks timebase, | 68 virtual void CommitVSyncParameters(base::TimeTicks timebase, |
68 base::TimeDelta interval) = 0; | 69 base::TimeDelta interval) = 0; |
69 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; | 70 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; |
70 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; | 71 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; |
71 virtual void DidSwapBuffersOnImplThread() = 0; | 72 virtual void DidSwapBuffersOnImplThread() = 0; |
72 virtual void DidSwapBuffersCompleteOnImplThread() = 0; | 73 virtual void DidSwapBuffersCompleteOnImplThread() = 0; |
73 virtual void BeginFrame(const BeginFrameArgs& args) = 0; | |
74 virtual void OnCanDrawStateChanged(bool can_draw) = 0; | 74 virtual void OnCanDrawStateChanged(bool can_draw) = 0; |
75 virtual void NotifyReadyToActivate() = 0; | 75 virtual void NotifyReadyToActivate() = 0; |
76 // Please call these 3 functions through | 76 // Please call these 3 functions through |
77 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and | 77 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and |
78 // SetNeedsAnimate(). | 78 // SetNeedsAnimate(). |
79 virtual void SetNeedsRedrawOnImplThread() = 0; | 79 virtual void SetNeedsRedrawOnImplThread() = 0; |
80 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; | 80 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; |
81 virtual void SetNeedsAnimateOnImplThread() = 0; | 81 virtual void SetNeedsAnimateOnImplThread() = 0; |
82 virtual void DidInitializeVisibleTileOnImplThread() = 0; | 82 virtual void DidInitializeVisibleTileOnImplThread() = 0; |
83 virtual void SetNeedsCommitOnImplThread() = 0; | 83 virtual void SetNeedsCommitOnImplThread() = 0; |
(...skipping 19 matching lines...) Expand all Loading... | |
103 | 103 |
104 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering | 104 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering |
105 // state. | 105 // state. |
106 class CC_EXPORT LayerTreeHostImpl | 106 class CC_EXPORT LayerTreeHostImpl |
107 : public InputHandler, | 107 : public InputHandler, |
108 public RendererClient, | 108 public RendererClient, |
109 public TileManagerClient, | 109 public TileManagerClient, |
110 public OutputSurfaceClient, | 110 public OutputSurfaceClient, |
111 public TopControlsManagerClient, | 111 public TopControlsManagerClient, |
112 public ScrollbarAnimationControllerClient, | 112 public ScrollbarAnimationControllerClient, |
113 public BaseBeginFrameSource, | |
brianderson
2014/06/17 06:24:43
How difficult would it be to make OutputSurface in
| |
113 public base::SupportsWeakPtr<LayerTreeHostImpl> { | 114 public base::SupportsWeakPtr<LayerTreeHostImpl> { |
114 public: | 115 public: |
115 static scoped_ptr<LayerTreeHostImpl> Create( | 116 static scoped_ptr<LayerTreeHostImpl> Create( |
116 const LayerTreeSettings& settings, | 117 const LayerTreeSettings& settings, |
117 LayerTreeHostImplClient* client, | 118 LayerTreeHostImplClient* client, |
118 Proxy* proxy, | 119 Proxy* proxy, |
119 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 120 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
120 SharedBitmapManager* manager, | 121 SharedBitmapManager* manager, |
121 int id); | 122 int id); |
122 virtual ~LayerTreeHostImpl(); | 123 virtual ~LayerTreeHostImpl(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 const gfx::Rect& clip, | 253 const gfx::Rect& clip, |
253 bool valid_for_tile_management) OVERRIDE; | 254 bool valid_for_tile_management) OVERRIDE; |
254 virtual void DidLoseOutputSurface() OVERRIDE; | 255 virtual void DidLoseOutputSurface() OVERRIDE; |
255 virtual void DidSwapBuffers() OVERRIDE; | 256 virtual void DidSwapBuffers() OVERRIDE; |
256 virtual void DidSwapBuffersComplete() OVERRIDE; | 257 virtual void DidSwapBuffersComplete() OVERRIDE; |
257 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE; | 258 virtual void ReclaimResources(const CompositorFrameAck* ack) OVERRIDE; |
258 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; | 259 virtual void SetMemoryPolicy(const ManagedMemoryPolicy& policy) OVERRIDE; |
259 virtual void SetTreeActivationCallback(const base::Closure& callback) | 260 virtual void SetTreeActivationCallback(const base::Closure& callback) |
260 OVERRIDE; | 261 OVERRIDE; |
261 | 262 |
263 // BeginFrameSource implementation. | |
264 virtual void OnGenerateChange(bool generate_frames) OVERRIDE; | |
265 virtual std::string TypeString() const OVERRIDE; | |
266 | |
262 // Called from LayerTreeImpl. | 267 // Called from LayerTreeImpl. |
263 void OnCanDrawStateChangedForTree(); | 268 void OnCanDrawStateChangedForTree(); |
264 | 269 |
265 // Implementation. | 270 // Implementation. |
266 bool CanDraw() const; | 271 bool CanDraw() const; |
267 OutputSurface* output_surface() const { return output_surface_.get(); } | 272 OutputSurface* output_surface() const { return output_surface_.get(); } |
268 | 273 |
269 std::string LayerTreeAsJson() const; | 274 std::string LayerTreeAsJson() const; |
270 | 275 |
271 void FinishAllRendering(); | 276 void FinishAllRendering(); |
272 int SourceAnimationFrameNumber() const; | 277 int SourceAnimationFrameNumber() const; |
273 | 278 |
274 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); | 279 virtual bool InitializeRenderer(scoped_ptr<OutputSurface> output_surface); |
275 bool IsContextLost(); | 280 bool IsContextLost(); |
276 TileManager* tile_manager() { return tile_manager_.get(); } | 281 TileManager* tile_manager() { return tile_manager_.get(); } |
277 void SetUseGpuRasterization(bool use_gpu); | 282 void SetUseGpuRasterization(bool use_gpu); |
278 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } | 283 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } |
279 bool create_low_res_tiling() const { | 284 bool create_low_res_tiling() const { |
280 return settings_.create_low_res_tiling && !use_gpu_rasterization_; | 285 return settings_.create_low_res_tiling && !use_gpu_rasterization_; |
281 } | 286 } |
282 ResourcePool* resource_pool() { return resource_pool_.get(); } | 287 ResourcePool* resource_pool() { return resource_pool_.get(); } |
283 Renderer* renderer() { return renderer_.get(); } | 288 Renderer* renderer() { return renderer_.get(); } |
284 const RendererCapabilitiesImpl& GetRendererCapabilities() const; | 289 const RendererCapabilitiesImpl& GetRendererCapabilities() const; |
285 | 290 |
286 virtual bool SwapBuffers(const FrameData& frame); | 291 virtual bool SwapBuffers(const FrameData& frame); |
287 void SetNeedsBeginFrame(bool enable); | |
288 virtual void WillBeginImplFrame(const BeginFrameArgs& args); | 292 virtual void WillBeginImplFrame(const BeginFrameArgs& args); |
289 void DidModifyTilePriorities(); | 293 void DidModifyTilePriorities(); |
290 | 294 |
291 LayerTreeImpl* active_tree() { return active_tree_.get(); } | 295 LayerTreeImpl* active_tree() { return active_tree_.get(); } |
292 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } | 296 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } |
293 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } | 297 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } |
294 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } | 298 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } |
295 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } | 299 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } |
296 virtual void CreatePendingTree(); | 300 virtual void CreatePendingTree(); |
297 virtual void UpdateVisibleTiles(); | 301 virtual void UpdateVisibleTiles(); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
681 std::set<SwapPromiseMonitor*> swap_promise_monitor_; | 685 std::set<SwapPromiseMonitor*> swap_promise_monitor_; |
682 | 686 |
683 size_t transfer_buffer_memory_limit_; | 687 size_t transfer_buffer_memory_limit_; |
684 | 688 |
685 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); | 689 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); |
686 }; | 690 }; |
687 | 691 |
688 } // namespace cc | 692 } // namespace cc |
689 | 693 |
690 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ | 694 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ |
OLD | NEW |