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

Side by Side Diff: content/common/gpu/client/gpu_channel_host.h

Issue 1128233004: Fix GpuChannelHost destruction and races (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecoder( 144 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecoder(
145 int command_buffer_route_id); 145 int command_buffer_route_id);
146 146
147 // Creates a video encoder in the GPU process. 147 // Creates a video encoder in the GPU process.
148 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncoder( 148 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncoder(
149 int command_buffer_route_id); 149 int command_buffer_route_id);
150 150
151 // Destroy a command buffer created by this channel. 151 // Destroy a command buffer created by this channel.
152 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer); 152 void DestroyCommandBuffer(CommandBufferProxyImpl* command_buffer);
153 153
154 // Destroy this channel. 154 // Destroy this channel. Must be called on the main thread, before
155 // destruction.
155 void DestroyChannel(); 156 void DestroyChannel();
156 157
157 // Add a route for the current message loop. 158 // Add a route for the current message loop.
158 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener); 159 void AddRoute(int route_id, base::WeakPtr<IPC::Listener> listener);
159 void RemoveRoute(int route_id); 160 void RemoveRoute(int route_id);
160 161
161 GpuChannelHostFactory* factory() const { return factory_; } 162 GpuChannelHostFactory* factory() const { return factory_; }
162 163
163 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { 164 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
164 return gpu_memory_buffer_manager_; 165 return gpu_memory_buffer_manager_;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 // Threading notes: all fields are constant during the lifetime of |this| 240 // Threading notes: all fields are constant during the lifetime of |this|
240 // except: 241 // except:
241 // - |next_transfer_buffer_id_|, atomic type 242 // - |next_transfer_buffer_id_|, atomic type
242 // - |next_image_id_|, atomic type 243 // - |next_image_id_|, atomic type
243 // - |next_route_id_|, atomic type 244 // - |next_route_id_|, atomic type
244 // - |proxies_|, protected by |context_lock_| 245 // - |proxies_|, protected by |context_lock_|
245 GpuChannelHostFactory* const factory_; 246 GpuChannelHostFactory* const factory_;
246 247
247 const gpu::GPUInfo gpu_info_; 248 const gpu::GPUInfo gpu_info_;
248 249
249 scoped_ptr<IPC::SyncChannel> channel_;
250 scoped_refptr<MessageFilter> channel_filter_; 250 scoped_refptr<MessageFilter> channel_filter_;
251 251
252 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; 252 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_;
253 253
254 // A filter for sending messages from thread other than the main thread. 254 // A filter for sending messages from thread other than the main thread.
255 scoped_refptr<IPC::SyncMessageFilter> sync_filter_; 255 scoped_refptr<IPC::SyncMessageFilter> sync_filter_;
256 256
257 // Transfer buffer IDs are allocated in sequence. 257 // Transfer buffer IDs are allocated in sequence.
258 base::AtomicSequenceNumber next_transfer_buffer_id_; 258 base::AtomicSequenceNumber next_transfer_buffer_id_;
259 259
260 // Image IDs are allocated in sequence. 260 // Image IDs are allocated in sequence.
261 base::AtomicSequenceNumber next_image_id_; 261 base::AtomicSequenceNumber next_image_id_;
262 262
263 // Route IDs are allocated in sequence. 263 // Route IDs are allocated in sequence.
264 base::AtomicSequenceNumber next_route_id_; 264 base::AtomicSequenceNumber next_route_id_;
265 265
266 // Protects proxies_. 266 // Protects channel_ and proxies_.
267 mutable base::Lock context_lock_; 267 mutable base::Lock context_lock_;
268 scoped_ptr<IPC::SyncChannel> channel_;
268 // Used to look up a proxy from its routing id. 269 // Used to look up a proxy from its routing id.
269 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap; 270 typedef base::hash_map<int, CommandBufferProxyImpl*> ProxyMap;
270 ProxyMap proxies_; 271 ProxyMap proxies_;
271 ProxyFlushInfo flush_info_; 272 ProxyFlushInfo flush_info_;
272 273
273 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost); 274 DISALLOW_COPY_AND_ASSIGN(GpuChannelHost);
274 }; 275 };
275 276
276 } // namespace content 277 } // namespace content
277 278
278 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_ 279 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_CHANNEL_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.cc ('k') | content/common/gpu/client/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698