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

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

Issue 2159513003: Setup LayerTree class, refactor 2 functions from LayerTreeHost to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add proto to gyp file and modify inproper comment. Created 4 years, 5 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 22 matching lines...) Expand all
33 #include "cc/input/top_controls_state.h" 33 #include "cc/input/top_controls_state.h"
34 #include "cc/layers/layer_collections.h" 34 #include "cc/layers/layer_collections.h"
35 #include "cc/layers/layer_list_iterator.h" 35 #include "cc/layers/layer_list_iterator.h"
36 #include "cc/output/output_surface.h" 36 #include "cc/output/output_surface.h"
37 #include "cc/output/renderer_capabilities.h" 37 #include "cc/output/renderer_capabilities.h"
38 #include "cc/output/swap_promise.h" 38 #include "cc/output/swap_promise.h"
39 #include "cc/resources/resource_format.h" 39 #include "cc/resources/resource_format.h"
40 #include "cc/resources/scoped_ui_resource.h" 40 #include "cc/resources/scoped_ui_resource.h"
41 #include "cc/surfaces/surface_sequence.h" 41 #include "cc/surfaces/surface_sequence.h"
42 #include "cc/trees/compositor_mode.h" 42 #include "cc/trees/compositor_mode.h"
43 #include "cc/trees/layer_tree.h"
43 #include "cc/trees/layer_tree_host_client.h" 44 #include "cc/trees/layer_tree_host_client.h"
44 #include "cc/trees/layer_tree_settings.h" 45 #include "cc/trees/layer_tree_settings.h"
45 #include "cc/trees/mutator_host_client.h" 46 #include "cc/trees/mutator_host_client.h"
46 #include "cc/trees/proxy.h" 47 #include "cc/trees/proxy.h"
47 #include "cc/trees/swap_promise_monitor.h" 48 #include "cc/trees/swap_promise_monitor.h"
48 #include "third_party/skia/include/core/SkColor.h" 49 #include "third_party/skia/include/core/SkColor.h"
49 #include "ui/gfx/geometry/rect.h" 50 #include "ui/gfx/geometry/rect.h"
50 51
51 namespace gpu { 52 namespace gpu {
52 class GpuMemoryBufferManager; 53 class GpuMemoryBufferManager;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 void UpdateTopControlsState(TopControlsState constraints, 289 void UpdateTopControlsState(TopControlsState constraints,
289 TopControlsState current, 290 TopControlsState current,
290 bool animate); 291 bool animate);
291 292
292 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } 293 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); }
293 294
294 Proxy* proxy() const { return proxy_.get(); } 295 Proxy* proxy() const { return proxy_.get(); }
295 TaskRunnerProvider* task_runner_provider() const { 296 TaskRunnerProvider* task_runner_provider() const {
296 return task_runner_provider_.get(); 297 return task_runner_provider_.get();
297 } 298 }
298 AnimationHost* animation_host() const { return animation_host_.get(); } 299 AnimationHost* animation_host() const;
299
300 bool in_paint_layer_contents() const { return in_paint_layer_contents_; }
301 300
302 // CreateUIResource creates a resource given a bitmap. The bitmap is 301 // CreateUIResource creates a resource given a bitmap. The bitmap is
303 // generated via an interface function, which is called when initializing the 302 // generated via an interface function, which is called when initializing the
304 // resource and when the resource has been lost (due to lost context). The 303 // resource and when the resource has been lost (due to lost context). The
305 // parameter of the interface is a single boolean, which indicates whether the 304 // parameter of the interface is a single boolean, which indicates whether the
306 // resource has been lost or not. CreateUIResource returns an Id of the 305 // resource has been lost or not. CreateUIResource returns an Id of the
307 // resource, which is always positive. 306 // resource, which is always positive.
308 virtual UIResourceId CreateUIResource(UIResourceClient* client); 307 virtual UIResourceId CreateUIResource(UIResourceClient* client);
309 // Deletes a UI resource. May safely be called more than once. 308 // Deletes a UI resource. May safely be called more than once.
310 virtual void DeleteUIResource(UIResourceId id); 309 virtual void DeleteUIResource(UIResourceId id);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 347 }
349 348
350 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator); 349 void SetLayerTreeMutator(std::unique_ptr<LayerTreeMutator> mutator);
351 350
352 Layer* LayerById(int id) const; 351 Layer* LayerById(int id) const;
353 352
354 Layer* LayerByElementId(ElementId element_id) const; 353 Layer* LayerByElementId(ElementId element_id) const;
355 void AddToElementMap(Layer* layer); 354 void AddToElementMap(Layer* layer);
356 void RemoveFromElementMap(Layer* layer); 355 void RemoveFromElementMap(Layer* layer);
357 356
358 void AddLayerShouldPushProperties(Layer* layer);
359 void RemoveLayerShouldPushProperties(Layer* layer);
360 std::unordered_set<Layer*>& LayersThatShouldPushProperties();
361 bool LayerNeedsPushPropertiesForTesting(Layer* layer);
362
363 void RegisterLayer(Layer* layer);
364 void UnregisterLayer(Layer* layer);
365 // MutatorHostClient implementation. 357 // MutatorHostClient implementation.
366 bool IsElementInList(ElementId element_id, 358 bool IsElementInList(ElementId element_id,
367 ElementListType list_type) const override; 359 ElementListType list_type) const override;
368 void SetMutatorsNeedCommit() override; 360 void SetMutatorsNeedCommit() override;
369 void SetMutatorsNeedRebuildPropertyTrees() override; 361 void SetMutatorsNeedRebuildPropertyTrees() override;
370 void SetElementFilterMutated(ElementId element_id, 362 void SetElementFilterMutated(ElementId element_id,
371 ElementListType list_type, 363 ElementListType list_type,
372 const FilterOperations& filters) override; 364 const FilterOperations& filters) override;
373 void SetElementOpacityMutated(ElementId element_id, 365 void SetElementOpacityMutated(ElementId element_id,
374 ElementListType list_type, 366 ElementListType list_type,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 } 411 }
420 412
421 EnginePictureCache* engine_picture_cache() const { 413 EnginePictureCache* engine_picture_cache() const {
422 return engine_picture_cache_ ? engine_picture_cache_.get() : nullptr; 414 return engine_picture_cache_ ? engine_picture_cache_.get() : nullptr;
423 } 415 }
424 416
425 ClientPictureCache* client_picture_cache() const { 417 ClientPictureCache* client_picture_cache() const {
426 return client_picture_cache_ ? client_picture_cache_.get() : nullptr; 418 return client_picture_cache_ ? client_picture_cache_.get() : nullptr;
427 } 419 }
428 420
421 LayerTree* GetLayerTree() { return &layer_tree_; }
422 const LayerTree* GetLayerTree() const { return &layer_tree_; }
423
429 protected: 424 protected:
430 LayerTreeHost(InitParams* params, CompositorMode mode); 425 LayerTreeHost(InitParams* params, CompositorMode mode);
431 void InitializeThreaded( 426 void InitializeThreaded(
432 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 427 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
433 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, 428 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner,
434 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 429 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
435 void InitializeSingleThreaded( 430 void InitializeSingleThreaded(
436 LayerTreeHostSingleThreadClient* single_thread_client, 431 LayerTreeHostSingleThreadClient* single_thread_client,
437 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, 432 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
438 std::unique_ptr<BeginFrameSource> external_begin_frame_source); 433 std::unique_ptr<BeginFrameSource> external_begin_frame_source);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 bool content_is_suitable_for_gpu_rasterization_; 549 bool content_is_suitable_for_gpu_rasterization_;
555 bool gpu_rasterization_histogram_recorded_; 550 bool gpu_rasterization_histogram_recorded_;
556 551
557 SkColor background_color_; 552 SkColor background_color_;
558 bool has_transparent_background_; 553 bool has_transparent_background_;
559 554
560 bool have_scroll_event_handlers_; 555 bool have_scroll_event_handlers_;
561 EventListenerProperties event_listener_properties_[static_cast<size_t>( 556 EventListenerProperties event_listener_properties_[static_cast<size_t>(
562 EventListenerClass::kNumClasses)]; 557 EventListenerClass::kNumClasses)];
563 558
564 std::unique_ptr<AnimationHost> animation_host_;
565
566 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; 559 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_;
567 560
568 // If set, then page scale animation has completed, but the client hasn't been 561 // If set, then page scale animation has completed, but the client hasn't been
569 // notified about it yet. 562 // notified about it yet.
570 bool did_complete_scale_animation_; 563 bool did_complete_scale_animation_;
571 564
572 bool in_paint_layer_contents_;
573
574 int id_; 565 int id_;
575 bool next_commit_forces_redraw_; 566 bool next_commit_forces_redraw_;
576 567
577 scoped_refptr<Layer> overscroll_elasticity_layer_; 568 scoped_refptr<Layer> overscroll_elasticity_layer_;
578 scoped_refptr<Layer> page_scale_layer_; 569 scoped_refptr<Layer> page_scale_layer_;
579 scoped_refptr<Layer> inner_viewport_scroll_layer_; 570 scoped_refptr<Layer> inner_viewport_scroll_layer_;
580 scoped_refptr<Layer> outer_viewport_scroll_layer_; 571 scoped_refptr<Layer> outer_viewport_scroll_layer_;
581 572
582 LayerSelection selection_; 573 LayerSelection selection_;
583 574
584 SharedBitmapManager* shared_bitmap_manager_; 575 SharedBitmapManager* shared_bitmap_manager_;
585 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 576 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
586 TaskGraphRunner* task_graph_runner_; 577 TaskGraphRunner* task_graph_runner_;
587 578
588 ImageSerializationProcessor* image_serialization_processor_; 579 ImageSerializationProcessor* image_serialization_processor_;
589 std::unique_ptr<EnginePictureCache> engine_picture_cache_; 580 std::unique_ptr<EnginePictureCache> engine_picture_cache_;
590 std::unique_ptr<ClientPictureCache> client_picture_cache_; 581 std::unique_ptr<ClientPictureCache> client_picture_cache_;
591 582
592 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; 583 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_;
593 std::set<SwapPromiseMonitor*> swap_promise_monitor_; 584 std::set<SwapPromiseMonitor*> swap_promise_monitor_;
594 585
595 PropertyTrees property_trees_; 586 PropertyTrees property_trees_;
596 587
597 using LayerIdMap = std::unordered_map<int, Layer*>;
598 LayerIdMap layer_id_map_;
599
600 using ElementLayersMap = std::unordered_map<ElementId, Layer*, ElementIdHash>; 588 using ElementLayersMap = std::unordered_map<ElementId, Layer*, ElementIdHash>;
601 ElementLayersMap element_layers_map_; 589 ElementLayersMap element_layers_map_;
602 590
603 // Set of layers that need to push properties.
604 std::unordered_set<Layer*> layers_that_should_push_properties_;
605
606 uint32_t surface_client_id_; 591 uint32_t surface_client_id_;
607 uint32_t next_surface_sequence_; 592 uint32_t next_surface_sequence_;
608 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0; 593 uint32_t num_consecutive_frames_suitable_for_gpu_ = 0;
609 594
595 // Layer tree that hold layers.
596 LayerTree layer_tree_;
vmpstr 2016/07/25 20:45:46 Which of the LTH members will go into LayerTree?
xingliu 2016/07/25 23:40:25 Animation host, data structure to hold layers, Mut
Khushal 2016/07/26 18:10:42 Yup, basically all data that is mutated/computed o
597
610 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); 598 DISALLOW_COPY_AND_ASSIGN(LayerTreeHost);
611 }; 599 };
612 600
613 } // namespace cc 601 } // namespace cc
614 602
615 #endif // CC_TREES_LAYER_TREE_HOST_H_ 603 #endif // CC_TREES_LAYER_TREE_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698