Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: cc/trees/layer_tree_host_impl.h

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Very minor fixes. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 #include "cc/input/top_controls_manager_client.h" 24 #include "cc/input/top_controls_manager_client.h"
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/begin_frame_source.h"
34 #include "cc/scheduler/draw_result.h" 35 #include "cc/scheduler/draw_result.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;
(...skipping 22 matching lines...) Expand all
66 class LayerTreeHostImplClient { 67 class LayerTreeHostImplClient {
67 public: 68 public:
68 virtual void UpdateRendererCapabilitiesOnImplThread() = 0; 69 virtual void UpdateRendererCapabilitiesOnImplThread() = 0;
69 virtual void DidLoseOutputSurfaceOnImplThread() = 0; 70 virtual void DidLoseOutputSurfaceOnImplThread() = 0;
70 virtual void CommitVSyncParameters(base::TimeTicks timebase, 71 virtual void CommitVSyncParameters(base::TimeTicks timebase,
71 base::TimeDelta interval) = 0; 72 base::TimeDelta interval) = 0;
72 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0; 73 virtual void SetEstimatedParentDrawTime(base::TimeDelta draw_time) = 0;
73 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0; 74 virtual void SetMaxSwapsPendingOnImplThread(int max) = 0;
74 virtual void DidSwapBuffersOnImplThread() = 0; 75 virtual void DidSwapBuffersOnImplThread() = 0;
75 virtual void DidSwapBuffersCompleteOnImplThread() = 0; 76 virtual void DidSwapBuffersCompleteOnImplThread() = 0;
76 virtual void BeginFrame(const BeginFrameArgs& args) = 0;
77 virtual void OnCanDrawStateChanged(bool can_draw) = 0; 77 virtual void OnCanDrawStateChanged(bool can_draw) = 0;
78 virtual void NotifyReadyToActivate() = 0; 78 virtual void NotifyReadyToActivate() = 0;
79 // Please call these 3 functions through 79 // Please call these 3 functions through
80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and 80 // LayerTreeHostImpl's SetNeedsRedraw(), SetNeedsRedrawRect() and
81 // SetNeedsAnimate(). 81 // SetNeedsAnimate().
82 virtual void SetNeedsRedrawOnImplThread() = 0; 82 virtual void SetNeedsRedrawOnImplThread() = 0;
83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0; 83 virtual void SetNeedsRedrawRectOnImplThread(const gfx::Rect& damage_rect) = 0;
84 virtual void SetNeedsAnimateOnImplThread() = 0; 84 virtual void SetNeedsAnimateOnImplThread() = 0;
85 virtual void DidInitializeVisibleTileOnImplThread() = 0; 85 virtual void DidInitializeVisibleTileOnImplThread() = 0;
86 virtual void SetNeedsCommitOnImplThread() = 0; 86 virtual void SetNeedsCommitOnImplThread() = 0;
(...skipping 18 matching lines...) Expand all
105 105
106 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering 106 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
107 // state. 107 // state.
108 class CC_EXPORT LayerTreeHostImpl 108 class CC_EXPORT LayerTreeHostImpl
109 : public InputHandler, 109 : public InputHandler,
110 public RendererClient, 110 public RendererClient,
111 public TileManagerClient, 111 public TileManagerClient,
112 public OutputSurfaceClient, 112 public OutputSurfaceClient,
113 public TopControlsManagerClient, 113 public TopControlsManagerClient,
114 public ScrollbarAnimationControllerClient, 114 public ScrollbarAnimationControllerClient,
115 public BeginFrameSourceMixIn,
115 public base::SupportsWeakPtr<LayerTreeHostImpl> { 116 public base::SupportsWeakPtr<LayerTreeHostImpl> {
116 public: 117 public:
117 static scoped_ptr<LayerTreeHostImpl> Create( 118 static scoped_ptr<LayerTreeHostImpl> Create(
118 const LayerTreeSettings& settings, 119 const LayerTreeSettings& settings,
119 LayerTreeHostImplClient* client, 120 LayerTreeHostImplClient* client,
120 Proxy* proxy, 121 Proxy* proxy,
121 RenderingStatsInstrumentation* rendering_stats_instrumentation, 122 RenderingStatsInstrumentation* rendering_stats_instrumentation,
122 SharedBitmapManager* manager, 123 SharedBitmapManager* manager,
123 int id); 124 int id);
124 virtual ~LayerTreeHostImpl(); 125 virtual ~LayerTreeHostImpl();
125 126
127 // BeginFrameSourceMixIn implementation
128 virtual void OnNeedsBeginFramesChange(bool needs_begin_frames) OVERRIDE;
129
126 // InputHandler implementation 130 // InputHandler implementation
127 virtual void BindToClient(InputHandlerClient* client) OVERRIDE; 131 virtual void BindToClient(InputHandlerClient* client) OVERRIDE;
128 virtual InputHandler::ScrollStatus ScrollBegin( 132 virtual InputHandler::ScrollStatus ScrollBegin(
129 const gfx::Point& viewport_point, 133 const gfx::Point& viewport_point,
130 InputHandler::ScrollInputType type) OVERRIDE; 134 InputHandler::ScrollInputType type) OVERRIDE;
131 virtual InputHandler::ScrollStatus ScrollAnimated( 135 virtual InputHandler::ScrollStatus ScrollAnimated(
132 const gfx::Point& viewport_point, 136 const gfx::Point& viewport_point,
133 const gfx::Vector2dF& scroll_delta) OVERRIDE; 137 const gfx::Vector2dF& scroll_delta) OVERRIDE;
134 virtual bool ScrollBy(const gfx::Point& viewport_point, 138 virtual bool ScrollBy(const gfx::Point& viewport_point,
135 const gfx::Vector2dF& scroll_delta) OVERRIDE; 139 const gfx::Vector2dF& scroll_delta) OVERRIDE;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 void SetUseGpuRasterization(bool use_gpu); 293 void SetUseGpuRasterization(bool use_gpu);
290 bool use_gpu_rasterization() const { return use_gpu_rasterization_; } 294 bool use_gpu_rasterization() const { return use_gpu_rasterization_; }
291 bool create_low_res_tiling() const { 295 bool create_low_res_tiling() const {
292 return settings_.create_low_res_tiling && !use_gpu_rasterization_; 296 return settings_.create_low_res_tiling && !use_gpu_rasterization_;
293 } 297 }
294 ResourcePool* resource_pool() { return resource_pool_.get(); } 298 ResourcePool* resource_pool() { return resource_pool_.get(); }
295 Renderer* renderer() { return renderer_.get(); } 299 Renderer* renderer() { return renderer_.get(); }
296 const RendererCapabilitiesImpl& GetRendererCapabilities() const; 300 const RendererCapabilitiesImpl& GetRendererCapabilities() const;
297 301
298 virtual bool SwapBuffers(const FrameData& frame); 302 virtual bool SwapBuffers(const FrameData& frame);
299 void SetNeedsBeginFrame(bool enable);
300 virtual void WillBeginImplFrame(const BeginFrameArgs& args); 303 virtual void WillBeginImplFrame(const BeginFrameArgs& args);
301 void DidModifyTilePriorities(); 304 void DidModifyTilePriorities();
302 305
303 LayerTreeImpl* active_tree() { return active_tree_.get(); } 306 LayerTreeImpl* active_tree() { return active_tree_.get(); }
304 const LayerTreeImpl* active_tree() const { return active_tree_.get(); } 307 const LayerTreeImpl* active_tree() const { return active_tree_.get(); }
305 LayerTreeImpl* pending_tree() { return pending_tree_.get(); } 308 LayerTreeImpl* pending_tree() { return pending_tree_.get(); }
306 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); } 309 const LayerTreeImpl* pending_tree() const { return pending_tree_.get(); }
307 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); } 310 LayerTreeImpl* recycle_tree() { return recycle_tree_.get(); }
308 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); } 311 const LayerTreeImpl* recycle_tree() const { return recycle_tree_.get(); }
309 // Returns the tree LTH synchronizes with. 312 // Returns the tree LTH synchronizes with.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 424
422 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args); 425 void UpdateCurrentBeginFrameArgs(const BeginFrameArgs& args);
423 void ResetCurrentBeginFrameArgsForNextFrame(); 426 void ResetCurrentBeginFrameArgsForNextFrame();
424 virtual BeginFrameArgs CurrentBeginFrameArgs() const; 427 virtual BeginFrameArgs CurrentBeginFrameArgs() const;
425 428
426 // Expected time between two begin impl frame calls. 429 // Expected time between two begin impl frame calls.
427 base::TimeDelta begin_impl_frame_interval() const { 430 base::TimeDelta begin_impl_frame_interval() const {
428 return begin_impl_frame_interval_; 431 return begin_impl_frame_interval_;
429 } 432 }
430 433
431 void AsValueInto(base::debug::TracedValue* value) const { 434 virtual void AsValueInto(base::debug::TracedValue* value) const OVERRIDE;
432 return AsValueWithFrameInto(NULL, value);
433 }
434 void AsValueWithFrameInto(FrameData* frame, 435 void AsValueWithFrameInto(FrameData* frame,
435 base::debug::TracedValue* value) const; 436 base::debug::TracedValue* value) const;
436 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const; 437 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValue() const;
437 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame( 438 scoped_refptr<base::debug::ConvertableToTraceFormat> AsValueWithFrame(
438 FrameData* frame) const; 439 FrameData* frame) const;
439 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue() 440 scoped_refptr<base::debug::ConvertableToTraceFormat> ActivationStateAsValue()
440 const; 441 const;
441 void ActivationStateAsValueInto(base::debug::TracedValue* value) const; 442 void ActivationStateAsValueInto(base::debug::TracedValue* value) const;
442 443
443 bool page_scale_animation_active() const { return !!page_scale_animation_; } 444 bool page_scale_animation_active() const { return !!page_scale_animation_; }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 706
706 std::vector<PictureLayerImpl*> picture_layers_; 707 std::vector<PictureLayerImpl*> picture_layers_;
707 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_; 708 std::vector<PictureLayerImpl::Pair> picture_layer_pairs_;
708 709
709 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 710 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
710 }; 711 };
711 712
712 } // namespace cc 713 } // namespace cc
713 714
714 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 715 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698