| 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 18 matching lines...) Expand all Loading... |
| 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/layers/layer_collections.h" | 31 #include "cc/layers/layer_collections.h" |
| 32 #include "cc/layers/layer_list_iterator.h" | 32 #include "cc/layers/layer_list_iterator.h" |
| 33 #include "cc/output/compositor_frame_sink.h" | 33 #include "cc/output/compositor_frame_sink.h" |
| 34 #include "cc/output/swap_promise.h" | 34 #include "cc/output/swap_promise.h" |
| 35 #include "cc/resources/resource_format.h" | 35 #include "cc/resources/resource_format.h" |
| 36 #include "cc/surfaces/surface_reference_owner.h" | 36 #include "cc/surfaces/surface_reference_owner.h" |
| 37 #include "cc/surfaces/surface_sequence_generator.h" | 37 #include "cc/surfaces/surface_sequence_generator.h" |
| 38 #include "cc/trees/compositor_mode.h" | 38 #include "cc/trees/compositor_mode.h" |
| 39 #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_settings.h" | 40 #include "cc/trees/layer_tree_settings.h" |
| 41 #include "cc/trees/mutator_host.h" |
| 42 #include "cc/trees/proxy.h" | 42 #include "cc/trees/proxy.h" |
| 43 #include "cc/trees/swap_promise_manager.h" | 43 #include "cc/trees/swap_promise_manager.h" |
| 44 #include "cc/trees/target_property.h" | 44 #include "cc/trees/target_property.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 cc { | 48 namespace cc { |
| 49 class MutatorEvents; | 49 class HeadsUpDisplayLayer; |
| 50 class Layer; | 50 class Layer; |
| 51 class LayerTreeHostClient; | 51 class LayerTreeHostClient; |
| 52 class LayerTreeHostImpl; | 52 class LayerTreeHostImpl; |
| 53 class LayerTreeHostImplClient; | 53 class LayerTreeHostImplClient; |
| 54 class LayerTreeHostSingleThreadClient; | 54 class LayerTreeHostSingleThreadClient; |
| 55 class LayerTreeMutator; | 55 class LayerTreeMutator; |
| 56 class MutatorEvents; |
| 56 class MutatorHost; | 57 class MutatorHost; |
| 58 struct PendingPageScaleAnimation; |
| 57 class RenderingStatsInstrumentation; | 59 class RenderingStatsInstrumentation; |
| 58 class TaskGraphRunner; | 60 class TaskGraphRunner; |
| 59 class UIResourceManager; | 61 class UIResourceManager; |
| 60 struct RenderingStats; | 62 struct RenderingStats; |
| 61 struct ScrollAndScaleSet; | 63 struct ScrollAndScaleSet; |
| 62 | 64 |
| 63 class CC_EXPORT LayerTreeHost | 65 class CC_EXPORT LayerTreeHost : public NON_EXPORTED_BASE(SurfaceReferenceOwner), |
| 64 : public NON_EXPORTED_BASE(SurfaceReferenceOwner) { | 66 public NON_EXPORTED_BASE(MutatorHostClient) { |
| 65 public: | 67 public: |
| 66 // TODO(sad): InitParams should be a movable type so that it can be | 68 // TODO(sad): InitParams should be a movable type so that it can be |
| 67 // std::move()d to the Create* functions. | 69 // std::move()d to the Create* functions. |
| 68 struct CC_EXPORT InitParams { | 70 struct CC_EXPORT InitParams { |
| 69 LayerTreeHostClient* client = nullptr; | 71 LayerTreeHostClient* client = nullptr; |
| 70 TaskGraphRunner* task_graph_runner = nullptr; | 72 TaskGraphRunner* task_graph_runner = nullptr; |
| 71 LayerTreeSettings const* settings = nullptr; | 73 LayerTreeSettings const* settings = nullptr; |
| 72 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; | 74 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner; |
| 73 MutatorHost* mutator_host = nullptr; | 75 MutatorHost* mutator_host = nullptr; |
| 74 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner; | 76 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 87 | 89 |
| 88 ~LayerTreeHost() override; | 90 ~LayerTreeHost() override; |
| 89 | 91 |
| 90 // Returns the process global unique identifier for this LayerTreeHost. | 92 // Returns the process global unique identifier for this LayerTreeHost. |
| 91 int GetId() const; | 93 int GetId() const; |
| 92 | 94 |
| 93 // The current source frame number. This is incremented for each main frame | 95 // The current source frame number. This is incremented for each main frame |
| 94 // update(commit) pushed to the compositor thread. | 96 // update(commit) pushed to the compositor thread. |
| 95 int SourceFrameNumber() const; | 97 int SourceFrameNumber() const; |
| 96 | 98 |
| 97 // Returns the LayerTree that holds the main frame state pushed to the | |
| 98 // LayerTreeImpl on commit. | |
| 99 LayerTree* GetLayerTree(); | |
| 100 const LayerTree* GetLayerTree() const; | |
| 101 | |
| 102 // Returns the UIResourceManager used to create UIResources for | 99 // Returns the UIResourceManager used to create UIResources for |
| 103 // UIResourceLayers pushed to the LayerTree. | 100 // UIResourceLayers pushed to the LayerTree. |
| 104 UIResourceManager* GetUIResourceManager() const; | 101 UIResourceManager* GetUIResourceManager() const; |
| 105 | 102 |
| 106 // Returns the TaskRunnerProvider used to access the main and compositor | 103 // Returns the TaskRunnerProvider used to access the main and compositor |
| 107 // thread task runners. | 104 // thread task runners. |
| 108 TaskRunnerProvider* GetTaskRunnerProvider() const; | 105 TaskRunnerProvider* GetTaskRunnerProvider() const; |
| 109 | 106 |
| 110 // Returns the settings used by this host. | 107 // Returns the settings used by this host. |
| 111 const LayerTreeSettings& GetSettings() const; | 108 const LayerTreeSettings& GetSettings() const; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 // When the main thread informs the impl thread that it is ready to commit, | 225 // When the main thread informs the impl thread that it is ready to commit, |
| 229 // generally it would remain blocked till the main thread state is copied to | 226 // generally it would remain blocked till the main thread state is copied to |
| 230 // the pending tree. Calling this would ensure that the main thread remains | 227 // the pending tree. Calling this would ensure that the main thread remains |
| 231 // blocked till the pending tree is activated. | 228 // blocked till the pending tree is activated. |
| 232 void SetNextCommitWaitsForActivation(); | 229 void SetNextCommitWaitsForActivation(); |
| 233 | 230 |
| 234 // The LayerTreeHost tracks whether the content is suitable for Gpu raster. | 231 // The LayerTreeHost tracks whether the content is suitable for Gpu raster. |
| 235 // Calling this will reset it back to not suitable state. | 232 // Calling this will reset it back to not suitable state. |
| 236 void ResetGpuRasterizationTracking(); | 233 void ResetGpuRasterizationTracking(); |
| 237 | 234 |
| 238 // SurfaceReferenceOwner implementation. | 235 void SetRootLayer(scoped_refptr<Layer> root_layer); |
| 239 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override; | 236 Layer* root_layer() { return root_layer_.get(); } |
| 237 const Layer* root_layer() const { return root_layer_.get(); } |
| 238 |
| 239 void RegisterViewportLayers(scoped_refptr<Layer> overscroll_elasticity_layer, |
| 240 scoped_refptr<Layer> page_scale_layer, |
| 241 scoped_refptr<Layer> inner_viewport_scroll_layer, |
| 242 scoped_refptr<Layer> outer_viewport_scroll_layer); |
| 243 |
| 244 Layer* overscroll_elasticity_layer() const { |
| 245 return overscroll_elasticity_layer_.get(); |
| 246 } |
| 247 Layer* page_scale_layer() const { return page_scale_layer_.get(); } |
| 248 Layer* inner_viewport_scroll_layer() const { |
| 249 return inner_viewport_scroll_layer_.get(); |
| 250 } |
| 251 Layer* outer_viewport_scroll_layer() const { |
| 252 return outer_viewport_scroll_layer_.get(); |
| 253 } |
| 254 |
| 255 void RegisterSelection(const LayerSelection& selection); |
| 256 const LayerSelection& selection() const { return selection_; } |
| 257 |
| 258 void SetHaveScrollEventHandlers(bool have_event_handlers); |
| 259 bool have_scroll_event_handlers() const { |
| 260 return have_scroll_event_handlers_; |
| 261 } |
| 262 |
| 263 void SetEventListenerProperties(EventListenerClass event_class, |
| 264 EventListenerProperties event_properties); |
| 265 EventListenerProperties event_listener_properties( |
| 266 EventListenerClass event_class) const { |
| 267 return event_listener_properties_[static_cast<size_t>(event_class)]; |
| 268 } |
| 269 |
| 270 void SetViewportSize(const gfx::Size& device_viewport_size); |
| 271 gfx::Size device_viewport_size() const { return device_viewport_size_; } |
| 272 |
| 273 void SetBrowserControlsHeight(float height, bool shrink); |
| 274 void SetBrowserControlsShownRatio(float ratio); |
| 275 void SetBottomControlsHeight(float height); |
| 276 |
| 277 void SetPageScaleFactorAndLimits(float page_scale_factor, |
| 278 float min_page_scale_factor, |
| 279 float max_page_scale_factor); |
| 280 float page_scale_factor() const { return page_scale_factor_; } |
| 281 float min_page_scale_factor() const { return min_page_scale_factor_; } |
| 282 float max_page_scale_factor() const { return max_page_scale_factor_; } |
| 283 |
| 284 void set_background_color(SkColor color) { background_color_ = color; } |
| 285 SkColor background_color() const { return background_color_; } |
| 286 |
| 287 void set_has_transparent_background(bool transparent) { |
| 288 has_transparent_background_ = transparent; |
| 289 } |
| 290 bool has_transparent_background() const { |
| 291 return has_transparent_background_; |
| 292 } |
| 293 |
| 294 void StartPageScaleAnimation(const gfx::Vector2d& target_offset, |
| 295 bool use_anchor, |
| 296 float scale, |
| 297 base::TimeDelta duration); |
| 298 bool HasPendingPageScaleAnimation() const; |
| 299 |
| 300 void SetDeviceScaleFactor(float device_scale_factor); |
| 301 float device_scale_factor() const { return device_scale_factor_; } |
| 302 |
| 303 void SetPaintedDeviceScaleFactor(float painted_device_scale_factor); |
| 304 float painted_device_scale_factor() const { |
| 305 return painted_device_scale_factor_; |
| 306 } |
| 307 |
| 308 void SetDeviceColorSpace(const gfx::ColorSpace& device_color_space); |
| 309 const gfx::ColorSpace& device_color_space() const { |
| 310 return device_color_space_; |
| 311 } |
| 312 |
| 313 // Used externally by blink for setting the PropertyTrees when |
| 314 // |settings_.use_layer_lists| is true. This is a SPV2 setting. |
| 315 PropertyTrees* property_trees() { return &property_trees_; } |
| 316 |
| 317 void SetNeedsDisplayOnAllLayers(); |
| 318 |
| 319 void RegisterLayer(Layer* layer); |
| 320 void UnregisterLayer(Layer* layer); |
| 321 Layer* LayerById(int id) const; |
| 322 |
| 323 size_t NumLayers() const; |
| 324 |
| 325 bool UpdateLayers(const LayerList& update_layer_list, |
| 326 bool* content_is_suitable_for_gpu); |
| 327 bool in_paint_layer_contents() const { return in_paint_layer_contents_; } |
| 328 |
| 329 void AddLayerShouldPushProperties(Layer* layer); |
| 330 void RemoveLayerShouldPushProperties(Layer* layer); |
| 331 std::unordered_set<Layer*>& LayersThatShouldPushProperties(); |
| 332 bool LayerNeedsPushPropertiesForTesting(Layer* layer) const; |
| 333 |
| 334 virtual void SetNeedsMetaInfoRecomputation( |
| 335 bool needs_meta_info_recomputation); |
| 336 bool needs_meta_info_recomputation() const { |
| 337 return needs_meta_info_recomputation_; |
| 338 } |
| 339 |
| 340 void SetPageScaleFromImplSide(float page_scale); |
| 341 void SetElasticOverscrollFromImplSide(gfx::Vector2dF elastic_overscroll); |
| 342 gfx::Vector2dF elastic_overscroll() const { return elastic_overscroll_; } |
| 343 |
| 344 void UpdateHudLayer(bool show_hud_info); |
| 345 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } |
| 346 |
| 347 virtual void SetNeedsFullTreeSync(); |
| 348 bool needs_full_tree_sync() const { return needs_full_tree_sync_; } |
| 349 |
| 350 void SetPropertyTreesNeedRebuild(); |
| 351 |
| 352 void PushPropertiesTo(LayerTreeImpl* tree_impl); |
| 353 |
| 354 MutatorHost* mutator_host() const { return mutator_host_; } |
| 355 |
| 356 Layer* LayerByElementId(ElementId element_id) const; |
| 357 void RegisterElement(ElementId element_id, |
| 358 ElementListType list_type, |
| 359 Layer* layer); |
| 360 void UnregisterElement(ElementId element_id, |
| 361 ElementListType list_type, |
| 362 Layer* layer); |
| 363 void SetElementIdsForTesting(); |
| 364 |
| 365 void BuildPropertyTreesForTesting(); |
| 366 |
| 367 // Layer iterators. |
| 368 LayerListIterator<Layer> begin() const; |
| 369 LayerListIterator<Layer> end() const; |
| 370 LayerListReverseIterator<Layer> rbegin(); |
| 371 LayerListReverseIterator<Layer> rend(); |
| 240 | 372 |
| 241 // LayerTreeHostInProcess interface to Proxy. | 373 // LayerTreeHostInProcess interface to Proxy. |
| 242 void WillBeginMainFrame(); | 374 void WillBeginMainFrame(); |
| 243 void DidBeginMainFrame(); | 375 void DidBeginMainFrame(); |
| 244 void BeginMainFrame(const BeginFrameArgs& args); | 376 void BeginMainFrame(const BeginFrameArgs& args); |
| 245 void BeginMainFrameNotExpectedSoon(); | 377 void BeginMainFrameNotExpectedSoon(); |
| 246 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); | 378 void AnimateLayers(base::TimeTicks monotonic_frame_begin_time); |
| 247 void RequestMainFrameUpdate(); | 379 void RequestMainFrameUpdate(); |
| 248 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); | 380 void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); |
| 249 void WillCommit(); | 381 void WillCommit(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 279 | 411 |
| 280 bool has_gpu_rasterization_trigger() const { | 412 bool has_gpu_rasterization_trigger() const { |
| 281 return has_gpu_rasterization_trigger_; | 413 return has_gpu_rasterization_trigger_; |
| 282 } | 414 } |
| 283 | 415 |
| 284 Proxy* proxy() const { return proxy_.get(); } | 416 Proxy* proxy() const { return proxy_.get(); } |
| 285 | 417 |
| 286 bool IsSingleThreaded() const; | 418 bool IsSingleThreaded() const; |
| 287 bool IsThreaded() const; | 419 bool IsThreaded() const; |
| 288 | 420 |
| 421 // SurfaceReferenceOwner implementation. |
| 422 SurfaceSequenceGenerator* GetSurfaceSequenceGenerator() override; |
| 423 |
| 424 // MutatorHostClient implementation. |
| 425 bool IsElementInList(ElementId element_id, |
| 426 ElementListType list_type) const override; |
| 427 void SetMutatorsNeedCommit() override; |
| 428 void SetMutatorsNeedRebuildPropertyTrees() override; |
| 429 void SetElementFilterMutated(ElementId element_id, |
| 430 ElementListType list_type, |
| 431 const FilterOperations& filters) override; |
| 432 void SetElementOpacityMutated(ElementId element_id, |
| 433 ElementListType list_type, |
| 434 float opacity) override; |
| 435 void SetElementTransformMutated(ElementId element_id, |
| 436 ElementListType list_type, |
| 437 const gfx::Transform& transform) override; |
| 438 void SetElementScrollOffsetMutated( |
| 439 ElementId element_id, |
| 440 ElementListType list_type, |
| 441 const gfx::ScrollOffset& scroll_offset) override; |
| 442 |
| 443 void ElementIsAnimatingChanged(ElementId element_id, |
| 444 ElementListType list_type, |
| 445 const PropertyAnimationState& mask, |
| 446 const PropertyAnimationState& state) override; |
| 447 |
| 448 void ScrollOffsetAnimationFinished() override {} |
| 449 gfx::ScrollOffset GetScrollOffsetForAnimation( |
| 450 ElementId element_id) const override; |
| 451 |
| 289 protected: | 452 protected: |
| 290 // Allow tests to inject the LayerTree. | |
| 291 LayerTreeHost(InitParams* params, | |
| 292 CompositorMode mode, | |
| 293 std::unique_ptr<LayerTree> layer_tree); | |
| 294 LayerTreeHost(InitParams* params, CompositorMode mode); | 453 LayerTreeHost(InitParams* params, CompositorMode mode); |
| 295 | 454 |
| 296 void InitializeThreaded( | 455 void InitializeThreaded( |
| 297 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 456 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 298 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | 457 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); |
| 299 void InitializeSingleThreaded( | 458 void InitializeSingleThreaded( |
| 300 LayerTreeHostSingleThreadClient* single_thread_client, | 459 LayerTreeHostSingleThreadClient* single_thread_client, |
| 301 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | 460 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); |
| 302 void InitializeForTesting( | 461 void InitializeForTesting( |
| 303 std::unique_ptr<TaskRunnerProvider> task_runner_provider, | 462 std::unique_ptr<TaskRunnerProvider> task_runner_provider, |
| 304 std::unique_ptr<Proxy> proxy_for_testing); | 463 std::unique_ptr<Proxy> proxy_for_testing); |
| 305 void SetTaskRunnerProviderForTesting( | 464 void SetTaskRunnerProviderForTesting( |
| 306 std::unique_ptr<TaskRunnerProvider> task_runner_provider); | 465 std::unique_ptr<TaskRunnerProvider> task_runner_provider); |
| 307 void SetUIResourceManagerForTesting( | 466 void SetUIResourceManagerForTesting( |
| 308 std::unique_ptr<UIResourceManager> ui_resource_manager); | 467 std::unique_ptr<UIResourceManager> ui_resource_manager); |
| 309 | 468 |
| 310 // task_graph_runner() returns a valid value only until the LayerTreeHostImpl | 469 // task_graph_runner() returns a valid value only until the LayerTreeHostImpl |
| 311 // is created in CreateLayerTreeHostImpl(). | 470 // is created in CreateLayerTreeHostImpl(). |
| 312 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } | 471 TaskGraphRunner* task_graph_runner() const { return task_graph_runner_; } |
| 313 | 472 |
| 314 void OnCommitForSwapPromises(); | 473 void OnCommitForSwapPromises(); |
| 315 | 474 |
| 316 void RecordGpuRasterizationHistogram(); | 475 void RecordGpuRasterizationHistogram(); |
| 317 | 476 |
| 318 MicroBenchmarkController micro_benchmark_controller_; | 477 MicroBenchmarkController micro_benchmark_controller_; |
| 319 | 478 |
| 320 std::unique_ptr<LayerTree> layer_tree_; | |
| 321 | |
| 322 base::WeakPtr<InputHandler> input_handler_weak_ptr_; | 479 base::WeakPtr<InputHandler> input_handler_weak_ptr_; |
| 323 | 480 |
| 324 private: | 481 private: |
| 325 friend class LayerTreeHostSerializationTest; | 482 friend class LayerTreeHostSerializationTest; |
| 326 | 483 |
| 327 // This is the number of consecutive frames in which we want the content to be | 484 // This is the number of consecutive frames in which we want the content to be |
| 328 // suitable for GPU rasterization before re-enabling it. | 485 // suitable for GPU rasterization before re-enabling it. |
| 329 enum { kNumFramesToConsiderBeforeGpuRasterization = 60 }; | 486 enum { kNumFramesToConsiderBeforeGpuRasterization = 60 }; |
| 330 | 487 |
| 331 void ApplyViewportDeltas(ScrollAndScaleSet* info); | 488 void ApplyViewportDeltas(ScrollAndScaleSet* info); |
| 332 void ApplyPageScaleDeltaFromImplSide(float page_scale_delta); | 489 void ApplyPageScaleDeltaFromImplSide(float page_scale_delta); |
| 333 void InitializeProxy(std::unique_ptr<Proxy> proxy); | 490 void InitializeProxy(std::unique_ptr<Proxy> proxy); |
| 334 | 491 |
| 335 bool DoUpdateLayers(Layer* root_layer); | 492 bool DoUpdateLayers(Layer* root_layer); |
| 336 void UpdateHudLayer(); | 493 void UpdateHudLayer(); |
| 337 | 494 |
| 338 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); | 495 bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); |
| 339 | 496 |
| 340 void CalculateLCDTextMetricsCallback(Layer* layer); | 497 void CalculateLCDTextMetricsCallback(Layer* layer); |
| 341 | 498 |
| 342 void SetPropertyTreesNeedRebuild(); | |
| 343 | |
| 344 const CompositorMode compositor_mode_; | 499 const CompositorMode compositor_mode_; |
| 345 | 500 |
| 346 std::unique_ptr<UIResourceManager> ui_resource_manager_; | 501 std::unique_ptr<UIResourceManager> ui_resource_manager_; |
| 347 | 502 |
| 348 LayerTreeHostClient* client_; | 503 LayerTreeHostClient* client_; |
| 349 std::unique_ptr<Proxy> proxy_; | 504 std::unique_ptr<Proxy> proxy_; |
| 350 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; | 505 std::unique_ptr<TaskRunnerProvider> task_runner_provider_; |
| 351 | 506 |
| 352 int source_frame_number_; | 507 int source_frame_number_ = 0U; |
| 353 std::unique_ptr<RenderingStatsInstrumentation> | 508 std::unique_ptr<RenderingStatsInstrumentation> |
| 354 rendering_stats_instrumentation_; | 509 rendering_stats_instrumentation_; |
| 355 | 510 |
| 356 SwapPromiseManager swap_promise_manager_; | 511 SwapPromiseManager swap_promise_manager_; |
| 357 | 512 |
| 358 // |current_compositor_frame_sink_| can't be updated until we've successfully | 513 // |current_compositor_frame_sink_| can't be updated until we've successfully |
| 359 // initialized a new CompositorFrameSink. |new_compositor_frame_sink_| | 514 // initialized a new CompositorFrameSink. |new_compositor_frame_sink_| |
| 360 // contains the new CompositorFrameSink that is currently being initialized. | 515 // contains the new CompositorFrameSink that is currently being initialized. |
| 361 // If initialization is successful then |new_compositor_frame_sink_| replaces | 516 // If initialization is successful then |new_compositor_frame_sink_| replaces |
| 362 // |current_compositor_frame_sink_|. | 517 // |current_compositor_frame_sink_|. |
| 363 std::unique_ptr<CompositorFrameSink> new_compositor_frame_sink_; | 518 std::unique_ptr<CompositorFrameSink> new_compositor_frame_sink_; |
| 364 std::unique_ptr<CompositorFrameSink> current_compositor_frame_sink_; | 519 std::unique_ptr<CompositorFrameSink> current_compositor_frame_sink_; |
| 365 | 520 |
| 366 const LayerTreeSettings settings_; | 521 const LayerTreeSettings settings_; |
| 367 LayerTreeDebugState debug_state_; | 522 LayerTreeDebugState debug_state_; |
| 368 | 523 |
| 369 bool visible_; | 524 bool visible_ = false; |
| 370 | 525 |
| 371 bool has_gpu_rasterization_trigger_; | 526 bool has_gpu_rasterization_trigger_ = false; |
| 372 bool content_is_suitable_for_gpu_rasterization_; | 527 bool content_is_suitable_for_gpu_rasterization_ = true; |
| 373 bool gpu_rasterization_histogram_recorded_; | 528 bool gpu_rasterization_histogram_recorded_ = false; |
| 374 | 529 |
| 375 // If set, then page scale animation has completed, but the client hasn't been | 530 // If set, then page scale animation has completed, but the client hasn't been |
| 376 // notified about it yet. | 531 // notified about it yet. |
| 377 bool did_complete_scale_animation_; | 532 bool did_complete_scale_animation_ = false; |
| 378 | 533 |
| 379 int id_; | 534 int id_; |
| 380 bool next_commit_forces_redraw_ = false; | 535 bool next_commit_forces_redraw_ = false; |
| 381 bool next_commit_forces_recalculate_raster_scales_ = false; | 536 bool next_commit_forces_recalculate_raster_scales_ = false; |
| 382 // Track when we're inside a main frame to see if compositor is being | 537 // Track when we're inside a main frame to see if compositor is being |
| 383 // destroyed midway which causes a crash. crbug.com/654672 | 538 // destroyed midway which causes a crash. crbug.com/654672 |
| 384 bool inside_main_frame_ = false; | 539 bool inside_main_frame_ = false; |
| 385 | 540 |
| 386 TaskGraphRunner* task_graph_runner_; | 541 TaskGraphRunner* task_graph_runner_; |
| 387 | 542 |
| 388 SurfaceSequenceGenerator surface_sequence_generator_; | 543 SurfaceSequenceGenerator surface_sequence_generator_; |
| 389 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; | 544 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; |
| 390 | 545 |
| 546 scoped_refptr<Layer> root_layer_; |
| 547 |
| 548 scoped_refptr<Layer> overscroll_elasticity_layer_; |
| 549 scoped_refptr<Layer> page_scale_layer_; |
| 550 scoped_refptr<Layer> inner_viewport_scroll_layer_; |
| 551 scoped_refptr<Layer> outer_viewport_scroll_layer_; |
| 552 |
| 553 float top_controls_height_ = 0.f; |
| 554 float top_controls_shown_ratio_ = 0.f; |
| 555 bool browser_controls_shrink_blink_size_ = false; |
| 556 |
| 557 float bottom_controls_height_ = 0.f; |
| 558 |
| 559 float device_scale_factor_ = 1.f; |
| 560 float painted_device_scale_factor_ = 1.f; |
| 561 float page_scale_factor_ = 1.f; |
| 562 float min_page_scale_factor_ = 1.f; |
| 563 float max_page_scale_factor_ = 1.f; |
| 564 gfx::ColorSpace device_color_space_; |
| 565 |
| 566 SkColor background_color_ = SK_ColorWHITE; |
| 567 bool has_transparent_background_ = false; |
| 568 |
| 569 LayerSelection selection_; |
| 570 |
| 571 gfx::Size device_viewport_size_; |
| 572 |
| 573 bool have_scroll_event_handlers_ = false; |
| 574 EventListenerProperties event_listener_properties_[static_cast<size_t>( |
| 575 EventListenerClass::kNumClasses)]; |
| 576 |
| 577 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
| 578 |
| 579 PropertyTrees property_trees_; |
| 580 |
| 581 bool needs_full_tree_sync_ = true; |
| 582 bool needs_meta_info_recomputation_ = true; |
| 583 |
| 584 gfx::Vector2dF elastic_overscroll_; |
| 585 |
| 586 scoped_refptr<HeadsUpDisplayLayer> hud_layer_; |
| 587 |
| 588 // Set of layers that need to push properties. |
| 589 std::unordered_set<Layer*> layers_that_should_push_properties_; |
| 590 |
| 591 // Layer id to Layer map. |
| 592 std::unordered_map<int, Layer*> layer_id_map_; |
| 593 |
| 594 std::unordered_map<ElementId, Layer*, ElementIdHash> element_layers_map_; |
| 595 |
| 596 bool in_paint_layer_contents_ = false; |
| 597 |
| 598 MutatorHost* mutator_host_; |
| 599 |
| 391 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner_; | 600 scoped_refptr<base::SequencedTaskRunner> image_worker_task_runner_; |
| 392 | 601 |
| 393 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); | 602 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); |
| 394 }; | 603 }; |
| 395 | 604 |
| 396 } // namespace cc | 605 } // namespace cc |
| 397 | 606 |
| 398 #endif // CC_TREES_LAYER_TREE_HOST_H_ | 607 #endif // CC_TREES_LAYER_TREE_HOST_H_ |
| OLD | NEW |