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

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

Issue 2646623002: cc: Remove all blimp code from cc. (Closed)
Patch Set: test build Created 3 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/blimp/layer_factory.h ('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/output/begin_frame_args.h"
14 #include "cc/scheduler/begin_frame_source.h"
15 #include "cc/surfaces/surface_sequence_generator.h"
16 #include "cc/trees/layer_tree_host.h"
17 #include "cc/trees/layer_tree_settings.h"
18 #include "cc/trees/swap_promise_manager.h"
19
20 namespace base {
21 class SingleThreadTaskRunner;
22 } // namespace base
23
24 namespace cc {
25 namespace proto {
26 class LayerTreeHost;
27 } // namespace proto
28
29 class MutatorHost;
30 class EnginePictureCache;
31 class RemoteCompositorBridge;
32 class LayerTreeHostClient;
33
34 class CC_EXPORT LayerTreeHostRemote : public LayerTreeHost,
35 public RemoteCompositorBridgeClient {
36 public:
37 struct CC_EXPORT InitParams {
38 LayerTreeHostClient* client = nullptr;
39 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner;
40 MutatorHost* mutator_host;
41 std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge;
42 std::unique_ptr<EnginePictureCache> engine_picture_cache;
43 LayerTreeSettings const* settings = nullptr;
44
45 InitParams();
46 ~InitParams();
47 };
48
49 explicit LayerTreeHostRemote(InitParams* params);
50 ~LayerTreeHostRemote() override;
51
52 // LayerTreeHost implementation.
53 int GetId() const override;
54 int SourceFrameNumber() const override;
55 LayerTree* GetLayerTree() override;
56 const LayerTree* GetLayerTree() const override;
57 UIResourceManager* GetUIResourceManager() const override;
58 TaskRunnerProvider* GetTaskRunnerProvider() const override;
59 const LayerTreeSettings& GetSettings() const override;
60 void SetFrameSinkId(const FrameSinkId& frame_sink_id) override;
61 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override;
62 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override;
63 SwapPromiseManager* GetSwapPromiseManager() override;
64 void SetHasGpuRasterizationTrigger(bool has_trigger) override;
65 void SetVisible(bool visible) override;
66 bool IsVisible() const override;
67 void SetCompositorFrameSink(
68 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override;
69 std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override;
70 void SetNeedsAnimate() override;
71 void SetNeedsUpdateLayers() override;
72 void SetNeedsCommit() override;
73 void SetNeedsRecalculateRasterScales() override;
74 bool BeginMainFrameRequested() const override;
75 bool CommitRequested() const override;
76 void SetDeferCommits(bool defer_commits) override;
77 void LayoutAndUpdateLayers() override;
78 void Composite(base::TimeTicks frame_begin_time) override;
79 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override;
80 void SetNextCommitForcesRedraw() override;
81 void NotifyInputThrottledUntilCommit() override;
82 void UpdateBrowserControlsState(BrowserControlsState constraints,
83 BrowserControlsState current,
84 bool animate) override;
85 const base::WeakPtr<InputHandler>& GetInputHandler() const override;
86 void DidStopFlinging() override;
87 void SetDebugState(const LayerTreeDebugState& debug_state) override;
88 const LayerTreeDebugState& GetDebugState() const override;
89 int ScheduleMicroBenchmark(
90 const std::string& benchmark_name,
91 std::unique_ptr<base::Value> value,
92 const MicroBenchmark::DoneCallback& callback) override;
93 bool SendMessageToMicroBenchmark(int id,
94 std::unique_ptr<base::Value> value) override;
95 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override;
96 void SetNextCommitWaitsForActivation() override;
97 void ResetGpuRasterizationTracking() override;
98
99 // RemoteCompositorBridgeClient implementation.
100 void BeginMainFrame() override;
101 void ApplyStateUpdateFromClient(
102 const proto::ClientStateUpdate& client_state_update) override;
103
104 protected:
105 // Protected for testing. Allows tests to inject the LayerTree.
106 LayerTreeHostRemote(InitParams* params,
107 std::unique_ptr<LayerTree> layer_tree);
108
109 LayerTreeHostClient* client() const { return client_; }
110 RemoteCompositorBridge* remote_compositor_bridge() const {
111 return remote_compositor_bridge_.get();
112 }
113
114 virtual void DispatchDrawAndSubmitCallbacks();
115 void SetTaskRunnerProviderForTesting(
116 std::unique_ptr<TaskRunnerProvider> task_runner_provider);
117
118 private:
119 enum class FramePipelineStage { NONE, ANIMATE, UPDATE_LAYERS, COMMIT };
120
121 void MainFrameRequested(FramePipelineStage requested_pipeline_stage);
122 void ScheduleMainFrameIfNecessary();
123 void MainFrameComplete();
124 void SerializeCurrentState(proto::LayerTreeHost* layer_tree_host_proto);
125
126 const int id_;
127 int source_frame_number_ = 0;
128 bool visible_ = false;
129 bool defer_commits_ = false;
130
131 // Provides |source_id| for BeginFrameArgs we create.
132 StubBeginFrameSource begin_frame_source_;
133 uint64_t begin_frame_number_ = BeginFrameArgs::kStartingFrameNumber;
134
135 // In threaded/single-threaded mode, the LayerTree and Layers expect scroll/
136 // scale updates to come from the impl thread only during the main frame.
137 // Since we synchronize state outside of that, this is set so we can
138 // temporarily report that a commit is in progress.
139 bool synchronizing_client_updates_ = false;
140
141 // Set to true if a main frame request is pending on the
142 // RemoteCompositorBridge.
143 bool main_frame_requested_from_bridge_ = false;
144
145 // Set to the pipeline stage we are currently at if we are inside a main frame
146 // update.
147 FramePipelineStage current_pipeline_stage_ = FramePipelineStage::NONE;
148
149 // Set to the pipeline stage we need to go to for the current main frame
150 // update, if we are inside a main frame update.
151 FramePipelineStage max_pipeline_stage_for_current_frame_ =
152 FramePipelineStage::NONE;
153
154 // Set to the pipeline stage requested for the next BeginMainFrame.
155 FramePipelineStage requested_pipeline_stage_for_next_frame_ =
156 FramePipelineStage::NONE;
157
158 LayerTreeHostClient* client_;
159 std::unique_ptr<TaskRunnerProvider> task_runner_provider_;
160
161 // The RemoteCompositorBridge used to submit frame updates to the client.
162 std::unique_ptr<RemoteCompositorBridge> remote_compositor_bridge_;
163
164 // Used to cache SkPictures sent with DisplayLists to the client.
165 // TODO(khushalsagar): Restructure to give this with the CompositorProtoState
166 // and eliminate this abstraction. See crbug.com/648442.
167 std::unique_ptr<EnginePictureCache> engine_picture_cache_;
168
169 LayerTreeSettings settings_;
170 LayerTreeDebugState debug_state_;
171
172 // The LayerTree holds the root layer and other state on the engine.
173 std::unique_ptr<LayerTree> layer_tree_;
174
175 SwapPromiseManager swap_promise_manager_;
176 SurfaceSequenceGenerator surface_sequence_generator_;
177
178 base::WeakPtr<InputHandler> input_handler_weak_ptr_;
179
180 base::WeakPtrFactory<LayerTreeHostRemote> weak_factory_;
181 };
182
183 } // namespace cc
184
185 #endif // CC_BLIMP_LAYER_TREE_HOST_REMOTE_H_
OLDNEW
« no previous file with comments | « cc/blimp/layer_factory.h ('k') | cc/blimp/layer_tree_host_remote.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698