| OLD | NEW |
| 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_SURFACES_SURFACE_H_ | 5 #ifndef CC_SURFACES_SURFACE_H_ |
| 6 #define CC_SURFACES_SURFACE_H_ | 6 #define CC_SURFACES_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 const SurfaceDependencies& blocking_surfaces_for_testing() const { | 114 const SurfaceDependencies& blocking_surfaces_for_testing() const { |
| 115 return blocking_surfaces_; | 115 return blocking_surfaces_; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool HasActiveFrame() const { return active_frame_.has_value(); } | 118 bool HasActiveFrame() const { return active_frame_.has_value(); } |
| 119 bool HasPendingFrame() const { return pending_frame_.has_value(); } | 119 bool HasPendingFrame() const { return pending_frame_.has_value(); } |
| 120 | 120 |
| 121 bool destroyed() const { return destroyed_; } | 121 bool destroyed() const { return destroyed_; } |
| 122 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } | 122 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
| 123 | 123 |
| 124 bool HasRootCopyRequests() const { return !copy_requests_.empty(); } |
| 125 |
| 124 private: | 126 private: |
| 125 void ActivatePendingFrame(); | 127 void ActivatePendingFrame(); |
| 126 // Called when all of the surface's dependencies have been resolved. | 128 // Called when all of the surface's dependencies have been resolved. |
| 127 void ActivateFrame(CompositorFrame frame); | 129 void ActivateFrame(CompositorFrame frame); |
| 128 void UpdateBlockingSurfaces( | 130 void UpdateBlockingSurfaces( |
| 129 const base::Optional<CompositorFrame>& previous_pending_frame, | 131 const base::Optional<CompositorFrame>& previous_pending_frame, |
| 130 const CompositorFrame& current_frame); | 132 const CompositorFrame& current_frame); |
| 131 | 133 |
| 132 void UnrefFrameResources(const CompositorFrame& frame_data); | 134 void UnrefFrameResources(const CompositorFrame& frame_data); |
| 133 void ClearCopyRequests(); | 135 void ClearCopyRequests(); |
| 134 | 136 |
| 135 SurfaceId surface_id_; | 137 SurfaceId surface_id_; |
| 136 SurfaceId previous_frame_surface_id_; | 138 SurfaceId previous_frame_surface_id_; |
| 137 base::WeakPtr<SurfaceFactory> factory_; | 139 base::WeakPtr<SurfaceFactory> factory_; |
| 138 // TODO(jamesr): Support multiple frames in flight. | 140 // TODO(jamesr): Support multiple frames in flight. |
| 139 base::Optional<CompositorFrame> pending_frame_; | 141 base::Optional<CompositorFrame> pending_frame_; |
| 140 base::Optional<CompositorFrame> active_frame_; | 142 base::Optional<CompositorFrame> active_frame_; |
| 141 int frame_index_; | 143 int frame_index_; |
| 142 bool destroyed_; | 144 bool destroyed_; |
| 143 std::vector<SurfaceSequence> destruction_dependencies_; | 145 std::vector<SurfaceSequence> destruction_dependencies_; |
| 146 std::vector<std::unique_ptr<CopyOutputRequest>> copy_requests_; |
| 144 | 147 |
| 145 // This surface may have multiple BeginFrameSources if it is | 148 // This surface may have multiple BeginFrameSources if it is |
| 146 // on multiple Displays. | 149 // on multiple Displays. |
| 147 std::set<BeginFrameSource*> begin_frame_sources_; | 150 std::set<BeginFrameSource*> begin_frame_sources_; |
| 148 | 151 |
| 149 SurfaceDependencies blocking_surfaces_; | 152 SurfaceDependencies blocking_surfaces_; |
| 150 base::ObserverList<PendingFrameObserver, true> observers_; | 153 base::ObserverList<PendingFrameObserver, true> observers_; |
| 151 | 154 |
| 152 DrawCallback draw_callback_; | 155 DrawCallback draw_callback_; |
| 153 | 156 |
| 154 DISALLOW_COPY_AND_ASSIGN(Surface); | 157 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 155 }; | 158 }; |
| 156 | 159 |
| 157 using PendingSurfaceSet = base::flat_set<Surface*>; | 160 using PendingSurfaceSet = base::flat_set<Surface*>; |
| 158 | 161 |
| 159 } // namespace cc | 162 } // namespace cc |
| 160 | 163 |
| 161 #endif // CC_SURFACES_SURFACE_H_ | 164 #endif // CC_SURFACES_SURFACE_H_ |
| OLD | NEW |