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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace cc { | 28 namespace cc { |
29 class CompositorFrame; | 29 class CompositorFrame; |
30 class CopyOutputRequest; | 30 class CopyOutputRequest; |
31 class SurfaceManager; | 31 class SurfaceManager; |
32 class SurfaceFactory; | 32 class SurfaceFactory; |
33 class SurfaceResourceHolder; | 33 class SurfaceResourceHolder; |
34 | 34 |
35 class CC_SURFACES_EXPORT Surface { | 35 class CC_SURFACES_EXPORT Surface { |
36 public: | 36 public: |
| 37 using DrawCallback = base::Callback<void(bool)>; |
| 38 |
37 Surface(SurfaceId id, SurfaceFactory* factory); | 39 Surface(SurfaceId id, SurfaceFactory* factory); |
38 ~Surface(); | 40 ~Surface(); |
39 | 41 |
40 SurfaceId surface_id() const { return surface_id_; } | 42 SurfaceId surface_id() const { return surface_id_; } |
41 | 43 |
42 void QueueFrame(scoped_ptr<CompositorFrame> frame, | 44 void QueueFrame(scoped_ptr<CompositorFrame> frame, |
43 const base::Closure& draw_callback); | 45 const DrawCallback& draw_callback); |
44 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); | 46 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request); |
45 // Adds each CopyOutputRequest in the current frame to copy_requests. The | 47 // Adds each CopyOutputRequest in the current frame to copy_requests. The |
46 // caller takes ownership of them. | 48 // caller takes ownership of them. |
47 void TakeCopyOutputRequests( | 49 void TakeCopyOutputRequests( |
48 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests); | 50 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests); |
49 // Returns the most recent frame that is eligible to be rendered. | 51 // Returns the most recent frame that is eligible to be rendered. |
50 const CompositorFrame* GetEligibleFrame(); | 52 const CompositorFrame* GetEligibleFrame(); |
51 | 53 |
52 // Returns a number that increments by 1 every time a new frame is enqueued. | 54 // Returns a number that increments by 1 every time a new frame is enqueued. |
53 int frame_index() const { return frame_index_; } | 55 int frame_index() const { return frame_index_; } |
(...skipping 18 matching lines...) Expand all Loading... |
72 private: | 74 private: |
73 void ClearCopyRequests(); | 75 void ClearCopyRequests(); |
74 | 76 |
75 SurfaceId surface_id_; | 77 SurfaceId surface_id_; |
76 base::WeakPtr<SurfaceFactory> factory_; | 78 base::WeakPtr<SurfaceFactory> factory_; |
77 // TODO(jamesr): Support multiple frames in flight. | 79 // TODO(jamesr): Support multiple frames in flight. |
78 scoped_ptr<CompositorFrame> current_frame_; | 80 scoped_ptr<CompositorFrame> current_frame_; |
79 int frame_index_; | 81 int frame_index_; |
80 std::vector<SurfaceSequence> destruction_dependencies_; | 82 std::vector<SurfaceSequence> destruction_dependencies_; |
81 | 83 |
82 base::Closure draw_callback_; | 84 DrawCallback draw_callback_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(Surface); | 86 DISALLOW_COPY_AND_ASSIGN(Surface); |
85 }; | 87 }; |
86 | 88 |
87 } // namespace cc | 89 } // namespace cc |
88 | 90 |
89 #endif // CC_SURFACES_SURFACE_H_ | 91 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |