| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SURFACES_REFERENCED_SURFACE_TRACKER_H_ | 5 #ifndef CC_SURFACES_REFERENCED_SURFACE_TRACKER_H_ |
| 6 #define CC_SURFACES_REFERENCED_SURFACE_TRACKER_H_ | 6 #define CC_SURFACES_REFERENCED_SURFACE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <unordered_set> | 8 #include <unordered_set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const SurfaceId& current_surface_id() const { return current_surface_id_; } | 27 const SurfaceId& current_surface_id() const { return current_surface_id_; } |
| 28 | 28 |
| 29 std::vector<SurfaceReference>& references_to_add() { | 29 std::vector<SurfaceReference>& references_to_add() { |
| 30 return references_to_add_; | 30 return references_to_add_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 std::vector<SurfaceReference>& references_to_remove() { | 33 std::vector<SurfaceReference>& references_to_remove() { |
| 34 return references_to_remove_; | 34 return references_to_remove_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Update the references for a CompositorFrame. If |local_frame_id| has | 37 // Update the references for a CompositorFrame. If |local_surface_id| has |
| 38 // changed then new references will be generated for everything in | 38 // changed then new references will be generated for everything in |
| 39 // |referenced_surfaces|. Otherwise a diff from the referenced surfaces in the | 39 // |referenced_surfaces|. Otherwise a diff from the referenced surfaces in the |
| 40 // last frame will be computed. This should be called once per | 40 // last frame will be computed. This should be called once per |
| 41 // CompositorFrame. | 41 // CompositorFrame. |
| 42 void UpdateReferences(const LocalFrameId& local_frame_id, | 42 void UpdateReferences(const LocalSurfaceId& local_surface_id, |
| 43 const std::vector<SurfaceId>& referenced_surfaces); | 43 const std::vector<SurfaceId>& referenced_surfaces); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 // Updates |referenced_surfaces_| based on a |new_referenced_surfaces| from a | 46 // Updates |referenced_surfaces_| based on a |new_referenced_surfaces| from a |
| 47 // CompositorFrame. Populates |references_to_add_| and |references_to_remove_| | 47 // CompositorFrame. Populates |references_to_add_| and |references_to_remove_| |
| 48 // based on the difference between the sets. | 48 // based on the difference between the sets. |
| 49 void ProcessNewReferences(const std::unordered_set<SurfaceId, SurfaceIdHash>& | 49 void ProcessNewReferences(const std::unordered_set<SurfaceId, SurfaceIdHash>& |
| 50 new_referenced_surfaces); | 50 new_referenced_surfaces); |
| 51 | 51 |
| 52 // Adds reference from |current_surface_id_| to |surface_id|. | 52 // Adds reference from |current_surface_id_| to |surface_id|. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 69 // CompositorFrame has been submitted and the surfaces are no longer needed by | 69 // CompositorFrame has been submitted and the surfaces are no longer needed by |
| 70 // |current_surface_id_|. | 70 // |current_surface_id_|. |
| 71 std::vector<SurfaceReference> references_to_remove_; | 71 std::vector<SurfaceReference> references_to_remove_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(ReferencedSurfaceTracker); | 73 DISALLOW_COPY_AND_ASSIGN(ReferencedSurfaceTracker); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace cc | 76 } // namespace cc |
| 77 | 77 |
| 78 #endif // CC_SURFACES_REFERENCED_SURFACE_TRACKER_H_ | 78 #endif // CC_SURFACES_REFERENCED_SURFACE_TRACKER_H_ |
| OLD | NEW |