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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 bool is_in_resourceless_software_draw_mode() { | 325 bool is_in_resourceless_software_draw_mode() { |
326 return (layer_tree_host_impl_->GetDrawMode() == | 326 return (layer_tree_host_impl_->GetDrawMode() == |
327 DRAW_MODE_RESOURCELESS_SOFTWARE); | 327 DRAW_MODE_RESOURCELESS_SOFTWARE); |
328 } | 328 } |
329 | 329 |
330 void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; } | 330 void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; } |
331 bool needs_full_tree_sync() const { return needs_full_tree_sync_; } | 331 bool needs_full_tree_sync() const { return needs_full_tree_sync_; } |
332 | 332 |
| 333 bool needs_surface_ids_sync() const { return needs_surface_ids_sync_; } |
| 334 void set_needs_surface_ids_sync(bool needs_surface_ids_sync) { |
| 335 needs_surface_ids_sync_ = needs_surface_ids_sync; |
| 336 } |
| 337 |
333 void ForceRedrawNextActivation() { next_activation_forces_redraw_ = true; } | 338 void ForceRedrawNextActivation() { next_activation_forces_redraw_ = true; } |
334 | 339 |
335 void set_has_ever_been_drawn(bool has_drawn) { | 340 void set_has_ever_been_drawn(bool has_drawn) { |
336 has_ever_been_drawn_ = has_drawn; | 341 has_ever_been_drawn_ = has_drawn; |
337 } | 342 } |
338 bool has_ever_been_drawn() const { return has_ever_been_drawn_; } | 343 bool has_ever_been_drawn() const { return has_ever_been_drawn_; } |
339 | 344 |
340 void set_ui_resource_request_queue(UIResourceRequestQueue queue); | 345 void set_ui_resource_request_queue(UIResourceRequestQueue queue); |
341 | 346 |
342 const RenderSurfaceList& GetRenderSurfaceList() const; | 347 const RenderSurfaceList& GetRenderSurfaceList() const; |
343 const Region& UnoccludedScreenSpaceRegion() const; | 348 const Region& UnoccludedScreenSpaceRegion() const; |
344 | 349 |
345 // These return the size of the root scrollable area and the size of | 350 // These return the size of the root scrollable area and the size of |
346 // the user-visible scrolling viewport, in CSS layout coordinates. | 351 // the user-visible scrolling viewport, in CSS layout coordinates. |
347 gfx::SizeF ScrollableSize() const; | 352 gfx::SizeF ScrollableSize() const; |
348 gfx::SizeF ScrollableViewportSize() const; | 353 gfx::SizeF ScrollableViewportSize() const; |
349 | 354 |
350 gfx::Rect RootScrollLayerDeviceViewportBounds() const; | 355 gfx::Rect RootScrollLayerDeviceViewportBounds() const; |
351 | 356 |
352 LayerImpl* LayerById(int id) const; | 357 LayerImpl* LayerById(int id) const; |
353 | 358 |
354 int LayerIdByElementId(ElementId element_id) const; | 359 int LayerIdByElementId(ElementId element_id) const; |
355 // TODO(jaydasika): this is deprecated. It is used by | 360 // TODO(jaydasika): this is deprecated. It is used by |
356 // animation/compositor-worker to look up layers to mutate, but in future, we | 361 // animation/compositor-worker to look up layers to mutate, but in future, we |
357 // will update property trees. | 362 // will update property trees. |
358 LayerImpl* LayerByElementId(ElementId element_id) const; | 363 LayerImpl* LayerByElementId(ElementId element_id) const; |
359 void AddToElementMap(LayerImpl* layer); | 364 void AddToElementMap(LayerImpl* layer); |
360 void RemoveFromElementMap(LayerImpl* layer); | 365 void RemoveFromElementMap(LayerImpl* layer); |
361 | 366 |
| 367 void SetSurfaceLayerIds(const std::vector<SurfaceId>& surface_layer_ids); |
| 368 const std::vector<SurfaceId>& SurfaceLayerIds() const; |
| 369 void ClearSurfaceLayerIds(); |
| 370 |
362 void AddLayerShouldPushProperties(LayerImpl* layer); | 371 void AddLayerShouldPushProperties(LayerImpl* layer); |
363 void RemoveLayerShouldPushProperties(LayerImpl* layer); | 372 void RemoveLayerShouldPushProperties(LayerImpl* layer); |
364 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); | 373 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); |
365 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); | 374 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); |
366 | 375 |
367 // These should be called by LayerImpl's ctor/dtor. | 376 // These should be called by LayerImpl's ctor/dtor. |
368 void RegisterLayer(LayerImpl* layer); | 377 void RegisterLayer(LayerImpl* layer); |
369 void UnregisterLayer(LayerImpl* layer); | 378 void UnregisterLayer(LayerImpl* layer); |
370 | 379 |
371 // These manage ownership of the LayerImpl. | 380 // These manage ownership of the LayerImpl. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 return picture_layers_; | 447 return picture_layers_; |
439 } | 448 } |
440 | 449 |
441 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); | 450 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); |
442 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); | 451 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); |
443 ScrollbarSet ScrollbarsFor(ElementId scroll_element_id) const; | 452 ScrollbarSet ScrollbarsFor(ElementId scroll_element_id) const; |
444 | 453 |
445 void RegisterScrollLayer(LayerImpl* layer); | 454 void RegisterScrollLayer(LayerImpl* layer); |
446 void UnregisterScrollLayer(LayerImpl* layer); | 455 void UnregisterScrollLayer(LayerImpl* layer); |
447 | 456 |
448 void AddSurfaceLayer(LayerImpl* layer); | |
449 void RemoveSurfaceLayer(LayerImpl* layer); | |
450 const LayerImplList& SurfaceLayers() const { return surface_layers_; } | |
451 | |
452 LayerImpl* FindFirstScrollingLayerOrDrawnScrollbarThatIsHitByPoint( | 457 LayerImpl* FindFirstScrollingLayerOrDrawnScrollbarThatIsHitByPoint( |
453 const gfx::PointF& screen_space_point); | 458 const gfx::PointF& screen_space_point); |
454 | 459 |
455 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point); | 460 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point); |
456 | 461 |
457 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( | 462 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( |
458 const gfx::PointF& screen_space_point); | 463 const gfx::PointF& screen_space_point); |
459 | 464 |
460 void RegisterSelection(const LayerSelection& selection); | 465 void RegisterSelection(const LayerSelection& selection); |
461 | 466 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 struct ScrollbarLayerIds { | 586 struct ScrollbarLayerIds { |
582 int horizontal = Layer::INVALID_ID; | 587 int horizontal = Layer::INVALID_ID; |
583 int vertical = Layer::INVALID_ID; | 588 int vertical = Layer::INVALID_ID; |
584 }; | 589 }; |
585 // Each scroll layer can have up to two scrollbar layers (vertical and | 590 // Each scroll layer can have up to two scrollbar layers (vertical and |
586 // horizontal). This mapping is maintained as part of scrollbar registration. | 591 // horizontal). This mapping is maintained as part of scrollbar registration. |
587 base::flat_map<ElementId, ScrollbarLayerIds> | 592 base::flat_map<ElementId, ScrollbarLayerIds> |
588 element_id_to_scrollbar_layer_ids_; | 593 element_id_to_scrollbar_layer_ids_; |
589 | 594 |
590 std::vector<PictureLayerImpl*> picture_layers_; | 595 std::vector<PictureLayerImpl*> picture_layers_; |
591 LayerImplList surface_layers_; | 596 |
| 597 std::vector<SurfaceId> surface_layer_ids_; |
592 | 598 |
593 // List of render surfaces for the most recently prepared frame. | 599 // List of render surfaces for the most recently prepared frame. |
594 RenderSurfaceList render_surface_list_; | 600 RenderSurfaceList render_surface_list_; |
595 // After drawing the |render_surface_list_| the areas in this region | 601 // After drawing the |render_surface_list_| the areas in this region |
596 // would not be fully covered by opaque content. | 602 // would not be fully covered by opaque content. |
597 Region unoccluded_screen_space_region_; | 603 Region unoccluded_screen_space_region_; |
598 | 604 |
599 bool viewport_size_invalid_; | 605 bool viewport_size_invalid_; |
600 bool needs_update_draw_properties_; | 606 bool needs_update_draw_properties_; |
601 | 607 |
602 // In impl-side painting mode, this is true when the tree may contain | 608 // In impl-side painting mode, this is true when the tree may contain |
603 // structural differences relative to the active tree. | 609 // structural differences relative to the active tree. |
604 bool needs_full_tree_sync_; | 610 bool needs_full_tree_sync_; |
605 | 611 |
| 612 bool needs_surface_ids_sync_; |
| 613 |
606 bool next_activation_forces_redraw_; | 614 bool next_activation_forces_redraw_; |
607 | 615 |
608 bool has_ever_been_drawn_; | 616 bool has_ever_been_drawn_; |
609 | 617 |
610 bool handle_visibility_changed_; | 618 bool handle_visibility_changed_; |
611 | 619 |
612 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; | 620 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; |
613 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_; | 621 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_; |
614 | 622 |
615 UIResourceRequestQueue ui_resource_request_queue_; | 623 UIResourceRequestQueue ui_resource_request_queue_; |
(...skipping 18 matching lines...) Expand all Loading... |
634 // lifecycle states. See: |LayerTreeLifecycle|. | 642 // lifecycle states. See: |LayerTreeLifecycle|. |
635 LayerTreeLifecycle lifecycle_; | 643 LayerTreeLifecycle lifecycle_; |
636 | 644 |
637 private: | 645 private: |
638 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 646 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
639 }; | 647 }; |
640 | 648 |
641 } // namespace cc | 649 } // namespace cc |
642 | 650 |
643 #endif // CC_TREES_LAYER_TREE_IMPL_H_ | 651 #endif // CC_TREES_LAYER_TREE_IMPL_H_ |
OLD | NEW |