| 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 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "cc/surfaces/frame_sink_id.h" | 12 #include "cc/surfaces/frame_sink_id.h" |
| 13 #include "cc/surfaces/surface_id.h" | 13 #include "cc/surfaces/surface_id.h" |
| 14 #include "cc/surfaces/surface_reference.h" | 14 #include "cc/surfaces/surface_reference.h" |
| 15 #include "cc/surfaces/surfaces_export.h" | 15 #include "cc/surfaces/surfaces_export.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 // Tracks surface references for a client surface. UpdateReferences() should be | 19 // Tracks surface references for a client surface. UpdateReferences() should be |
| 20 // called once per CompositorFrame to populate |references_to_add_| and | 20 // called once per CompositorFrame to populate |references_to_add_| and |
| 21 // |references_to_remove_|. | 21 // |references_to_remove_|. |
| 22 class CC_SURFACES_EXPORT ReferencedSurfaceTracker { | 22 class CC_SURFACES_EXPORT ReferencedSurfaceTracker { |
| 23 public: | 23 public: |
| 24 explicit ReferencedSurfaceTracker(const FrameSinkId& frame_sink_id); | 24 explicit ReferencedSurfaceTracker(const FrameSinkId& frame_sink_id); |
| 25 ~ReferencedSurfaceTracker(); | 25 ~ReferencedSurfaceTracker(); |
| 26 | 26 |
| 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 const std::vector<SurfaceReference>& references_to_add() const { |
| 30 return references_to_add_; | 30 return references_to_add_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 std::vector<SurfaceReference>& references_to_remove() { | 33 const std::vector<SurfaceReference>& references_to_remove() const { |
| 34 return references_to_remove_; | 34 return references_to_remove_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Update the references for a CompositorFrame. If |local_surface_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 LocalSurfaceId& local_surface_id, | 42 void UpdateReferences(const LocalSurfaceId& local_surface_id, |
| 43 const std::vector<SurfaceId>& referenced_surfaces); | 43 const std::vector<SurfaceId>& referenced_surfaces); |
| (...skipping 25 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 |