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

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

Issue 2905533002: cc : Store surface layer ids on LayerTreeHost and push them at commit (Closed)
Patch Set: initialize Created 3 years, 7 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void SetPropertyTrees(PropertyTrees* property_trees); 161 void SetPropertyTrees(PropertyTrees* property_trees);
162 PropertyTrees* property_trees() { 162 PropertyTrees* property_trees() {
163 // TODO(pdr): We should enable this DCHECK because it will catch uses of 163 // TODO(pdr): We should enable this DCHECK because it will catch uses of
164 // stale property trees, but it currently fails too many existing tests. 164 // stale property trees, but it currently fails too many existing tests.
165 // DCHECK(lifecycle().AllowsPropertyTreeAccess()); 165 // DCHECK(lifecycle().AllowsPropertyTreeAccess());
166 return &property_trees_; 166 return &property_trees_;
167 } 167 }
168 168
169 void PushPropertyTreesTo(LayerTreeImpl* tree_impl); 169 void PushPropertyTreesTo(LayerTreeImpl* tree_impl);
170 void PushPropertiesTo(LayerTreeImpl* tree_impl); 170 void PushPropertiesTo(LayerTreeImpl* tree_impl);
171 void PushSurfaceIdsTo(LayerTreeImpl* tree_impl);
171 172
172 void MoveChangeTrackingToLayers(); 173 void MoveChangeTrackingToLayers();
173 174
174 void ForceRecalculateRasterScales(); 175 void ForceRecalculateRasterScales();
175 176
176 LayerImplList::const_iterator begin() const; 177 LayerImplList::const_iterator begin() const;
177 LayerImplList::const_iterator end() const; 178 LayerImplList::const_iterator end() const;
178 LayerImplList::reverse_iterator rbegin(); 179 LayerImplList::reverse_iterator rbegin();
179 LayerImplList::reverse_iterator rend(); 180 LayerImplList::reverse_iterator rend();
180 181
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 } 324 }
324 325
325 bool is_in_resourceless_software_draw_mode() { 326 bool is_in_resourceless_software_draw_mode() {
326 return (layer_tree_host_impl_->GetDrawMode() == 327 return (layer_tree_host_impl_->GetDrawMode() ==
327 DRAW_MODE_RESOURCELESS_SOFTWARE); 328 DRAW_MODE_RESOURCELESS_SOFTWARE);
328 } 329 }
329 330
330 void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; } 331 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_; } 332 bool needs_full_tree_sync() const { return needs_full_tree_sync_; }
332 333
334 bool needs_surface_ids_sync() const { return needs_surface_ids_sync_; }
335 void set_needs_surface_ids_sync(bool needs_surface_ids_sync) {
336 needs_surface_ids_sync_ = needs_surface_ids_sync;
337 }
338
333 void ForceRedrawNextActivation() { next_activation_forces_redraw_ = true; } 339 void ForceRedrawNextActivation() { next_activation_forces_redraw_ = true; }
334 340
335 void set_has_ever_been_drawn(bool has_drawn) { 341 void set_has_ever_been_drawn(bool has_drawn) {
336 has_ever_been_drawn_ = has_drawn; 342 has_ever_been_drawn_ = has_drawn;
337 } 343 }
338 bool has_ever_been_drawn() const { return has_ever_been_drawn_; } 344 bool has_ever_been_drawn() const { return has_ever_been_drawn_; }
339 345
340 void set_ui_resource_request_queue(UIResourceRequestQueue queue); 346 void set_ui_resource_request_queue(UIResourceRequestQueue queue);
341 347
342 const RenderSurfaceList& GetRenderSurfaceList() const; 348 const RenderSurfaceList& GetRenderSurfaceList() const;
343 const Region& UnoccludedScreenSpaceRegion() const; 349 const Region& UnoccludedScreenSpaceRegion() const;
344 350
345 // These return the size of the root scrollable area and the size of 351 // These return the size of the root scrollable area and the size of
346 // the user-visible scrolling viewport, in CSS layout coordinates. 352 // the user-visible scrolling viewport, in CSS layout coordinates.
347 gfx::SizeF ScrollableSize() const; 353 gfx::SizeF ScrollableSize() const;
348 gfx::SizeF ScrollableViewportSize() const; 354 gfx::SizeF ScrollableViewportSize() const;
349 355
350 gfx::Rect RootScrollLayerDeviceViewportBounds() const; 356 gfx::Rect RootScrollLayerDeviceViewportBounds() const;
351 357
352 LayerImpl* LayerById(int id) const; 358 LayerImpl* LayerById(int id) const;
353 359
354 int LayerIdByElementId(ElementId element_id) const; 360 int LayerIdByElementId(ElementId element_id) const;
355 // TODO(jaydasika): this is deprecated. It is used by 361 // TODO(jaydasika): this is deprecated. It is used by
356 // animation/compositor-worker to look up layers to mutate, but in future, we 362 // animation/compositor-worker to look up layers to mutate, but in future, we
357 // will update property trees. 363 // will update property trees.
358 LayerImpl* LayerByElementId(ElementId element_id) const; 364 LayerImpl* LayerByElementId(ElementId element_id) const;
359 void AddToElementMap(LayerImpl* layer); 365 void AddToElementMap(LayerImpl* layer);
360 void RemoveFromElementMap(LayerImpl* layer); 366 void RemoveFromElementMap(LayerImpl* layer);
361 367
368 void SetSurfaceLayerIds(const base::flat_set<SurfaceId>& surface_layer_ids);
369 const base::flat_set<SurfaceId>& SurfaceLayerIds() const;
370 void ClearSurfaceLayerIds();
371
362 void AddLayerShouldPushProperties(LayerImpl* layer); 372 void AddLayerShouldPushProperties(LayerImpl* layer);
363 void RemoveLayerShouldPushProperties(LayerImpl* layer); 373 void RemoveLayerShouldPushProperties(LayerImpl* layer);
364 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties(); 374 std::unordered_set<LayerImpl*>& LayersThatShouldPushProperties();
365 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer); 375 bool LayerNeedsPushPropertiesForTesting(LayerImpl* layer);
366 376
367 // These should be called by LayerImpl's ctor/dtor. 377 // These should be called by LayerImpl's ctor/dtor.
368 void RegisterLayer(LayerImpl* layer); 378 void RegisterLayer(LayerImpl* layer);
369 void UnregisterLayer(LayerImpl* layer); 379 void UnregisterLayer(LayerImpl* layer);
370 380
371 // These manage ownership of the LayerImpl. 381 // These manage ownership of the LayerImpl.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return picture_layers_; 448 return picture_layers_;
439 } 449 }
440 450
441 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); 451 void RegisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer);
442 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer); 452 void UnregisterScrollbar(ScrollbarLayerImplBase* scrollbar_layer);
443 ScrollbarSet ScrollbarsFor(ElementId scroll_element_id) const; 453 ScrollbarSet ScrollbarsFor(ElementId scroll_element_id) const;
444 454
445 void RegisterScrollLayer(LayerImpl* layer); 455 void RegisterScrollLayer(LayerImpl* layer);
446 void UnregisterScrollLayer(LayerImpl* layer); 456 void UnregisterScrollLayer(LayerImpl* layer);
447 457
448 void AddSurfaceLayer(LayerImpl* layer);
449 void RemoveSurfaceLayer(LayerImpl* layer);
450 const LayerImplList& SurfaceLayers() const { return surface_layers_; }
451
452 LayerImpl* FindFirstScrollingLayerOrDrawnScrollbarThatIsHitByPoint( 458 LayerImpl* FindFirstScrollingLayerOrDrawnScrollbarThatIsHitByPoint(
453 const gfx::PointF& screen_space_point); 459 const gfx::PointF& screen_space_point);
454 460
455 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point); 461 LayerImpl* FindLayerThatIsHitByPoint(const gfx::PointF& screen_space_point);
456 462
457 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion( 463 LayerImpl* FindLayerThatIsHitByPointInTouchHandlerRegion(
458 const gfx::PointF& screen_space_point); 464 const gfx::PointF& screen_space_point);
459 465
460 void RegisterSelection(const LayerSelection& selection); 466 void RegisterSelection(const LayerSelection& selection);
461 467
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 struct ScrollbarLayerIds { 587 struct ScrollbarLayerIds {
582 int horizontal = Layer::INVALID_ID; 588 int horizontal = Layer::INVALID_ID;
583 int vertical = Layer::INVALID_ID; 589 int vertical = Layer::INVALID_ID;
584 }; 590 };
585 // Each scroll layer can have up to two scrollbar layers (vertical and 591 // Each scroll layer can have up to two scrollbar layers (vertical and
586 // horizontal). This mapping is maintained as part of scrollbar registration. 592 // horizontal). This mapping is maintained as part of scrollbar registration.
587 base::flat_map<ElementId, ScrollbarLayerIds> 593 base::flat_map<ElementId, ScrollbarLayerIds>
588 element_id_to_scrollbar_layer_ids_; 594 element_id_to_scrollbar_layer_ids_;
589 595
590 std::vector<PictureLayerImpl*> picture_layers_; 596 std::vector<PictureLayerImpl*> picture_layers_;
591 LayerImplList surface_layers_; 597
598 base::flat_set<SurfaceId> surface_layer_ids_;
592 599
593 // List of render surfaces for the most recently prepared frame. 600 // List of render surfaces for the most recently prepared frame.
594 RenderSurfaceList render_surface_list_; 601 RenderSurfaceList render_surface_list_;
595 // After drawing the |render_surface_list_| the areas in this region 602 // After drawing the |render_surface_list_| the areas in this region
596 // would not be fully covered by opaque content. 603 // would not be fully covered by opaque content.
597 Region unoccluded_screen_space_region_; 604 Region unoccluded_screen_space_region_;
598 605
599 bool viewport_size_invalid_; 606 bool viewport_size_invalid_;
600 bool needs_update_draw_properties_; 607 bool needs_update_draw_properties_;
601 608
602 // In impl-side painting mode, this is true when the tree may contain 609 // In impl-side painting mode, this is true when the tree may contain
603 // structural differences relative to the active tree. 610 // structural differences relative to the active tree.
604 bool needs_full_tree_sync_; 611 bool needs_full_tree_sync_;
605 612
613 bool needs_surface_ids_sync_;
614
606 bool next_activation_forces_redraw_; 615 bool next_activation_forces_redraw_;
607 616
608 bool has_ever_been_drawn_; 617 bool has_ever_been_drawn_;
609 618
610 bool handle_visibility_changed_; 619 bool handle_visibility_changed_;
611 620
612 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_; 621 std::vector<std::unique_ptr<SwapPromise>> swap_promise_list_;
613 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_; 622 std::vector<std::unique_ptr<SwapPromise>> pinned_swap_promise_list_;
614 623
615 UIResourceRequestQueue ui_resource_request_queue_; 624 UIResourceRequestQueue ui_resource_request_queue_;
(...skipping 18 matching lines...) Expand all
634 // lifecycle states. See: |LayerTreeLifecycle|. 643 // lifecycle states. See: |LayerTreeLifecycle|.
635 LayerTreeLifecycle lifecycle_; 644 LayerTreeLifecycle lifecycle_;
636 645
637 private: 646 private:
638 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 647 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
639 }; 648 };
640 649
641 } // namespace cc 650 } // namespace cc
642 651
643 #endif // CC_TREES_LAYER_TREE_IMPL_H_ 652 #endif // CC_TREES_LAYER_TREE_IMPL_H_
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698