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