Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: gpu/command_buffer/service/in_process_command_buffer.h

Issue 271763002: Clean up SyncCompositorFactory context creation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 6 #define GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 public: 66 public:
67 class Service; 67 class Service;
68 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service); 68 explicit InProcessCommandBuffer(const scoped_refptr<Service>& service);
69 virtual ~InProcessCommandBuffer(); 69 virtual ~InProcessCommandBuffer();
70 70
71 static void SetGpuMemoryBufferFactory(GpuMemoryBufferFactory* factory); 71 static void SetGpuMemoryBufferFactory(GpuMemoryBufferFactory* factory);
72 72
73 // If |surface| is not NULL, use it directly; in this case, the command 73 // If |surface| is not NULL, use it directly; in this case, the command
74 // buffer gpu thread must be the same as the client thread. Otherwise create 74 // buffer gpu thread must be the same as the client thread. Otherwise create
75 // a new GLSurface. 75 // a new GLSurface.
76 bool Initialize(scoped_refptr<gfx::GLSurface> surface, 76 bool Initialize(gfx::GLSurface* surface,
77 bool is_offscreen, 77 bool is_offscreen,
78 gfx::AcceleratedWidget window, 78 gfx::AcceleratedWidget window,
79 const gfx::Size& size, 79 const gfx::Size& size,
80 const std::vector<int32>& attribs, 80 const std::vector<int32>& attribs,
81 gfx::GpuPreference gpu_preference, 81 gfx::GpuPreference gpu_preference,
82 const base::Closure& context_lost_callback, 82 const base::Closure& context_lost_callback,
83 InProcessCommandBuffer* share_group); 83 InProcessCommandBuffer* share_group);
84 void Destroy(); 84 void Destroy();
85 85
86 // CommandBuffer implementation: 86 // CommandBuffer implementation:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 shader_translator_cache() = 0; 136 shader_translator_cache() = 0;
137 }; 137 };
138 138
139 #if defined(OS_ANDROID) 139 #if defined(OS_ANDROID)
140 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( 140 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture(
141 uint32 stream_id); 141 uint32 stream_id);
142 #endif 142 #endif
143 143
144 private: 144 private:
145 struct InitializeOnGpuThreadParams { 145 struct InitializeOnGpuThreadParams {
146 gfx::GLSurface* surface;
146 bool is_offscreen; 147 bool is_offscreen;
147 gfx::AcceleratedWidget window; 148 gfx::AcceleratedWidget window;
148 const gfx::Size& size; 149 const gfx::Size& size;
149 const std::vector<int32>& attribs; 150 const std::vector<int32>& attribs;
150 gfx::GpuPreference gpu_preference; 151 gfx::GpuPreference gpu_preference;
151 gpu::Capabilities* capabilities; // Ouptut. 152 gpu::Capabilities* capabilities; // Ouptut.
152 InProcessCommandBuffer* context_group; 153 InProcessCommandBuffer* context_group;
153 154
154 InitializeOnGpuThreadParams(bool is_offscreen, 155 InitializeOnGpuThreadParams(gfx::GLSurface* surface,
156 bool is_offscreen,
155 gfx::AcceleratedWidget window, 157 gfx::AcceleratedWidget window,
156 const gfx::Size& size, 158 const gfx::Size& size,
157 const std::vector<int32>& attribs, 159 const std::vector<int32>& attribs,
158 gfx::GpuPreference gpu_preference, 160 gfx::GpuPreference gpu_preference,
159 gpu::Capabilities* capabilities, 161 gpu::Capabilities* capabilities,
160 InProcessCommandBuffer* share_group) 162 InProcessCommandBuffer* share_group)
161 : is_offscreen(is_offscreen), 163 : surface(surface),
164 is_offscreen(is_offscreen),
162 window(window), 165 window(window),
163 size(size), 166 size(size),
164 attribs(attribs), 167 attribs(attribs),
165 gpu_preference(gpu_preference), 168 gpu_preference(gpu_preference),
166 capabilities(capabilities), 169 capabilities(capabilities),
167 context_group(share_group) {} 170 context_group(share_group) {}
168 }; 171 };
169 172
170 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params); 173 bool InitializeOnGpuThread(const InitializeOnGpuThreadParams& params);
171 bool DestroyOnGpuThread(); 174 bool DestroyOnGpuThread();
172 void FlushOnGpuThread(int32 put_offset); 175 void FlushOnGpuThread(int32 put_offset);
173 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id); 176 uint32 CreateStreamTextureOnGpuThread(uint32 client_texture_id);
174 bool MakeCurrent(); 177 bool MakeCurrent();
175 base::Closure WrapCallback(const base::Closure& callback); 178 base::Closure WrapCallback(const base::Closure& callback);
176 State GetStateFast(); 179 State GetStateFast();
177 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); } 180 void QueueTask(const base::Closure& task) { service_->ScheduleTask(task); }
178 void CheckSequencedThread();
179 void RetireSyncPointOnGpuThread(uint32 sync_point); 181 void RetireSyncPointOnGpuThread(uint32 sync_point);
180 void SignalSyncPointOnGpuThread(uint32 sync_point, 182 void SignalSyncPointOnGpuThread(uint32 sync_point,
181 const base::Closure& callback); 183 const base::Closure& callback);
182 void DestroyTransferBufferOnGputhread(int32 id); 184 void DestroyTransferBufferOnGputhread(int32 id);
183 185
184 // Callbacks: 186 // Callbacks:
185 void OnContextLost(); 187 void OnContextLost();
186 void OnResizeView(gfx::Size size, float scale_factor); 188 void OnResizeView(gfx::Size size, float scale_factor);
187 bool GetBufferChanged(int32 transfer_buffer_id); 189 bool GetBufferChanged(int32 transfer_buffer_id);
188 void PumpCommands(); 190 void PumpCommands();
(...skipping 25 matching lines...) Expand all
214 scoped_refptr<Service> service_; 216 scoped_refptr<Service> service_;
215 State state_after_last_flush_; 217 State state_after_last_flush_;
216 base::Lock state_after_last_flush_lock_; 218 base::Lock state_after_last_flush_lock_;
217 scoped_ptr<GpuControlService> gpu_control_; 219 scoped_ptr<GpuControlService> gpu_control_;
218 scoped_refptr<gfx::GLShareGroup> gl_share_group_; 220 scoped_refptr<gfx::GLShareGroup> gl_share_group_;
219 221
220 #if defined(OS_ANDROID) 222 #if defined(OS_ANDROID)
221 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_; 223 scoped_ptr<StreamTextureManagerInProcess> stream_texture_manager_;
222 #endif 224 #endif
223 225
224 // Only used with explicit scheduling and the gpu thread is the same as
225 // the client thread.
226 scoped_ptr<base::SequenceChecker> sequence_checker_;
227
228 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_; 226 base::WeakPtr<InProcessCommandBuffer> gpu_thread_weak_ptr_;
229 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_; 227 base::WeakPtrFactory<InProcessCommandBuffer> gpu_thread_weak_ptr_factory_;
230 228
231 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer); 229 DISALLOW_COPY_AND_ASSIGN(InProcessCommandBuffer);
232 }; 230 };
233 231
234 } // namespace gpu 232 } // namespace gpu
235 233
236 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_ 234 #endif // GPU_COMMAND_BUFFER_SERVICE_IN_PROCESS_COMMAND_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698