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

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 4 years, 11 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
« 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_registrar.h" 18 #include "cc/animation/animation_registrar.h"
19 #include "cc/animation/layer_tree_mutator.h"
19 #include "cc/animation/scrollbar_animation_controller.h" 20 #include "cc/animation/scrollbar_animation_controller.h"
20 #include "cc/base/cc_export.h" 21 #include "cc/base/cc_export.h"
21 #include "cc/base/synced_property.h" 22 #include "cc/base/synced_property.h"
22 #include "cc/debug/frame_timing_tracker.h" 23 #include "cc/debug/frame_timing_tracker.h"
23 #include "cc/debug/micro_benchmark_controller_impl.h" 24 #include "cc/debug/micro_benchmark_controller_impl.h"
24 #include "cc/input/input_handler.h" 25 #include "cc/input/input_handler.h"
25 #include "cc/input/top_controls_manager_client.h" 26 #include "cc/input/top_controls_manager_client.h"
26 #include "cc/layers/layer_lists.h" 27 #include "cc/layers/layer_lists.h"
27 #include "cc/layers/render_pass_sink.h" 28 #include "cc/layers/render_pass_sink.h"
28 #include "cc/output/begin_frame_args.h" 29 #include "cc/output/begin_frame_args.h"
29 #include "cc/output/managed_memory_policy.h" 30 #include "cc/output/managed_memory_policy.h"
30 #include "cc/output/output_surface_client.h" 31 #include "cc/output/output_surface_client.h"
31 #include "cc/output/renderer.h" 32 #include "cc/output/renderer.h"
32 #include "cc/quads/render_pass.h" 33 #include "cc/quads/render_pass.h"
33 #include "cc/resources/resource_provider.h" 34 #include "cc/resources/resource_provider.h"
34 #include "cc/resources/ui_resource_client.h" 35 #include "cc/resources/ui_resource_client.h"
35 #include "cc/scheduler/begin_frame_tracker.h" 36 #include "cc/scheduler/begin_frame_tracker.h"
36 #include "cc/scheduler/commit_earlyout_reason.h" 37 #include "cc/scheduler/commit_earlyout_reason.h"
37 #include "cc/scheduler/draw_result.h" 38 #include "cc/scheduler/draw_result.h"
38 #include "cc/scheduler/video_frame_controller.h" 39 #include "cc/scheduler/video_frame_controller.h"
39 #include "cc/tiles/tile_manager.h" 40 #include "cc/tiles/tile_manager.h"
41 #include "cc/trees/layer_tree_host_common.h"
40 #include "cc/trees/layer_tree_settings.h" 42 #include "cc/trees/layer_tree_settings.h"
41 #include "cc/trees/mutator_host_client.h" 43 #include "cc/trees/mutator_host_client.h"
42 #include "cc/trees/task_runner_provider.h" 44 #include "cc/trees/task_runner_provider.h"
43 #include "skia/ext/refptr.h" 45 #include "skia/ext/refptr.h"
44 #include "third_party/skia/include/core/SkColor.h" 46 #include "third_party/skia/include/core/SkColor.h"
45 #include "ui/gfx/geometry/rect.h" 47 #include "ui/gfx/geometry/rect.h"
46 48
47 namespace gfx { 49 namespace gfx {
48 class ScrollOffset; 50 class ScrollOffset;
49 } 51 }
(...skipping 87 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override; 227 void AppendRenderPass(scoped_ptr<RenderPass> render_pass) override;
225 228
226 private: 229 private:
227 DISALLOW_COPY_AND_ASSIGN(FrameData); 230 DISALLOW_COPY_AND_ASSIGN(FrameData);
228 }; 231 };
229 232
230 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason); 233 virtual void BeginMainFrameAborted(CommitEarlyOutReason reason);
231 virtual void BeginCommit(); 234 virtual void BeginCommit();
232 virtual void CommitComplete(); 235 virtual void CommitComplete();
233 virtual void UpdateAnimationState(bool start_ready_animations); 236 virtual void UpdateAnimationState(bool start_ready_animations);
237 bool Mutate(base::TimeTicks monotinic_time);
234 void ActivateAnimations(); 238 void ActivateAnimations();
235 void Animate(); 239 void Animate();
236 void AnimatePendingTreeAfterCommit(); 240 void AnimatePendingTreeAfterCommit();
237 void MainThreadHasStoppedFlinging(); 241 void MainThreadHasStoppedFlinging();
238 void DidAnimateScrollOffset(); 242 void DidAnimateScrollOffset();
239 void SetViewportDamage(const gfx::Rect& damage_rect); 243 void SetViewportDamage(const gfx::Rect& damage_rect);
240 244
241 void SetTreeLayerFilterMutated(int layer_id, 245 void SetTreeLayerFilterMutated(int layer_id,
242 LayerTreeImpl* tree, 246 LayerTreeImpl* tree,
243 const FilterOperations& filters); 247 const FilterOperations& filters);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 void DidSwapBuffers() override; 359 void DidSwapBuffers() override;
356 void DidSwapBuffersComplete() override; 360 void DidSwapBuffersComplete() override;
357 void ReclaimResources(const CompositorFrameAck* ack) override; 361 void ReclaimResources(const CompositorFrameAck* ack) override;
358 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override; 362 void SetMemoryPolicy(const ManagedMemoryPolicy& policy) override;
359 void SetTreeActivationCallback(const base::Closure& callback) override; 363 void SetTreeActivationCallback(const base::Closure& callback) override;
360 void OnDraw(const gfx::Transform& transform, 364 void OnDraw(const gfx::Transform& transform,
361 const gfx::Rect& viewport, 365 const gfx::Rect& viewport,
362 const gfx::Rect& clip, 366 const gfx::Rect& clip,
363 bool resourceless_software_draw) override; 367 bool resourceless_software_draw) override;
364 368
369 // LayerTreeMutatorClient.
370 void SetNeedsMutate() override;
371
365 // Called from LayerTreeImpl. 372 // Called from LayerTreeImpl.
366 void OnCanDrawStateChangedForTree(); 373 void OnCanDrawStateChangedForTree();
367 374
368 // Implementation. 375 // Implementation.
369 int id() const { return id_; } 376 int id() const { return id_; }
370 bool CanDraw() const; 377 bool CanDraw() const;
371 OutputSurface* output_surface() const { return output_surface_; } 378 OutputSurface* output_surface() const { return output_surface_; }
372 void ReleaseOutputSurface(); 379 void ReleaseOutputSurface();
373 380
374 std::string LayerTreeAsJson() const; 381 std::string LayerTreeAsJson() const;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 // the main frame args if it was scheduled. 595 // the main frame args if it was scheduled.
589 void RecordMainFrameTiming( 596 void RecordMainFrameTiming(
590 const BeginFrameArgs& start_of_main_frame_args, 597 const BeginFrameArgs& start_of_main_frame_args,
591 const BeginFrameArgs& expected_next_main_frame_args); 598 const BeginFrameArgs& expected_next_main_frame_args);
592 599
593 // Post the given frame timing events to the requester. 600 // Post the given frame timing events to the requester.
594 void PostFrameTimingEvents( 601 void PostFrameTimingEvents(
595 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events, 602 scoped_ptr<FrameTimingTracker::CompositeTimingSet> composite_events,
596 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events); 603 scoped_ptr<FrameTimingTracker::MainFrameTimingSet> main_frame_events);
597 604
605 void SetLayerTreeMutator(LayerTreeMutator* mutator);
606 LayerTreeMutator* mutator() { return mutator_; }
607
598 base::SingleThreadTaskRunner* GetTaskRunner() const { 608 base::SingleThreadTaskRunner* GetTaskRunner() const {
599 DCHECK(task_runner_provider_); 609 DCHECK(task_runner_provider_);
600 return task_runner_provider_->HasImplThread() 610 return task_runner_provider_->HasImplThread()
601 ? task_runner_provider_->ImplThreadTaskRunner() 611 ? task_runner_provider_->ImplThreadTaskRunner()
602 : task_runner_provider_->MainThreadTaskRunner(); 612 : task_runner_provider_->MainThreadTaskRunner();
603 } 613 }
604 614
605 protected: 615 protected:
606 LayerTreeHostImpl( 616 LayerTreeHostImpl(
607 const LayerTreeSettings& settings, 617 const LayerTreeSettings& settings,
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 MicroBenchmarkControllerImpl micro_benchmark_controller_; 825 MicroBenchmarkControllerImpl micro_benchmark_controller_;
816 scoped_ptr<SynchronousTaskGraphRunner> 826 scoped_ptr<SynchronousTaskGraphRunner>
817 single_thread_synchronous_task_graph_runner_; 827 single_thread_synchronous_task_graph_runner_;
818 828
819 // Optional callback to notify of new tree activations. 829 // Optional callback to notify of new tree activations.
820 base::Closure tree_activation_callback_; 830 base::Closure tree_activation_callback_;
821 831
822 SharedBitmapManager* shared_bitmap_manager_; 832 SharedBitmapManager* shared_bitmap_manager_;
823 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 833 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
824 TaskGraphRunner* task_graph_runner_; 834 TaskGraphRunner* task_graph_runner_;
835 LayerTreeMutator* mutator_;
825 int id_; 836 int id_;
826 837
827 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 838 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
828 839
840 bool is_scrolling_;
841
829 bool requires_high_res_to_draw_; 842 bool requires_high_res_to_draw_;
830 bool is_likely_to_require_a_draw_; 843 bool is_likely_to_require_a_draw_;
831 844
832 scoped_ptr<FrameTimingTracker> frame_timing_tracker_; 845 scoped_ptr<FrameTimingTracker> frame_timing_tracker_;
833 846
834 scoped_ptr<Viewport> viewport_; 847 scoped_ptr<Viewport> viewport_;
835 848
836 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl); 849 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImpl);
837 }; 850 };
838 851
839 } // namespace cc 852 } // namespace cc
840 853
841 #endif // CC_TREES_LAYER_TREE_HOST_IMPL_H_ 854 #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