| 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_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_set> | 9 #include <unordered_set> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class CompositorFrameSinkSupportClient; | 23 class CompositorFrameSinkSupportClient; |
| 24 class SurfaceManager; | 24 class SurfaceManager; |
| 25 | 25 |
| 26 class CC_SURFACES_EXPORT CompositorFrameSinkSupport | 26 class CC_SURFACES_EXPORT CompositorFrameSinkSupport |
| 27 : public SurfaceFactoryClient, | 27 : public SurfaceFactoryClient, |
| 28 public BeginFrameObserver { | 28 public BeginFrameObserver { |
| 29 public: | 29 public: |
| 30 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, | 30 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client, |
| 31 SurfaceManager* surface_manager, | 31 SurfaceManager* surface_manager, |
| 32 const FrameSinkId& frame_sink_id, | 32 const FrameSinkId& frame_sink_id, |
| 33 bool submits_to_display_compositor); | 33 bool is_root, |
| 34 bool handles_frame_sink_id_invalidation, |
| 35 bool needs_sync_points); |
| 34 | 36 |
| 35 ~CompositorFrameSinkSupport() override; | 37 ~CompositorFrameSinkSupport() override; |
| 36 | 38 |
| 37 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } | 39 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 38 | 40 |
| 39 Surface* current_surface_for_testing() { | 41 Surface* current_surface_for_testing() { |
| 40 return surface_factory_.current_surface_for_testing(); | 42 return surface_factory_.current_surface_for_testing(); |
| 41 } | 43 } |
| 42 | 44 |
| 43 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { | 45 const ReferencedSurfaceTracker& ReferenceTrackerForTesting() const { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Whether or not a frame observer has been added. | 110 // Whether or not a frame observer has been added. |
| 109 bool added_frame_observer_ = false; | 111 bool added_frame_observer_ = false; |
| 110 | 112 |
| 111 // Track the surface references for the surface corresponding to this | 113 // Track the surface references for the surface corresponding to this |
| 112 // compositor frame sink. | 114 // compositor frame sink. |
| 113 ReferencedSurfaceTracker reference_tracker_; | 115 ReferencedSurfaceTracker reference_tracker_; |
| 114 | 116 |
| 115 // The set of BeginFrame children of this CompositorFrameSink. | 117 // The set of BeginFrame children of this CompositorFrameSink. |
| 116 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; | 118 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; |
| 117 | 119 |
| 118 const bool submits_to_display_compositor_; | 120 const bool is_root_; |
| 121 |
| 122 // TODO(staraz): Remove this flag once ui::Compositor no longer needs to call |
| 123 // RegisterFrameSinkId(). |
| 124 // A surfaceSequence's validity is bound to the lifetime of the parent |
| 125 // FrameSink that created it. We track the lifetime of FrameSinks through |
| 126 // RegisterFrameSinkId and InvalidateFrameSinkId. During startup and GPU |
| 127 // restart, a SurfaceSequence created by the top most layer compositor may be |
| 128 // used prior to the creation of the associated CompositorFrameSinkSupport. |
| 129 // CompositorFrameSinkSupport is created asynchronously when a new GPU channel |
| 130 // is established. Once we switch to SurfaceReferences, this ordering concern |
| 131 // goes away and we can remove this bool. |
| 132 const bool handles_frame_sink_id_invalidation_; |
| 119 | 133 |
| 120 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; | 134 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; |
| 121 | 135 |
| 122 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); | 136 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); |
| 123 }; | 137 }; |
| 124 | 138 |
| 125 } // namespace cc | 139 } // namespace cc |
| 126 | 140 |
| 127 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ | 141 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ |
| OLD | NEW |