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/compositor_frame_sink_support.h" | 22 #include "cc/surfaces/compositor_frame_sink_support.h" |
23 #include "cc/surfaces/frame_sink_id.h" | 23 #include "cc/surfaces/frame_sink_id.h" |
24 #include "cc/surfaces/surface_id.h" | 24 #include "cc/surfaces/surface_info.h" |
25 #include "cc/surfaces/surface_sequence.h" | 25 #include "cc/surfaces/surface_sequence.h" |
26 #include "cc/surfaces/surfaces_export.h" | 26 #include "cc/surfaces/surfaces_export.h" |
27 #include "ui/gfx/geometry/size.h" | 27 #include "ui/gfx/geometry/size.h" |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
30 class LatencyInfo; | 30 class LatencyInfo; |
31 } | 31 } |
32 | 32 |
33 namespace cc { | 33 namespace cc { |
34 | 34 |
35 class CompositorFrame; | 35 class CompositorFrame; |
36 class CopyOutputRequest; | 36 class CopyOutputRequest; |
37 | 37 |
38 class CC_SURFACES_EXPORT Surface { | 38 class CC_SURFACES_EXPORT Surface { |
39 public: | 39 public: |
40 using WillDrawCallback = | 40 using WillDrawCallback = |
41 base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>; | 41 base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>; |
42 | 42 |
43 Surface( | 43 Surface( |
44 const SurfaceId& id, | 44 const SurfaceInfo& surface_info, |
45 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support); | 45 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support); |
46 ~Surface(); | 46 ~Surface(); |
47 | 47 |
48 const SurfaceId& surface_id() const { return surface_id_; } | 48 const SurfaceId& surface_id() const { return surface_info_.id(); } |
49 const SurfaceId& previous_frame_surface_id() const { | 49 const SurfaceId& previous_frame_surface_id() const { |
50 return previous_frame_surface_id_; | 50 return previous_frame_surface_id_; |
51 } | 51 } |
52 | 52 |
53 void SetPreviousFrameSurface(Surface* surface); | 53 void SetPreviousFrameSurface(Surface* surface); |
54 | 54 |
55 // |draw_callback| is called once to notify the client that the previously | 55 // |draw_callback| is called once to notify the client that the previously |
56 // submitted CompositorFrame is processed and that another frame can be | 56 // submitted CompositorFrame is processed and that another frame can be |
57 // submitted. | 57 // submitted. |
58 // |will_draw_callback| is called when |surface| is scheduled for a draw and | 58 // |will_draw_callback| is called when |surface| is scheduled for a draw and |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void UnrefFrameResourcesAndRunDrawCallback( | 149 void UnrefFrameResourcesAndRunDrawCallback( |
150 base::Optional<FrameData> frame_data); | 150 base::Optional<FrameData> frame_data); |
151 void ClearCopyRequests(); | 151 void ClearCopyRequests(); |
152 | 152 |
153 void TakeLatencyInfoFromPendingFrame( | 153 void TakeLatencyInfoFromPendingFrame( |
154 std::vector<ui::LatencyInfo>* latency_info); | 154 std::vector<ui::LatencyInfo>* latency_info); |
155 static void TakeLatencyInfoFromFrame( | 155 static void TakeLatencyInfoFromFrame( |
156 CompositorFrame* frame, | 156 CompositorFrame* frame, |
157 std::vector<ui::LatencyInfo>* latency_info); | 157 std::vector<ui::LatencyInfo>* latency_info); |
158 | 158 |
159 const SurfaceId surface_id_; | 159 SurfaceInfo surface_info_; |
160 SurfaceId previous_frame_surface_id_; | 160 SurfaceId previous_frame_surface_id_; |
161 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support_; | 161 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support_; |
162 SurfaceManager* const surface_manager_; | 162 SurfaceManager* const surface_manager_; |
163 | 163 |
164 base::Optional<FrameData> pending_frame_data_; | 164 base::Optional<FrameData> pending_frame_data_; |
165 base::Optional<FrameData> active_frame_data_; | 165 base::Optional<FrameData> active_frame_data_; |
166 int frame_index_; | 166 int frame_index_; |
167 bool closed_ = false; | 167 bool closed_ = false; |
168 bool destroyed_; | 168 bool destroyed_; |
169 std::vector<SurfaceSequence> destruction_dependencies_; | 169 std::vector<SurfaceSequence> destruction_dependencies_; |
170 | 170 |
171 base::flat_set<SurfaceId> blocking_surfaces_; | 171 base::flat_set<SurfaceId> blocking_surfaces_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(Surface); | 173 DISALLOW_COPY_AND_ASSIGN(Surface); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace cc | 176 } // namespace cc |
177 | 177 |
178 #endif // CC_SURFACES_SURFACE_H_ | 178 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |