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

Side by Side Diff: webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 16007009: Remove all but one use of WeakPtrFactory::DetachFromThread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify SGIVideoSyncProviderThreadShim ownership, removing unnecessary use of SupportsWeakPtr. Created 7 years, 6 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
« no previous file with comments | « ui/gl/gl_surface_glx.cc ('k') | win8/test/ui_automation_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h" 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl. h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #ifndef GL_GLEXT_PROTOTYPES 8 #ifndef GL_GLEXT_PROTOTYPES
9 #define GL_GLEXT_PROTOTYPES 1 9 #define GL_GLEXT_PROTOTYPES 1
10 #endif 10 #endif
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 LAZY_INSTANCE_INITIALIZER; 263 LAZY_INSTANCE_INITIALIZER;
264 264
265 static base::LazyInstance< 265 static base::LazyInstance<
266 std::set<GLInProcessContext*> > 266 std::set<GLInProcessContext*> >
267 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; 267 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
268 268
269 static bool g_use_virtualized_gl_context = false; 269 static bool g_use_virtualized_gl_context = false;
270 270
271 namespace { 271 namespace {
272 272
273 // Also calls DetachFromThread on all GLES2Decoders before the lock is released 273 // Also calls DetachFromThreadHack on all GLES2Decoders before the lock is
274 // to maintain the invariant that all decoders are unbounded while the lock is 274 // released to maintain the invariant that all decoders are unbound while the
275 // not held. This is to workaround DumpRenderTree uses WGC3DIPCBI with shared 275 // lock is not held. This is to workaround DumpRenderTree using WGC3DIPCBI with
276 // resources on different threads. 276 // shared resources on different threads.
277 // Remove this as part of crbug.com/234964.
277 class AutoLockAndDecoderDetachThread { 278 class AutoLockAndDecoderDetachThread {
278 public: 279 public:
279 AutoLockAndDecoderDetachThread(base::Lock& lock, 280 AutoLockAndDecoderDetachThread(base::Lock& lock,
280 const std::set<GLInProcessContext*>& contexts); 281 const std::set<GLInProcessContext*>& contexts);
281 ~AutoLockAndDecoderDetachThread(); 282 ~AutoLockAndDecoderDetachThread();
282 283
283 private: 284 private:
284 base::AutoLock auto_lock_; 285 base::AutoLock auto_lock_;
285 const std::set<GLInProcessContext*>& contexts_; 286 const std::set<GLInProcessContext*>& contexts_;
286 }; 287 };
287 288
288 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread( 289 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread(
289 base::Lock& lock, 290 base::Lock& lock,
290 const std::set<GLInProcessContext*>& contexts) 291 const std::set<GLInProcessContext*>& contexts)
291 : auto_lock_(lock), 292 : auto_lock_(lock),
292 contexts_(contexts) { 293 contexts_(contexts) {
293 } 294 }
294 295
295 void DetachThread(GLInProcessContext* context) { 296 void DetachThread(GLInProcessContext* context) {
296 if (context->GetDecoder()) 297 if (context->GetDecoder())
297 context->GetDecoder()->DetachFromThread(); 298 context->GetDecoder()->DetachFromThreadHack();
298 } 299 }
299 300
300 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() { 301 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() {
301 std::for_each(contexts_.begin(), 302 std::for_each(contexts_.begin(),
302 contexts_.end(), 303 contexts_.end(),
303 &DetachThread); 304 &DetachThread);
304 } 305 }
305 306
306 static WebGraphicsContext3DInProcessCommandBufferImpl::GpuMemoryBufferCreator* 307 static WebGraphicsContext3DInProcessCommandBufferImpl::GpuMemoryBufferCreator*
307 g_gpu_memory_buffer_creator = NULL; 308 g_gpu_memory_buffer_creator = NULL;
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 2004 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
2004 WGC3Denum) 2005 WGC3Denum)
2005 2006
2006 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator( 2007 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator(
2007 GpuMemoryBufferCreator* creator) { 2008 GpuMemoryBufferCreator* creator) {
2008 g_gpu_memory_buffer_creator = creator; 2009 g_gpu_memory_buffer_creator = creator;
2009 } 2010 }
2010 2011
2011 } // namespace gpu 2012 } // namespace gpu
2012 } // namespace webkit 2013 } // namespace webkit
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_glx.cc ('k') | win8/test/ui_automation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698