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

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

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/time/time.h" 17 #include "base/time/time.h"
18 #include "cc/animation/animation_events.h" 18 #include "cc/animation/animation_events.h"
19 #include "cc/animation/animation_registrar.h" 19 #include "cc/animation/animation_registrar.h"
20 #include "cc/animation/layer_tree_mutator.h"
20 #include "cc/animation/scrollbar_animation_controller.h" 21 #include "cc/animation/scrollbar_animation_controller.h"
21 #include "cc/base/cc_export.h" 22 #include "cc/base/cc_export.h"
22 #include "cc/base/synced_property.h" 23 #include "cc/base/synced_property.h"
23 #include "cc/debug/frame_timing_tracker.h" 24 #include "cc/debug/frame_timing_tracker.h"
24 #include "cc/debug/micro_benchmark_controller_impl.h" 25 #include "cc/debug/micro_benchmark_controller_impl.h"
25 #include "cc/input/input_handler.h" 26 #include "cc/input/input_handler.h"
26 #include "cc/input/top_controls_manager_client.h" 27 #include "cc/input/top_controls_manager_client.h"
27 #include "cc/layers/layer_lists.h" 28 #include "cc/layers/layer_lists.h"
28 #include "cc/layers/render_pass_sink.h" 29 #include "cc/layers/render_pass_sink.h"
29 #include "cc/output/begin_frame_args.h" 30 #include "cc/output/begin_frame_args.h"
30 #include "cc/output/managed_memory_policy.h" 31 #include "cc/output/managed_memory_policy.h"
31 #include "cc/output/output_surface_client.h" 32 #include "cc/output/output_surface_client.h"
32 #include "cc/output/renderer.h" 33 #include "cc/output/renderer.h"
33 #include "cc/quads/render_pass.h" 34 #include "cc/quads/render_pass.h"
34 #include "cc/resources/resource_provider.h" 35 #include "cc/resources/resource_provider.h"
35 #include "cc/resources/ui_resource_client.h" 36 #include "cc/resources/ui_resource_client.h"
36 #include "cc/scheduler/begin_frame_tracker.h" 37 #include "cc/scheduler/begin_frame_tracker.h"
37 #include "cc/scheduler/commit_earlyout_reason.h" 38 #include "cc/scheduler/commit_earlyout_reason.h"
38 #include "cc/scheduler/draw_result.h" 39 #include "cc/scheduler/draw_result.h"
39 #include "cc/scheduler/video_frame_controller.h" 40 #include "cc/scheduler/video_frame_controller.h"
40 #include "cc/tiles/tile_manager.h" 41 #include "cc/tiles/tile_manager.h"
42 #include "cc/trees/layer_tree_host_common.h"
41 #include "cc/trees/layer_tree_settings.h" 43 #include "cc/trees/layer_tree_settings.h"
42 #include "cc/trees/mutator_host_client.h" 44 #include "cc/trees/mutator_host_client.h"
43 #include "cc/trees/task_runner_provider.h" 45 #include "cc/trees/task_runner_provider.h"
44 #include "skia/ext/refptr.h" 46 #include "skia/ext/refptr.h"
45 #include "third_party/skia/include/core/SkColor.h" 47 #include "third_party/skia/include/core/SkColor.h"
46 #include "ui/gfx/geometry/rect.h" 48 #include "ui/gfx/geometry/rect.h"
47 49
48 namespace gfx { 50 namespace gfx {
49 class ScrollOffset; 51 class ScrollOffset;
50 } 52 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering 139 // LayerTreeHostImpl owns the LayerImpl trees as well as associated rendering
138 // state. 140 // state.
139 class CC_EXPORT LayerTreeHostImpl 141 class CC_EXPORT LayerTreeHostImpl
140 : public InputHandler, 142 : public InputHandler,
141 public RendererClient, 143 public RendererClient,
142 public TileManagerClient, 144 public TileManagerClient,
143 public OutputSurfaceClient, 145 public OutputSurfaceClient,
144 public TopControlsManagerClient, 146 public TopControlsManagerClient,
145 public ScrollbarAnimationControllerClient, 147 public ScrollbarAnimationControllerClient,
146 public VideoFrameControllerClient, 148 public VideoFrameControllerClient,
149 public LayerTreeMutatorClient,
147 public MutatorHostClient, 150 public MutatorHostClient,
148 public base::SupportsWeakPtr<LayerTreeHostImpl> { 151 public base::SupportsWeakPtr<LayerTreeHostImpl> {
149 public: 152 public:
150 static scoped_ptr<LayerTreeHostImpl> Create( 153 static scoped_ptr<LayerTreeHostImpl> Create(
151 const LayerTreeSettings& settings, 154 const LayerTreeSettings& settings,
152 LayerTreeHostImplClient* client, 155 LayerTreeHostImplClient* client,
153 TaskRunnerProvider* task_runner_provider, 156 TaskRunnerProvider* task_runner_provider,
154 RenderingStatsInstrumentation* rendering_stats_instrumentation, 157 RenderingStatsInstrumentation* rendering_stats_instrumentation,
155 SharedBitmapManager* shared_bitmap_manager, 158 SharedBitmapManager* shared_bitmap_manager,
156 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 159 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; 228 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
226 229
227 private: 230 private:
228 DISALLOW_COPY_AND_ASSIGN(FrameData); 231 DISALLOW_COPY_AND_ASSIGN(FrameData);
229 }; 232 };
230 233
231 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); 234 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason);
232 virtual void BeginCommit(); 235 virtual void BeginCommit();
233 virtual void CommitComplete(); 236 virtual void CommitComplete();
234 virtual void UpdateAnimationState(bool start_ready_animations); 237 virtual void UpdateAnimationState(bool start_ready_animations);
238 bool Mutate(base::TimeTicks monotinic_time);
235 void ActivateAnimations(); 239 void ActivateAnimations();
236 void Animate(); 240 void Animate();
237 void AnimatePendingTreeAfterCommit(); 241 void AnimatePendingTreeAfterCommit();
238 void MainThreadHasStoppedFlinging(); 242 void MainThreadHasStoppedFlinging();
239 void DidAnimateScrollOffset(); 243 void DidAnimateScrollOffset();
240 void SetViewportDamage(const gfx::Rect& damage_rect); 244 void SetViewportDamage(const gfx::Rect& damage_rect);
241 245
242 void SetTreeLayerFilterMutated(int layer_id, 246 void SetTreeLayerFilterMutated(int layer_id,
243 LayerTreeImpl* tree, 247 LayerTreeImpl* tree,
244 const FilterOperations& filters); 248 const FilterOperations& filters);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 void DidSwapBuffers() override; 360 void DidSwapBuffers() override;
357 void DidSwapBuffersComplete() override; 361 void DidSwapBuffersComplete() override;
358 void ReclaimResources(const CompositorFrameAck* ack) override; 362 void ReclaimResources(const CompositorFrameAck* ack) override;
359 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; 363 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
360 void SetTreeActivationCallback(const base::Closure& callback) override; 364 void SetTreeActivationCallback(const base::Closure& callback) override;
361 void OnDraw(const gfx::Transform& transform, 365 void OnDraw(const gfx::Transform& transform,
362 const gfx::Rect& viewport, 366 const gfx::Rect& viewport,
363 const gfx::Rect& clip, 367 const gfx::Rect& clip,
364 bool resourceless_software_draw) override; 368 bool resourceless_software_draw) override;
365 369
370 // LayerTreeMutatorClient.
371 void SetNeedsMutate() override;
372
366 // Called from LayerTreeImpl. 373 // Called from LayerTreeImpl.
367 void OnCanDrawStateChangedForTree(); 374 void OnCanDrawStateChangedForTree();
368 375
369 // Implementation. 376 // Implementation.
370 int id() const { return id_; } 377 int id() const { return id_; }
371 bool CanDraw() const; 378 bool CanDraw() const;
372 OutputSurface* output_surface() const { return output_surface_; } 379 OutputSurface* output_surface() const { return output_surface_; }
373 void ReleaseOutputSurface(); 380 void ReleaseOutputSurface();
374 381
375 std::string LayerTreeAsJson() const; 382 std::string LayerTreeAsJson() const;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // the main frame args if it was scheduled. 596 // the main frame args if it was scheduled.
590 void RecordMainFrameTiming( 597 void RecordMainFrameTiming(
591 const BeginFrameArgs& start_of_main_frame_args, 598 const BeginFrameArgs& start_of_main_frame_args,
592 const BeginFrameArgs& expected_next_main_frame_args); 599 const BeginFrameArgs& expected_next_main_frame_args);
593 600
594 // Post the given frame timing events to the requester. 601 // Post the given frame timing events to the requester.
595 void PostFrameTimingEvents( 602 void PostFrameTimingEvents(
596 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 603 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
597 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); 604 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events);
598 605
606 void SetLayerTreeMutator(LayerTreeMutator* mutator);
607 LayerTreeMutator* mutator() { return mutator_; }
608
599 base::SingleThreadTaskRunner* GetTaskRunner() const { 609 base::SingleThreadTaskRunner* GetTaskRunner() const {
600 DCHECK(task_runner_provider_); 610 DCHECK(task_runner_provider_);
601 return task_runner_provider_->HasImplThread() 611 return task_runner_provider_->HasImplThread()
602 ? task_runner_provider_->ImplThreadTaskRunner() 612 ? task_runner_provider_->ImplThreadTaskRunner()
603 : task_runner_provider_->MainThreadTaskRunner(); 613 : task_runner_provider_->MainThreadTaskRunner();
604 } 614 }
605 615
606 protected: 616 protected:
607 LayerTreeHostImpl( 617 LayerTreeHostImpl(
608 const LayerTreeSettings& settings, 618 const LayerTreeSettings& settings,
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 MicroBenchmarkControllerImpl micro_benchmark_controller_; 822 MicroBenchmarkControllerImpl micro_benchmark_controller_;
813 scoped_ptr<SynchronousTaskGraphRunner> 823 scoped_ptr<SynchronousTaskGraphRunner>
814 single_thread_synchronous_task_graph_runner_; 824 single_thread_synchronous_task_graph_runner_;
815 825
816 // Optional callback to notify of new tree activations. 826 // Optional callback to notify of new tree activations.
817 base::Closure tree_activation_callback_; 827 base::Closure tree_activation_callback_;
818 828
819 SharedBitmapManager* shared_bitmap_manager_; 829 SharedBitmapManager* shared_bitmap_manager_;
820 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 830 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
821 TaskGraphRunner* task_graph_runner_; 831 TaskGraphRunner* task_graph_runner_;
832 LayerTreeMutator* mutator_;
822 int id_; 833 int id_;
823 834
824 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 835 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
825 836
837 bool is_scrolling_;
838
826 bool requires_high_res_to_draw_; 839 bool requires_high_res_to_draw_;
827 bool is_likely_to_require_a_draw_; 840 bool is_likely_to_require_a_draw_;
828 841
829 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; 842 scoped_ptr<FrameTimingTracker> frame_timing_tracker_;
830 843
831 scoped_ptr<Viewport> viewport_; 844 scoped_ptr<Viewport> viewport_;
832 845
833 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 846 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
834 }; 847 };
835 848
836 } // namespace cc 849 } // namespace cc
837 850
838 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 851 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698