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

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

Issue 2323423002: cc: Add SwapPromiseManager and SurfaceSequenceGenerator. (Closed)
Patch Set: rebase Created 4 years, 3 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
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_H_ 5 #ifndef CC_TREES_LAYER_TREE_HOST_H_
6 #define CC_TREES_LAYER_TREE_HOST_H_ 6 #define CC_TREES_LAYER_TREE_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 16 matching lines...) Expand all
27 #include "cc/input/event_listener_properties.h" 27 #include "cc/input/event_listener_properties.h"
28 #include "cc/input/input_handler.h" 28 #include "cc/input/input_handler.h"
29 #include "cc/input/layer_selection_bound.h" 29 #include "cc/input/layer_selection_bound.h"
30 #include "cc/input/scrollbar.h" 30 #include "cc/input/scrollbar.h"
31 #include "cc/input/top_controls_state.h" 31 #include "cc/input/top_controls_state.h"
32 #include "cc/layers/layer_collections.h" 32 #include "cc/layers/layer_collections.h"
33 #include "cc/layers/layer_list_iterator.h" 33 #include "cc/layers/layer_list_iterator.h"
34 #include "cc/output/output_surface.h" 34 #include "cc/output/output_surface.h"
35 #include "cc/output/swap_promise.h" 35 #include "cc/output/swap_promise.h"
36 #include "cc/resources/resource_format.h" 36 #include "cc/resources/resource_format.h"
37 #include "cc/surfaces/surface_sequence.h"
38 #include "cc/trees/compositor_mode.h" 37 #include "cc/trees/compositor_mode.h"
39 #include "cc/trees/layer_tree.h" 38 #include "cc/trees/layer_tree.h"
40 #include "cc/trees/layer_tree_host_client.h" 39 #include "cc/trees/layer_tree_host_client.h"
41 #include "cc/trees/layer_tree_host_interface.h" 40 #include "cc/trees/layer_tree_host_interface.h"
42 #include "cc/trees/layer_tree_settings.h" 41 #include "cc/trees/layer_tree_settings.h"
43 #include "cc/trees/proxy.h" 42 #include "cc/trees/proxy.h"
43 #include "cc/trees/surface_sequence_generator.h"
44 #include "cc/trees/swap_promise_monitor.h" 44 #include "cc/trees/swap_promise_monitor.h"
45 #include "third_party/skia/include/core/SkColor.h" 45 #include "third_party/skia/include/core/SkColor.h"
46 #include "ui/gfx/geometry/rect.h" 46 #include "ui/gfx/geometry/rect.h"
47 47
48 namespace gpu { 48 namespace gpu {
49 class GpuMemoryBufferManager; 49 class GpuMemoryBufferManager;
50 } 50 }
51 51
52 namespace cc { 52 namespace cc {
53 53
(...skipping 14 matching lines...) Expand all
68 class RemoteProtoChannel; 68 class RemoteProtoChannel;
69 class RenderingStatsInstrumentation; 69 class RenderingStatsInstrumentation;
70 class ResourceProvider; 70 class ResourceProvider;
71 class ResourceUpdateQueue; 71 class ResourceUpdateQueue;
72 class SharedBitmapManager; 72 class SharedBitmapManager;
73 class TaskGraphRunner; 73 class TaskGraphRunner;
74 class TopControlsManager; 74 class TopControlsManager;
75 struct PendingPageScaleAnimation; 75 struct PendingPageScaleAnimation;
76 struct RenderingStats; 76 struct RenderingStats;
77 struct ScrollAndScaleSet; 77 struct ScrollAndScaleSet;
78 class SwapPromiseManager;
78 79
79 namespace proto { 80 namespace proto {
80 class LayerTreeHost; 81 class LayerTreeHost;
81 } 82 }
82 83
83 // This class is being refactored to an interface, see LayerTreeHostInterface, 84 // This class is being refactored to an interface, see LayerTreeHostInterface,
84 // which is the API for the cc embedder. When adding new code to this class, 85 // which is the API for the cc embedder. When adding new code to this class,
85 // consider the following: 86 // consider the following:
86 // 1) If its state/data that gets pushed to the LayerTreeImpl during commit, add 87 // 1) If its state/data that gets pushed to the LayerTreeImpl during commit, add
87 // it to the LayerTree. 88 // it to the LayerTree.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 139
139 ~LayerTreeHost() override; 140 ~LayerTreeHost() override;
140 141
141 // LayerTreeHostInterface implementation. 142 // LayerTreeHostInterface implementation.
142 int GetId() const override; 143 int GetId() const override;
143 int SourceFrameNumber() const override; 144 int SourceFrameNumber() const override;
144 LayerTree* GetLayerTree() override; 145 LayerTree* GetLayerTree() override;
145 const LayerTree* GetLayerTree() const override; 146 const LayerTree* GetLayerTree() const override;
146 UIResourceManager* GetUIResourceManager() const override; 147 UIResourceManager* GetUIResourceManager() const override;
147 TaskRunnerProvider* GetTaskRunnerProvider() const override; 148 TaskRunnerProvider* GetTaskRunnerProvider() const override;
149 SwapPromiseManager* GetSwapPromiseManager() const override;
148 const LayerTreeSettings& GetSettings() const override; 150 const LayerTreeSettings& GetSettings() const override;
149 void SetSurfaceClientId(uint32_t client_id) override; 151 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override;
150 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override; 152 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override;
151 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override;
152 void SetHasGpuRasterizationTrigger(bool has_trigger) override; 153 void SetHasGpuRasterizationTrigger(bool has_trigger) override;
153 void SetVisible(bool visible) override; 154 void SetVisible(bool visible) override;
154 bool IsVisible() const override; 155 bool IsVisible() const override;
155 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface) override; 156 void SetOutputSurface(std::unique_ptr<OutputSurface> output_surface) override;
156 std::unique_ptr<OutputSurface> ReleaseOutputSurface() override; 157 std::unique_ptr<OutputSurface> ReleaseOutputSurface() override;
157 void SetNeedsAnimate() override; 158 void SetNeedsAnimate() override;
158 void SetNeedsUpdateLayers() override; 159 void SetNeedsUpdateLayers() override;
159 void SetNeedsCommit() override; 160 void SetNeedsCommit() override;
160 bool BeginMainFrameRequested() const override; 161 bool BeginMainFrameRequested() const override;
161 bool CommitRequested() const override; 162 bool CommitRequested() const override;
(...skipping 10 matching lines...) Expand all
172 const base::WeakPtr<InputHandler>& GetInputHandler() const override; 173 const base::WeakPtr<InputHandler>& GetInputHandler() const override;
173 void DidStopFlinging() override; 174 void DidStopFlinging() override;
174 void SetDebugState(const LayerTreeDebugState& debug_state) override; 175 void SetDebugState(const LayerTreeDebugState& debug_state) override;
175 const LayerTreeDebugState& GetDebugState() const override; 176 const LayerTreeDebugState& GetDebugState() const override;
176 int ScheduleMicroBenchmark( 177 int ScheduleMicroBenchmark(
177 const std::string& benchmark_name, 178 const std::string& benchmark_name,
178 std::unique_ptr<base::Value> value, 179 std::unique_ptr<base::Value> value,
179 const MicroBenchmark::DoneCallback& callback) override; 180 const MicroBenchmark::DoneCallback& callback) override;
180 bool SendMessageToMicroBenchmark(int id, 181 bool SendMessageToMicroBenchmark(int id,
181 std::unique_ptr<base::Value> value) override; 182 std::unique_ptr<base::Value> value) override;
182 void InsertSwapPromiseMonitor(SwapPromiseMonitor* monitor) override;
183 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) override;
184 183
185 // LayerTreeHost interface to Proxy. 184 // LayerTreeHost interface to Proxy.
186 void WillBeginMainFrame(); 185 void WillBeginMainFrame();
187 void DidBeginMainFrame(); 186 void DidBeginMainFrame();
188 void BeginMainFrame(const BeginFrameArgs& args); 187 void BeginMainFrame(const BeginFrameArgs& args);
189 void BeginMainFrameNotExpectedSoon(); 188 void BeginMainFrameNotExpectedSoon();
190 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); 189 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time);
191 void RequestMainFrameUpdate(); 190 void RequestMainFrameUpdate();
192 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); 191 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl);
193 void WillCommit(); 192 void WillCommit();
(...skipping 26 matching lines...) Expand all
220 void SetNextCommitWaitsForActivation(); 219 void SetNextCommitWaitsForActivation();
221 220
222 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); 221 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events);
223 222
224 bool has_gpu_rasterization_trigger() const { 223 bool has_gpu_rasterization_trigger() const {
225 return has_gpu_rasterization_trigger_; 224 return has_gpu_rasterization_trigger_;
226 } 225 }
227 226
228 Proxy* proxy() const { return proxy_.get(); } 227 Proxy* proxy() const { return proxy_.get(); }
229 228
230 void BreakSwapPromises(SwapPromise::DidNotSwapReason reason);
231 std::vector<std::unique_ptr<SwapPromise>> TakeSwapPromises();
232
233 size_t num_queued_swap_promises() const { return swap_promise_list_.size(); }
234
235 SurfaceSequence CreateSurfaceSequence();
236
237 // Serializes the parts of this LayerTreeHost that is needed for a commit to a 229 // Serializes the parts of this LayerTreeHost that is needed for a commit to a
238 // protobuf message. Not all members are serialized as they are not helpful 230 // protobuf message. Not all members are serialized as they are not helpful
239 // for remote usage. 231 // for remote usage.
240 // The |swap_promise_list_| is transferred to the serializer in 232 // The |swap_promise_list_| is transferred to the serializer in
241 // |swap_promises|. 233 // |swap_promises|.
242 void ToProtobufForCommit( 234 void ToProtobufForCommit(
243 proto::LayerTreeHost* proto, 235 proto::LayerTreeHost* proto,
244 std::vector<std::unique_ptr<SwapPromise>>* swap_promises); 236 std::vector<std::unique_ptr<SwapPromise>>* swap_promises);
245 237
246 // Deserializes the protobuf into this LayerTreeHost before a commit. The 238 // Deserializes the protobuf into this LayerTreeHost before a commit. The
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 std::unique_ptr<Proxy> proxy, 326 std::unique_ptr<Proxy> proxy,
335 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 327 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
336 328
337 bool DoUpdateLayers(Layer* root_layer); 329 bool DoUpdateLayers(Layer* root_layer);
338 void UpdateHudLayer(); 330 void UpdateHudLayer();
339 331
340 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); 332 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time);
341 333
342 void CalculateLCDTextMetricsCallback(Layer* layer); 334 void CalculateLCDTextMetricsCallback(Layer* layer);
343 335
344 void NotifySwapPromiseMonitorsOfSetNeedsCommit();
345
346 void SetPropertyTreesNeedRebuild(); 336 void SetPropertyTreesNeedRebuild();
347 337
348 const CompositorMode compositor_mode_; 338 const CompositorMode compositor_mode_;
349 339
350 std::unique_ptr<UIResourceManager> ui_resource_manager_; 340 std::unique_ptr<UIResourceManager> ui_resource_manager_;
351 341
352 LayerTreeHostClient* client_; 342 LayerTreeHostClient* client_;
353 std::unique_ptr<Proxy> proxy_; 343 std::unique_ptr<Proxy> proxy_;
354 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; 344 std::unique_ptr<TaskRunnerProvider> task_runner_provider_;
355 345
356 int source_frame_number_; 346 int source_frame_number_;
357 std::unique_ptr<RenderingStatsInstrumentation> 347 std::unique_ptr<RenderingStatsInstrumentation>
358 rendering_stats_instrumentation_; 348 rendering_stats_instrumentation_;
359 349
350 std::unique_ptr<SwapPromiseManager> swap_promise_manager_;
351
360 // |current_output_surface_| can't be updated until we've successfully 352 // |current_output_surface_| can't be updated until we've successfully
361 // initialized a new output surface. |new_output_surface_| contains the 353 // initialized a new output surface. |new_output_surface_| contains the
362 // new output surface that is currently being initialized. If initialization 354 // new output surface that is currently being initialized. If initialization
363 // is successful then |new_output_surface_| replaces 355 // is successful then |new_output_surface_| replaces
364 // |current_output_surface_|. 356 // |current_output_surface_|.
365 std::unique_ptr<OutputSurface> new_output_surface_; 357 std::unique_ptr<OutputSurface> new_output_surface_;
366 std::unique_ptr<OutputSurface> current_output_surface_; 358 std::unique_ptr<OutputSurface> current_output_surface_;
367 359
368 const LayerTreeSettings settings_; 360 const LayerTreeSettings settings_;
369 LayerTreeDebugState debug_state_; 361 LayerTreeDebugState debug_state_;
(...skipping 12 matching lines...) Expand all
382 bool next_commit_forces_redraw_; 374 bool next_commit_forces_redraw_;
383 375
384 SharedBitmapManager* shared_bitmap_manager_; 376 SharedBitmapManager* shared_bitmap_manager_;
385 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 377 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
386 TaskGraphRunner* task_graph_runner_; 378 TaskGraphRunner* task_graph_runner_;
387 379
388 ImageSerializationProcessor* image_serialization_processor_; 380 ImageSerializationProcessor* image_serialization_processor_;
389 std::unique_ptr<EnginePictureCache> engine_picture_cache_; 381 std::unique_ptr<EnginePictureCache> engine_picture_cache_;
390 std::unique_ptr<ClientPictureCache> client_picture_cache_; 382 std::unique_ptr<ClientPictureCache> client_picture_cache_;
391 383
392 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; 384 SurfaceSequenceGenerator surface_sequence_generator_;
393 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
394
395 uint32_t surface_client_id_;
396 uint32_t next_surface_sequence_;
397 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; 385 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0;
398 386
399 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 387 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
400 }; 388 };
401 389
402 } // namespace cc 390 } // namespace cc
403 391
404 #endif // CC_TREES_LAYER_TREE_HOST_H_ 392 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698