Chromium Code Reviews| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <unordered_set> | 14 #include <unordered_set> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 19 #include "base/memory/weak_ptr.h" |
| 20 #include "base/optional.h" | 20 #include "base/optional.h" |
| 21 #include "cc/output/copy_output_request.h" | 21 #include "cc/output/copy_output_request.h" |
| 22 #include "cc/surfaces/frame_sink_id.h" | 22 #include "cc/surfaces/frame_sink_id.h" |
| 23 #include "cc/surfaces/pending_frame_observer.h" | 23 #include "cc/surfaces/pending_frame_observer.h" |
| 24 #include "cc/surfaces/surface_factory.h" | 24 #include "cc/surfaces/surface_factory.h" |
| 25 #include "cc/surfaces/surface_id.h" | 25 #include "cc/surfaces/surface_id.h" |
| 26 #include "cc/surfaces/surface_info.h" | |
| 26 #include "cc/surfaces/surface_sequence.h" | 27 #include "cc/surfaces/surface_sequence.h" |
| 27 #include "cc/surfaces/surfaces_export.h" | 28 #include "cc/surfaces/surfaces_export.h" |
| 28 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
| 29 | 30 |
| 30 namespace ui { | 31 namespace ui { |
| 31 class LatencyInfo; | 32 class LatencyInfo; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace cc { | 35 namespace cc { |
| 35 | 36 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 const SurfaceDependencies& blocking_surfaces_for_testing() const { | 115 const SurfaceDependencies& blocking_surfaces_for_testing() const { |
| 115 return blocking_surfaces_; | 116 return blocking_surfaces_; |
| 116 } | 117 } |
| 117 | 118 |
| 118 bool HasActiveFrame() const { return active_frame_.has_value(); } | 119 bool HasActiveFrame() const { return active_frame_.has_value(); } |
| 119 bool HasPendingFrame() const { return pending_frame_.has_value(); } | 120 bool HasPendingFrame() const { return pending_frame_.has_value(); } |
| 120 | 121 |
| 121 bool destroyed() const { return destroyed_; } | 122 bool destroyed() const { return destroyed_; } |
| 122 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } | 123 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
| 123 | 124 |
| 125 const SurfaceInfo& surface_info() { return surface_info_.value(); } | |
| 126 | |
| 124 private: | 127 private: |
| 125 void ActivatePendingFrame(); | 128 void ActivatePendingFrame(); |
| 126 // Called when all of the surface's dependencies have been resolved. | 129 // Called when all of the surface's dependencies have been resolved. |
| 127 void ActivateFrame(CompositorFrame frame); | 130 void ActivateFrame(CompositorFrame frame); |
| 128 void UpdateBlockingSurfaces( | 131 void UpdateBlockingSurfaces( |
| 129 const base::Optional<CompositorFrame>& previous_pending_frame, | 132 const base::Optional<CompositorFrame>& previous_pending_frame, |
| 130 const CompositorFrame& current_frame); | 133 const CompositorFrame& current_frame); |
| 131 | 134 |
| 132 void UnrefFrameResources(const CompositorFrame& frame_data); | 135 void UnrefFrameResources(const CompositorFrame& frame_data); |
| 133 void ClearCopyRequests(); | 136 void ClearCopyRequests(); |
| 134 | 137 |
| 135 void TakeLatencyInfoFromPendingFrame( | 138 void TakeLatencyInfoFromPendingFrame( |
| 136 std::vector<ui::LatencyInfo>* latency_info); | 139 std::vector<ui::LatencyInfo>* latency_info); |
| 137 static void TakeLatencyInfoFromFrame( | 140 static void TakeLatencyInfoFromFrame( |
| 138 CompositorFrame* frame, | 141 CompositorFrame* frame, |
| 139 std::vector<ui::LatencyInfo>* latency_info); | 142 std::vector<ui::LatencyInfo>* latency_info); |
| 140 | 143 |
| 141 SurfaceId surface_id_; | 144 SurfaceId surface_id_; |
|
Fady Samuel
2017/03/17 19:57:44
We don't need this?
| |
| 142 SurfaceId previous_frame_surface_id_; | 145 SurfaceId previous_frame_surface_id_; |
|
Fady Samuel
2017/03/17 19:57:44
previous_surface_info_?
| |
| 143 base::WeakPtr<SurfaceFactory> factory_; | 146 base::WeakPtr<SurfaceFactory> factory_; |
| 144 // TODO(jamesr): Support multiple frames in flight. | 147 // TODO(jamesr): Support multiple frames in flight. |
| 145 base::Optional<CompositorFrame> pending_frame_; | 148 base::Optional<CompositorFrame> pending_frame_; |
| 146 base::Optional<CompositorFrame> active_frame_; | 149 base::Optional<CompositorFrame> active_frame_; |
| 147 int frame_index_; | 150 int frame_index_; |
| 148 bool destroyed_; | 151 bool destroyed_; |
| 149 std::vector<SurfaceSequence> destruction_dependencies_; | 152 std::vector<SurfaceSequence> destruction_dependencies_; |
| 150 | 153 |
| 151 // This surface may have multiple BeginFrameSources if it is | 154 // This surface may have multiple BeginFrameSources if it is |
| 152 // on multiple Displays. | 155 // on multiple Displays. |
| 153 std::set<BeginFrameSource*> begin_frame_sources_; | 156 std::set<BeginFrameSource*> begin_frame_sources_; |
| 154 | 157 |
| 155 SurfaceDependencies blocking_surfaces_; | 158 SurfaceDependencies blocking_surfaces_; |
| 156 base::ObserverList<PendingFrameObserver, true> observers_; | 159 base::ObserverList<PendingFrameObserver, true> observers_; |
| 157 | 160 |
| 158 DrawCallback draw_callback_; | 161 DrawCallback draw_callback_; |
| 159 | 162 |
| 163 base::Optional<SurfaceInfo> surface_info_; | |
|
Fady Samuel
2017/03/17 19:57:44
I wouldn't make this optional. I would instead tak
| |
| 164 | |
| 160 DISALLOW_COPY_AND_ASSIGN(Surface); | 165 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 161 }; | 166 }; |
| 162 | 167 |
| 163 using PendingSurfaceSet = base::flat_set<Surface*>; | 168 using PendingSurfaceSet = base::flat_set<Surface*>; |
| 164 | 169 |
| 165 } // namespace cc | 170 } // namespace cc |
| 166 | 171 |
| 167 #endif // CC_SURFACES_SURFACE_H_ | 172 #endif // CC_SURFACES_SURFACE_H_ |
| OLD | NEW |