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

Side by Side Diff: cc/blimp/layer_tree_host_remote.h

Issue 2384333002: Revert of cc/blimp: Add a LayerTreeHostRemote implementation. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « cc/blimp/compositor_proto_state.cc ('k') | cc/blimp/layer_tree_host_remote.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
6 #define CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "cc/base/cc_export.h"
11 #include "cc/blimp/remote_compositor_bridge_client.h"
12 #include "cc/debug/layer_tree_debug_state.h"
13 #include "cc/trees/layer_tree_host.h"
14 #include "cc/trees/layer_tree_settings.h"
15 #include "cc/trees/surface_sequence_generator.h"
16 #include "cc/trees/swap_promise_manager.h"
17
18 namespace base {
19 class SingleThreadTaskRunner;
20 } // namespace base
21
22 namespace cc {
23 class AnimationHost;
24 class RemoteCompositorBridge;
25 class LayerTreeHostClient;
26
27 class CC_EXPORT LayerTreeHostRemote : public LayerTreeHost,
28 public RemoteCompositorBridgeClient {
29 public:
30 struct CC_EXPORT InitParams {
31 LayerTreeHostClient* client = nullptr;
32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner;
33 std::unique_ptr<AnimationHost> animation_host;
34 std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge;
35 LayerTreeSettings const* settings = nullptr;
36
37 InitParams();
38 ~InitParams();
39 };
40
41 explicit LayerTreeHostRemote(InitParams* params);
42 ~LayerTreeHostRemote() override;
43
44 // LayerTreeHost implementation.
45 int GetId() const override;
46 int SourceFrameNumber() const override;
47 LayerTree* GetLayerTree() override;
48 const LayerTree* GetLayerTree() const override;
49 UIResourceManager* GetUIResourceManager() const override;
50 TaskRunnerProvider* GetTaskRunnerProvider() const override;
51 const LayerTreeSettings& GetSettings() const override;
52 void SetFrameSinkId(const FrameSinkId& frame_sink_id) override;
53 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override;
54 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override;
55 SwapPromiseManager* GetSwapPromiseManager() override;
56 void SetHasGpuRasterizationTrigger(bool has_trigger) override;
57 void SetVisible(bool visible) override;
58 bool IsVisible() const override;
59 void SetCompositorFrameSink(
60 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override;
61 std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override;
62 void SetNeedsAnimate() override;
63 void SetNeedsUpdateLayers() override;
64 void SetNeedsCommit() override;
65 bool BeginMainFrameRequested() const override;
66 bool CommitRequested() const override;
67 void SetDeferCommits(bool defer_commits) override;
68 void LayoutAndUpdateLayers() override;
69 void Composite(base::TimeTicks frame_begin_time) override;
70 void SetNeedsRedraw() override;
71 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
72 void SetNextCommitForcesRedraw() override;
73 void NotifyInputThrottledUntilCommit() override;
74 void UpdateTopControlsState(TopControlsState constraints,
75 TopControlsState current,
76 bool animate) override;
77 const base::WeakPtr<InputHandler>& GetInputHandler() const override;
78 void DidStopFlinging() override;
79 void SetDebugState(const LayerTreeDebugState& debug_state) override;
80 const LayerTreeDebugState& GetDebugState() const override;
81 int ScheduleMicroBenchmark(
82 const std::string& benchmark_name,
83 std::unique_ptr<base::Value> value,
84 const MicroBenchmark::DoneCallback& callback) override;
85 bool SendMessageToMicroBenchmark(int id,
86 std::unique_ptr<base::Value> value) override;
87 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override;
88 void SetNextCommitWaitsForActivation() override;
89 void ResetGpuRasterizationTracking() override;
90
91 protected:
92 // Protected for testing. Allows tests to inject the LayerTree.
93 LayerTreeHostRemote(InitParams* params,
94 std::unique_ptr<LayerTree> layer_tree);
95
96 private:
97 enum class FramePipelineStage { NONE, ANIMATE, UPDATE_LAYERS, COMMIT };
98
99 // RemoteCompositorBridgeClient implementation.
100 void BeginMainFrame() override;
101
102 void MainFrameRequested(FramePipelineStage requested_pipeline_stage);
103 void ScheduleMainFrameIfNecessary();
104 void MainFrameComplete();
105 void DispatchDrawAndSwapCallbacks();
106
107 const int id_;
108 int source_frame_number_ = 0;
109 bool visible_ = false;
110 bool defer_commits_ = false;
111
112 // Set to true if a main frame request is pending on the
113 // RemoteCompositorBridge.
114 bool main_frame_requested_from_bridge_ = false;
115
116 // Set to the pipeline stage we are currently at if we are inside a main frame
117 // update.
118 FramePipelineStage current_pipeline_stage_ = FramePipelineStage::NONE;
119
120 // Set to the pipeline stage we need to go to for the current main frame
121 // update, if we are inside a main frame update.
122 FramePipelineStage max_pipeline_stage_for_current_frame_ =
123 FramePipelineStage::NONE;
124
125 // Set to the pipeline stage requested for the next BeginMainFrame.
126 FramePipelineStage requested_pipeline_stage_for_next_frame_ =
127 FramePipelineStage::NONE;
128
129 LayerTreeHostClient* client_;
130 std::unique_ptr<TaskRunnerProvider> task_runner_provider_;
131
132 // The RemoteCompositorBridge used to submit frame updates to the client.
133 std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge_;
134
135 LayerTreeSettings settings_;
136 LayerTreeDebugState debug_state_;
137
138 // The LayerTree holds the root layer and other state on the engine.
139 std::unique_ptr<LayerTree> layer_tree_;
140
141 SwapPromiseManager swap_promise_manager_;
142 SurfaceSequenceGenerator surface_sequence_generator_;
143
144 base::WeakPtr<InputHandler> input_handler_weak_ptr_;
145
146 base::WeakPtrFactory<LayerTreeHostRemote> weak_factory_;
147 };
148
149 } // namespace cc
150
151 #endif // CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
OLDNEW
« no previous file with comments | « cc/blimp/compositor_proto_state.cc ('k') | cc/blimp/layer_tree_host_remote.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698