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