OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_IMPL_H_ | 5 #ifndef CC_TREES_LAYER_TREE_IMPL_H_ |
6 #define CC_TREES_LAYER_TREE_IMPL_H_ | 6 #define CC_TREES_LAYER_TREE_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 class PageScaleAnimation; | 46 class PageScaleAnimation; |
47 class PictureLayerImpl; | 47 class PictureLayerImpl; |
48 class TaskRunnerProvider; | 48 class TaskRunnerProvider; |
49 class ResourceProvider; | 49 class ResourceProvider; |
50 class TileManager; | 50 class TileManager; |
51 class UIResourceRequest; | 51 class UIResourceRequest; |
52 class VideoFrameControllerClient; | 52 class VideoFrameControllerClient; |
53 struct PendingPageScaleAnimation; | 53 struct PendingPageScaleAnimation; |
54 | 54 |
55 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; | 55 typedef std::vector<UIResourceRequest> UIResourceRequestQueue; |
56 typedef SyncedProperty<AdditionGroup<float>> SyncedTopControls; | 56 typedef SyncedProperty<AdditionGroup<float>> SyncedBrowserControls; |
57 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; | 57 typedef SyncedProperty<AdditionGroup<gfx::Vector2dF>> SyncedElasticOverscroll; |
58 | 58 |
59 class CC_EXPORT LayerTreeImpl { | 59 class CC_EXPORT LayerTreeImpl { |
60 public: | 60 public: |
61 // This is the number of times a fixed point has to be hit contiuously by a | 61 // This is the number of times a fixed point has to be hit contiuously by a |
62 // layer to consider it as jittering. | 62 // layer to consider it as jittering. |
63 enum : int { kFixedPointHitsThreshold = 3 }; | 63 enum : int { kFixedPointHitsThreshold = 3 }; |
64 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl, | 64 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl, |
65 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, | 65 scoped_refptr<SyncedProperty<ScaleGroup>> page_scale_factor, |
66 scoped_refptr<SyncedTopControls> top_controls_shown_ratio, | 66 scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio, |
67 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); | 67 scoped_refptr<SyncedElasticOverscroll> elastic_overscroll); |
68 virtual ~LayerTreeImpl(); | 68 virtual ~LayerTreeImpl(); |
69 | 69 |
70 void Shutdown(); | 70 void Shutdown(); |
71 void ReleaseResources(); | 71 void ReleaseResources(); |
72 void RecreateResources(); | 72 void RecreateResources(); |
73 | 73 |
74 // Methods called by the layer tree that pass-through or access LTHI. | 74 // Methods called by the layer tree that pass-through or access LTHI. |
75 // --------------------------------------------------------------------------- | 75 // --------------------------------------------------------------------------- |
76 const LayerTreeSettings& settings() const; | 76 const LayerTreeSettings& settings() const; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 return device_color_space_; | 238 return device_color_space_; |
239 } | 239 } |
240 | 240 |
241 SyncedElasticOverscroll* elastic_overscroll() { | 241 SyncedElasticOverscroll* elastic_overscroll() { |
242 return elastic_overscroll_.get(); | 242 return elastic_overscroll_.get(); |
243 } | 243 } |
244 const SyncedElasticOverscroll* elastic_overscroll() const { | 244 const SyncedElasticOverscroll* elastic_overscroll() const { |
245 return elastic_overscroll_.get(); | 245 return elastic_overscroll_.get(); |
246 } | 246 } |
247 | 247 |
248 SyncedTopControls* top_controls_shown_ratio() { | 248 SyncedBrowserControls* top_controls_shown_ratio() { |
249 return top_controls_shown_ratio_.get(); | 249 return top_controls_shown_ratio_.get(); |
250 } | 250 } |
251 const SyncedTopControls* top_controls_shown_ratio() const { | 251 const SyncedBrowserControls* top_controls_shown_ratio() const { |
252 return top_controls_shown_ratio_.get(); | 252 return top_controls_shown_ratio_.get(); |
253 } | 253 } |
254 | 254 |
255 void SetElementIdsForTesting(); | 255 void SetElementIdsForTesting(); |
256 | 256 |
257 // Updates draw properties and render surface layer list, as well as tile | 257 // Updates draw properties and render surface layer list, as well as tile |
258 // priorities. Returns false if it was unable to update. Updating lcd | 258 // priorities. Returns false if it was unable to update. Updating lcd |
259 // text may cause invalidations, so should only be done after a commit. | 259 // text may cause invalidations, so should only be done after a commit. |
260 bool UpdateDrawProperties( | 260 bool UpdateDrawProperties( |
261 bool update_lcd_text, | 261 bool update_lcd_text, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( | 404 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( |
405 const gfx::PointF& screen_space_point); | 405 const gfx::PointF& screen_space_point); |
406 | 406 |
407 void RegisterSelection(const LayerSelection& selection); | 407 void RegisterSelection(const LayerSelection& selection); |
408 | 408 |
409 // Compute the current selection handle location and visbility with respect to | 409 // Compute the current selection handle location and visbility with respect to |
410 // the viewport. | 410 // the viewport. |
411 void GetViewportSelection(Selection<gfx::SelectionBound>* selection); | 411 void GetViewportSelection(Selection<gfx::SelectionBound>* selection); |
412 | 412 |
413 void set_top_controls_shrink_blink_size(bool shrink); | 413 void set_browser_controls_shrink_blink_size(bool shrink); |
414 bool top_controls_shrink_blink_size() const { | 414 bool browser_controls_shrink_blink_size() const { |
415 return top_controls_shrink_blink_size_; | 415 return browser_controls_shrink_blink_size_; |
416 } | 416 } |
417 bool SetCurrentTopControlsShownRatio(float ratio); | 417 bool SetCurrentBrowserControlsShownRatio(float ratio); |
418 float CurrentTopControlsShownRatio() const { | 418 float CurrentBrowserControlsShownRatio() const { |
419 return top_controls_shown_ratio_->Current(IsActiveTree()); | 419 return top_controls_shown_ratio_->Current(IsActiveTree()); |
420 } | 420 } |
421 void set_top_controls_height(float top_controls_height); | 421 void set_top_controls_height(float top_controls_height); |
422 float top_controls_height() const { return top_controls_height_; } | 422 float top_controls_height() const { return top_controls_height_; } |
423 void PushTopControlsFromMainThread(float top_controls_shown_ratio); | 423 void PushBrowserControlsFromMainThread(float top_controls_shown_ratio); |
424 void set_bottom_controls_height(float bottom_controls_height); | 424 void set_bottom_controls_height(float bottom_controls_height); |
425 float bottom_controls_height() const { return bottom_controls_height_; } | 425 float bottom_controls_height() const { return bottom_controls_height_; } |
426 | 426 |
427 void SetPendingPageScaleAnimation( | 427 void SetPendingPageScaleAnimation( |
428 std::unique_ptr<PendingPageScaleAnimation> pending_animation); | 428 std::unique_ptr<PendingPageScaleAnimation> pending_animation); |
429 std::unique_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); | 429 std::unique_ptr<PendingPageScaleAnimation> TakePendingPageScaleAnimation(); |
430 | 430 |
431 void DidUpdateScrollOffset(int layer_id); | 431 void DidUpdateScrollOffset(int layer_id); |
432 void DidUpdateScrollState(int layer_id); | 432 void DidUpdateScrollState(int layer_id); |
433 | 433 |
(...skipping 27 matching lines...) Expand all Loading... |
461 protected: | 461 protected: |
462 float ClampPageScaleFactorToLimits(float page_scale_factor) const; | 462 float ClampPageScaleFactorToLimits(float page_scale_factor) const; |
463 void PushPageScaleFactorAndLimits(const float* page_scale_factor, | 463 void PushPageScaleFactorAndLimits(const float* page_scale_factor, |
464 float min_page_scale_factor, | 464 float min_page_scale_factor, |
465 float max_page_scale_factor); | 465 float max_page_scale_factor); |
466 bool SetPageScaleFactorLimits(float min_page_scale_factor, | 466 bool SetPageScaleFactorLimits(float min_page_scale_factor, |
467 float max_page_scale_factor); | 467 float max_page_scale_factor); |
468 bool IsViewportLayerId(int id) const; | 468 bool IsViewportLayerId(int id) const; |
469 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); | 469 void UpdateScrollbars(int scroll_layer_id, int clip_layer_id); |
470 void DidUpdatePageScale(); | 470 void DidUpdatePageScale(); |
471 void PushTopControls(const float* top_controls_shown_ratio); | 471 void PushBrowserControls(const float* top_controls_shown_ratio); |
472 bool ClampTopControlsShownRatio(); | 472 bool ClampBrowserControlsShownRatio(); |
473 | 473 |
474 LayerTreeHostImpl* layer_tree_host_impl_; | 474 LayerTreeHostImpl* layer_tree_host_impl_; |
475 int source_frame_number_; | 475 int source_frame_number_; |
476 int is_first_frame_after_commit_tracker_; | 476 int is_first_frame_after_commit_tracker_; |
477 LayerImpl* root_layer_for_testing_; | 477 LayerImpl* root_layer_for_testing_; |
478 HeadsUpDisplayLayerImpl* hud_layer_; | 478 HeadsUpDisplayLayerImpl* hud_layer_; |
479 PropertyTrees property_trees_; | 479 PropertyTrees property_trees_; |
480 SkColor background_color_; | 480 SkColor background_color_; |
481 bool has_transparent_background_; | 481 bool has_transparent_background_; |
482 | 482 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_; | 545 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_; |
546 | 546 |
547 UIResourceRequestQueue ui_resource_request_queue_; | 547 UIResourceRequestQueue ui_resource_request_queue_; |
548 | 548 |
549 bool have_scroll_event_handlers_; | 549 bool have_scroll_event_handlers_; |
550 EventListenerProperties event_listener_properties_[static_cast<size_t>( | 550 EventListenerProperties event_listener_properties_[static_cast<size_t>( |
551 EventListenerClass::kNumClasses)]; | 551 EventListenerClass::kNumClasses)]; |
552 | 552 |
553 // Whether or not Blink's viewport size was shrunk by the height of the top | 553 // Whether or not Blink's viewport size was shrunk by the height of the top |
554 // controls at the time of the last layout. | 554 // controls at the time of the last layout. |
555 bool top_controls_shrink_blink_size_; | 555 bool browser_controls_shrink_blink_size_; |
556 float top_controls_height_; | 556 float top_controls_height_; |
557 float bottom_controls_height_; | 557 float bottom_controls_height_; |
558 | 558 |
559 // The amount that the top controls are shown from 0 (hidden) to 1 (fully | 559 // The amount that the browser controls are shown from 0 (hidden) to 1 (fully |
560 // shown). | 560 // shown). |
561 scoped_refptr<SyncedTopControls> top_controls_shown_ratio_; | 561 scoped_refptr<SyncedBrowserControls> top_controls_shown_ratio_; |
562 | 562 |
563 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; | 563 std::unique_ptr<PendingPageScaleAnimation> pending_page_scale_animation_; |
564 | 564 |
565 private: | 565 private: |
566 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 566 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
567 }; | 567 }; |
568 | 568 |
569 } // namespace cc | 569 } // namespace cc |
570 | 570 |
571 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 571 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |