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

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

Issue 2690753002: cc: Move render surface ownership from layers to the effect tree (Closed)
Patch Set: Only update surfaces when can_render_to_separate_surface changes 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
« no previous file with comments | « cc/trees/occlusion_tracker.cc ('k') | cc/trees/property_tree.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PROPERTY_TREE_H_ 5 #ifndef CC_TREES_PROPERTY_TREE_H_
6 #define CC_TREES_PROPERTY_TREE_H_ 6 #define CC_TREES_PROPERTY_TREE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> { 291 class CC_EXPORT EffectTree final : public PropertyTree<EffectNode> {
292 public: 292 public:
293 EffectTree(); 293 EffectTree();
294 ~EffectTree(); 294 ~EffectTree();
295 295
296 EffectTree& operator=(const EffectTree& from); 296 EffectTree& operator=(const EffectTree& from);
297 bool operator==(const EffectTree& other) const; 297 bool operator==(const EffectTree& other) const;
298 298
299 static const int kContentsRootNodeId = 1; 299 static const int kContentsRootNodeId = 1;
300 300
301 int Insert(const EffectNode& tree_node, int parent_id);
302
301 void clear(); 303 void clear();
302 304
303 float EffectiveOpacity(const EffectNode* node) const; 305 float EffectiveOpacity(const EffectNode* node) const;
304 306
305 void UpdateSurfaceContentsScale(EffectNode* node); 307 void UpdateSurfaceContentsScale(EffectNode* node);
306 308
307 void OnOpacityAnimated(float opacity, int id, LayerTreeImpl* layer_tree_impl); 309 void OnOpacityAnimated(float opacity, int id, LayerTreeImpl* layer_tree_impl);
308 void OnFilterAnimated(const FilterOperations& filters, 310 void OnFilterAnimated(const FilterOperations& filters,
309 int id, 311 int id,
310 LayerTreeImpl* layer_tree_impl); 312 LayerTreeImpl* layer_tree_impl);
311 313
312 void UpdateEffects(int id); 314 void UpdateEffects(int id);
313 315
314 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node); 316 void UpdateEffectChanged(EffectNode* node, EffectNode* parent_node);
315 317
316 void AddCopyRequest(int node_id, std::unique_ptr<CopyOutputRequest> request); 318 void AddCopyRequest(int node_id, std::unique_ptr<CopyOutputRequest> request);
317 void PushCopyRequestsTo(EffectTree* other_tree); 319 void PushCopyRequestsTo(EffectTree* other_tree);
318 void TakeCopyRequestsAndTransformToSurface( 320 void TakeCopyRequestsAndTransformToSurface(
319 int node_id, 321 int node_id,
320 std::vector<std::unique_ptr<CopyOutputRequest>>* requests); 322 std::vector<std::unique_ptr<CopyOutputRequest>>* requests);
321 bool HasCopyRequests() const; 323 bool HasCopyRequests() const;
322 void ClearCopyRequests(); 324 void ClearCopyRequests();
323 325
324 int ClosestAncestorWithCopyRequest(int id) const; 326 int ClosestAncestorWithCopyRequest(int id) const;
325 327
326 void AddMaskLayerId(int id); 328 void AddMaskLayerId(int id);
327 const std::vector<int>& mask_layer_ids() const { return mask_layer_ids_; } 329 const std::vector<int>& mask_layer_ids() const { return mask_layer_ids_; }
328 330
331 RenderSurfaceImpl* GetRenderSurface(int id) {
332 return render_surfaces_[id].get();
333 }
334
335 const RenderSurfaceImpl* GetRenderSurface(int id) const {
336 return render_surfaces_[id].get();
337 }
338
339 void UpdateRenderSurfaces(LayerTreeImpl* layer_tree_impl,
340 bool non_root_surfaces_enabled);
341
329 bool ContributesToDrawnSurface(int id); 342 bool ContributesToDrawnSurface(int id);
330 343
331 void ResetChangeTracking(); 344 void ResetChangeTracking();
332 345
333 // A list of pairs of stable id and render surface, sorted by stable id. 346 void TakeRenderSurfaces(
334 using StableIdRenderSurfaceList = 347 std::vector<std::unique_ptr<RenderSurfaceImpl>>* render_surfaces);
335 std::vector<std::pair<int, RenderSurfaceImpl*>>; 348
336 StableIdRenderSurfaceList CreateStableIdRenderSurfaceList() const; 349 // Returns true if render surfaces changed (that is, if any render surfaces
337 void UpdateRenderSurfaceEffectIds( 350 // were created or destroyed).
338 const StableIdRenderSurfaceList& stable_id_render_surface_list, 351 bool CreateOrReuseRenderSurfaces(
352 std::vector<std::unique_ptr<RenderSurfaceImpl>>* old_render_surfaces,
339 LayerTreeImpl* layer_tree_impl); 353 LayerTreeImpl* layer_tree_impl);
340 354
341 private: 355 private:
342 void UpdateOpacities(EffectNode* node, EffectNode* parent_node); 356 void UpdateOpacities(EffectNode* node, EffectNode* parent_node);
343 void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node); 357 void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node);
344 void UpdateBackfaceVisibility(EffectNode* node, EffectNode* parent_node); 358 void UpdateBackfaceVisibility(EffectNode* node, EffectNode* parent_node);
345 359
346 // Stores copy requests, keyed by node id. 360 // Stores copy requests, keyed by node id.
347 std::unordered_multimap<int, std::unique_ptr<CopyOutputRequest>> 361 std::unordered_multimap<int, std::unique_ptr<CopyOutputRequest>>
348 copy_requests_; 362 copy_requests_;
349 363
350 // Unsorted list of all mask layer ids that effect nodes refer to. 364 // Unsorted list of all mask layer ids that effect nodes refer to.
351 std::vector<int> mask_layer_ids_; 365 std::vector<int> mask_layer_ids_;
366
367 // Indexed by node id.
368 std::vector<std::unique_ptr<RenderSurfaceImpl>> render_surfaces_;
352 }; 369 };
353 370
354 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> { 371 class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
355 public: 372 public:
356 ScrollTree(); 373 ScrollTree();
357 ~ScrollTree(); 374 ~ScrollTree();
358 375
359 ScrollTree& operator=(const ScrollTree& from); 376 ScrollTree& operator=(const ScrollTree& from);
360 bool operator==(const ScrollTree& other) const; 377 bool operator==(const ScrollTree& other) const;
361 378
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const; 670 DrawTransforms& GetDrawTransforms(int transform_id, int effect_id) const;
654 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id, 671 DrawTransformData& FetchDrawTransformsDataFromCache(int transform_id,
655 int effect_id) const; 672 int effect_id) const;
656 673
657 PropertyTreesCachedData cached_data_; 674 PropertyTreesCachedData cached_data_;
658 }; 675 };
659 676
660 } // namespace cc 677 } // namespace cc
661 678
662 #endif // CC_TREES_PROPERTY_TREE_H_ 679 #endif // CC_TREES_PROPERTY_TREE_H_
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker.cc ('k') | cc/trees/property_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698