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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback); | 55 void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback); |
56 void EvictFrame(); | 56 void EvictFrame(); |
57 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); | 57 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); |
58 | 58 |
| 59 // This method gets rid of both active and pending frames and leaks their |
| 60 // resources. |
| 61 // TODO(samans): This method should not be necessary once crbug.com/701988 is |
| 62 // fixed. |
| 63 void Reset(); |
| 64 |
59 // Notifies the Surface that a blocking SurfaceId now has an active frame. | 65 // Notifies the Surface that a blocking SurfaceId now has an active frame. |
60 void NotifySurfaceIdAvailable(const SurfaceId& surface_id); | 66 void NotifySurfaceIdAvailable(const SurfaceId& surface_id); |
61 | 67 |
62 void AddObserver(PendingFrameObserver* observer); | 68 void AddObserver(PendingFrameObserver* observer); |
63 void RemoveObserver(PendingFrameObserver* observer); | 69 void RemoveObserver(PendingFrameObserver* observer); |
64 | 70 |
65 // Called if a deadline has been hit and this surface is not yet active but | 71 // Called if a deadline has been hit and this surface is not yet active but |
66 // it's marked as respecting deadlines. | 72 // it's marked as respecting deadlines. |
67 void ActivatePendingFrameForDeadline(); | 73 void ActivatePendingFrameForDeadline(); |
68 | 74 |
(...skipping 11 matching lines...) Expand all Loading... |
80 // returns true before calling this method. | 86 // returns true before calling this method. |
81 const CompositorFrame& GetPendingFrame(); | 87 const CompositorFrame& GetPendingFrame(); |
82 | 88 |
83 // Returns a number that increments by 1 every time a new frame is enqueued. | 89 // Returns a number that increments by 1 every time a new frame is enqueued. |
84 int frame_index() const { return frame_index_; } | 90 int frame_index() const { return frame_index_; } |
85 | 91 |
86 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); | 92 void TakeLatencyInfo(std::vector<ui::LatencyInfo>* latency_info); |
87 void RunDrawCallbacks(); | 93 void RunDrawCallbacks(); |
88 | 94 |
89 base::WeakPtr<SurfaceFactory> factory() { return factory_; } | 95 base::WeakPtr<SurfaceFactory> factory() { return factory_; } |
| 96 void set_factory(base::WeakPtr<SurfaceFactory> factory) { |
| 97 factory_ = factory; |
| 98 } |
90 | 99 |
91 // Add a SurfaceSequence that must be satisfied before the Surface is | 100 // Add a SurfaceSequence that must be satisfied before the Surface is |
92 // destroyed. | 101 // destroyed. |
93 void AddDestructionDependency(SurfaceSequence sequence); | 102 void AddDestructionDependency(SurfaceSequence sequence); |
94 | 103 |
95 // Satisfy all destruction dependencies that are contained in sequences, and | 104 // Satisfy all destruction dependencies that are contained in sequences, and |
96 // remove them from sequences. | 105 // remove them from sequences. |
97 void SatisfyDestructionDependencies( | 106 void SatisfyDestructionDependencies( |
98 std::unordered_set<SurfaceSequence, SurfaceSequenceHash>* sequences, | 107 std::unordered_set<SurfaceSequence, SurfaceSequenceHash>* sequences, |
99 std::unordered_set<FrameSinkId, FrameSinkIdHash>* valid_id_namespaces); | 108 std::unordered_set<FrameSinkId, FrameSinkIdHash>* valid_id_namespaces); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 DrawCallback draw_callback_; | 167 DrawCallback draw_callback_; |
159 | 168 |
160 DISALLOW_COPY_AND_ASSIGN(Surface); | 169 DISALLOW_COPY_AND_ASSIGN(Surface); |
161 }; | 170 }; |
162 | 171 |
163 using PendingSurfaceSet = base::flat_set<Surface*>; | 172 using PendingSurfaceSet = base::flat_set<Surface*>; |
164 | 173 |
165 } // namespace cc | 174 } // namespace cc |
166 | 175 |
167 #endif // CC_SURFACES_SURFACE_H_ | 176 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |