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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 Surface(SurfaceId id, SurfaceFactory* factory); | 43 Surface(SurfaceId id, SurfaceFactory* factory); |
44 ~Surface(); | 44 ~Surface(); |
45 | 45 |
46 SurfaceId surface_id() const { return surface_id_; } | 46 SurfaceId surface_id() const { return surface_id_; } |
47 SurfaceId previous_frame_surface_id() const { | 47 SurfaceId previous_frame_surface_id() const { |
48 return previous_frame_surface_id_; | 48 return previous_frame_surface_id_; |
49 } | 49 } |
50 | 50 |
51 void SetPreviousFrameSurface(Surface* surface); | 51 void SetPreviousFrameSurface(Surface* surface); |
52 void SetGpuMemoryBufferClientId(int gpu_memory_buffer_client_id); | |
53 int gpu_memory_buffer_client_id() const { | |
54 return gpu_memory_buffer_client_id_; | |
55 } | |
56 | 52 |
57 void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback); | 53 void QueueFrame(CompositorFrame frame, const DrawCallback& draw_callback); |
58 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); | 54 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); |
59 // Adds each CopyOutputRequest in the current frame to copy_requests. The | 55 // Adds each CopyOutputRequest in the current frame to copy_requests. The |
60 // caller takes ownership of them. | 56 // caller takes ownership of them. |
61 void TakeCopyOutputRequests( | 57 void TakeCopyOutputRequests( |
62 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>* | 58 std::multimap<RenderPassId, std::unique_ptr<CopyOutputRequest>>* |
63 copy_requests); | 59 copy_requests); |
64 | 60 |
65 // Returns the most recent frame that is eligible to be rendered. | 61 // Returns the most recent frame that is eligible to be rendered. |
(...skipping 28 matching lines...) Expand all Loading... |
94 | 90 |
95 bool destroyed() const { return destroyed_; } | 91 bool destroyed() const { return destroyed_; } |
96 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } | 92 void set_destroyed(bool destroyed) { destroyed_ = destroyed; } |
97 | 93 |
98 private: | 94 private: |
99 void UnrefFrameResources(DelegatedFrameData* frame_data); | 95 void UnrefFrameResources(DelegatedFrameData* frame_data); |
100 void ClearCopyRequests(); | 96 void ClearCopyRequests(); |
101 | 97 |
102 SurfaceId surface_id_; | 98 SurfaceId surface_id_; |
103 SurfaceId previous_frame_surface_id_; | 99 SurfaceId previous_frame_surface_id_; |
104 int gpu_memory_buffer_client_id_ = -1; | |
105 base::WeakPtr<SurfaceFactory> factory_; | 100 base::WeakPtr<SurfaceFactory> factory_; |
106 // TODO(jamesr): Support multiple frames in flight. | 101 // TODO(jamesr): Support multiple frames in flight. |
107 CompositorFrame current_frame_; | 102 CompositorFrame current_frame_; |
108 int frame_index_; | 103 int frame_index_; |
109 bool destroyed_; | 104 bool destroyed_; |
110 std::vector<SurfaceSequence> destruction_dependencies_; | 105 std::vector<SurfaceSequence> destruction_dependencies_; |
111 | 106 |
112 // This surface may have multiple BeginFrameSources if it is | 107 // This surface may have multiple BeginFrameSources if it is |
113 // on multiple Displays. | 108 // on multiple Displays. |
114 std::set<BeginFrameSource*> begin_frame_sources_; | 109 std::set<BeginFrameSource*> begin_frame_sources_; |
115 | 110 |
116 std::vector<SurfaceId> referenced_surfaces_; | 111 std::vector<SurfaceId> referenced_surfaces_; |
117 | 112 |
118 DrawCallback draw_callback_; | 113 DrawCallback draw_callback_; |
119 | 114 |
120 DISALLOW_COPY_AND_ASSIGN(Surface); | 115 DISALLOW_COPY_AND_ASSIGN(Surface); |
121 }; | 116 }; |
122 | 117 |
123 } // namespace cc | 118 } // namespace cc |
124 | 119 |
125 #endif // CC_SURFACES_SURFACE_H_ | 120 #endif // CC_SURFACES_SURFACE_H_ |
OLD | NEW |