| OLD | NEW |
| 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 Loading... |
| 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" |
| 44 #include "cc/trees/swap_promise_monitor.h" | 43 #include "cc/trees/surface_sequence_generator.h" |
| 44 #include "cc/trees/swap_promise_manager.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 |
| 54 class AnimationEvents; | 54 class AnimationEvents; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 int GetId() const override; | 142 int GetId() const override; |
| 143 int SourceFrameNumber() const override; | 143 int SourceFrameNumber() const override; |
| 144 LayerTree* GetLayerTree() override; | 144 LayerTree* GetLayerTree() override; |
| 145 const LayerTree* GetLayerTree() const override; | 145 const LayerTree* GetLayerTree() const override; |
| 146 UIResourceManager* GetUIResourceManager() const override; | 146 UIResourceManager* GetUIResourceManager() const override; |
| 147 TaskRunnerProvider* GetTaskRunnerProvider() const override; | 147 TaskRunnerProvider* GetTaskRunnerProvider() const override; |
| 148 const LayerTreeSettings& GetSettings() const override; | 148 const LayerTreeSettings& GetSettings() const override; |
| 149 void SetSurfaceClientId(uint32_t client_id) override; | 149 void SetSurfaceClientId(uint32_t client_id) override; |
| 150 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override; | 150 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator) override; |
| 151 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override; | 151 void QueueSwapPromise(std::unique_ptr<SwapPromise> swap_promise) override; |
| 152 SwapPromiseManager* GetSwapPromiseManager() 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 Loading... |
| 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 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override; |
| 183 void RemoveSwapPromiseMonitor(SwapPromiseMonitor* monitor) override; | |
| 184 | 184 |
| 185 // LayerTreeHost interface to Proxy. | 185 // LayerTreeHost interface to Proxy. |
| 186 void WillBeginMainFrame(); | 186 void WillBeginMainFrame(); |
| 187 void DidBeginMainFrame(); | 187 void DidBeginMainFrame(); |
| 188 void BeginMainFrame(const BeginFrameArgs& args); | 188 void BeginMainFrame(const BeginFrameArgs& args); |
| 189 void BeginMainFrameNotExpectedSoon(); | 189 void BeginMainFrameNotExpectedSoon(); |
| 190 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 190 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
| 191 void RequestMainFrameUpdate(); | 191 void RequestMainFrameUpdate(); |
| 192 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 192 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
| 193 void WillCommit(); | 193 void WillCommit(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 220 void SetNextCommitWaitsForActivation(); | 220 void SetNextCommitWaitsForActivation(); |
| 221 | 221 |
| 222 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); | 222 void SetAnimationEvents(std::unique_ptr<AnimationEvents> events); |
| 223 | 223 |
| 224 bool has_gpu_rasterization_trigger() const { | 224 bool has_gpu_rasterization_trigger() const { |
| 225 return has_gpu_rasterization_trigger_; | 225 return has_gpu_rasterization_trigger_; |
| 226 } | 226 } |
| 227 | 227 |
| 228 Proxy* proxy() const { return proxy_.get(); } | 228 Proxy* proxy() const { return proxy_.get(); } |
| 229 | 229 |
| 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 | 230 // 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 | 231 // protobuf message. Not all members are serialized as they are not helpful |
| 239 // for remote usage. | 232 // for remote usage. |
| 240 // The |swap_promise_list_| is transferred to the serializer in | 233 // The |swap_promise_list_| is transferred to the serializer in |
| 241 // |swap_promises|. | 234 // |swap_promises|. |
| 242 void ToProtobufForCommit( | 235 void ToProtobufForCommit( |
| 243 proto::LayerTreeHost* proto, | 236 proto::LayerTreeHost* proto, |
| 244 std::vector<std::unique_ptr<SwapPromise>>* swap_promises); | 237 std::vector<std::unique_ptr<SwapPromise>>* swap_promises); |
| 245 | 238 |
| 246 // Deserializes the protobuf into this LayerTreeHost before a commit. The | 239 // Deserializes the protobuf into this LayerTreeHost before a commit. The |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 std::unique_ptr<Proxy> proxy, | 327 std::unique_ptr<Proxy> proxy, |
| 335 std::unique_ptr<BeginFrameSource> external_begin_frame_source); | 328 std::unique_ptr<BeginFrameSource> external_begin_frame_source); |
| 336 | 329 |
| 337 bool DoUpdateLayers(Layer* root_layer); | 330 bool DoUpdateLayers(Layer* root_layer); |
| 338 void UpdateHudLayer(); | 331 void UpdateHudLayer(); |
| 339 | 332 |
| 340 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 333 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
| 341 | 334 |
| 342 void CalculateLCDTextMetricsCallback(Layer* layer); | 335 void CalculateLCDTextMetricsCallback(Layer* layer); |
| 343 | 336 |
| 344 void NotifySwapPromiseMonitorsOfSetNeedsCommit(); | |
| 345 | |
| 346 void SetPropertyTreesNeedRebuild(); | 337 void SetPropertyTreesNeedRebuild(); |
| 347 | 338 |
| 348 const CompositorMode compositor_mode_; | 339 const CompositorMode compositor_mode_; |
| 349 | 340 |
| 350 std::unique_ptr<UIResourceManager> ui_resource_manager_; | 341 std::unique_ptr<UIResourceManager> ui_resource_manager_; |
| 351 | 342 |
| 352 LayerTreeHostClient* client_; | 343 LayerTreeHostClient* client_; |
| 353 std::unique_ptr<Proxy> proxy_; | 344 std::unique_ptr<Proxy> proxy_; |
| 354 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; | 345 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; |
| 355 | 346 |
| 356 int source_frame_number_; | 347 int source_frame_number_; |
| 357 std::unique_ptr<RenderingStatsInstrumentation> | 348 std::unique_ptr<RenderingStatsInstrumentation> |
| 358 rendering_stats_instrumentation_; | 349 rendering_stats_instrumentation_; |
| 359 | 350 |
| 351 SwapPromiseManager swap_promise_manager_; |
| 352 |
| 360 // |current_output_surface_| can't be updated until we've successfully | 353 // |current_output_surface_| can't be updated until we've successfully |
| 361 // initialized a new output surface. |new_output_surface_| contains the | 354 // initialized a new output surface. |new_output_surface_| contains the |
| 362 // new output surface that is currently being initialized. If initialization | 355 // new output surface that is currently being initialized. If initialization |
| 363 // is successful then |new_output_surface_| replaces | 356 // is successful then |new_output_surface_| replaces |
| 364 // |current_output_surface_|. | 357 // |current_output_surface_|. |
| 365 std::unique_ptr<OutputSurface> new_output_surface_; | 358 std::unique_ptr<OutputSurface> new_output_surface_; |
| 366 std::unique_ptr<OutputSurface> current_output_surface_; | 359 std::unique_ptr<OutputSurface> current_output_surface_; |
| 367 | 360 |
| 368 const LayerTreeSettings settings_; | 361 const LayerTreeSettings settings_; |
| 369 LayerTreeDebugState debug_state_; | 362 LayerTreeDebugState debug_state_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 382 bool next_commit_forces_redraw_; | 375 bool next_commit_forces_redraw_; |
| 383 | 376 |
| 384 SharedBitmapManager* shared_bitmap_manager_; | 377 SharedBitmapManager* shared_bitmap_manager_; |
| 385 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 378 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
| 386 TaskGraphRunner* task_graph_runner_; | 379 TaskGraphRunner* task_graph_runner_; |
| 387 | 380 |
| 388 ImageSerializationProcessor* image_serialization_processor_; | 381 ImageSerializationProcessor* image_serialization_processor_; |
| 389 std::unique_ptr<EnginePictureCache> engine_picture_cache_; | 382 std::unique_ptr<EnginePictureCache> engine_picture_cache_; |
| 390 std::unique_ptr<ClientPictureCache> client_picture_cache_; | 383 std::unique_ptr<ClientPictureCache> client_picture_cache_; |
| 391 | 384 |
| 392 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; | 385 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; | 386 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
| 398 | 387 |
| 399 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 388 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 400 }; | 389 }; |
| 401 | 390 |
| 402 } // namespace cc | 391 } // namespace cc |
| 403 | 392 |
| 404 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 393 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |