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

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

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

Powered by Google App Engine
This is Rietveld 408576698