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

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

Issue 14299011: Remove all but one use of WeakPtrFactory::DetachFromThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove checks for death with correct error, which seem to fail on iOS Created 7 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
« 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/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 5 #include "webkit/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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 LAZY_INSTANCE_INITIALIZER; 261 LAZY_INSTANCE_INITIALIZER;
262 262
263 static base::LazyInstance< 263 static base::LazyInstance<
264 std::set<GLInProcessContext*> > 264 std::set<GLInProcessContext*> >
265 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; 265 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
266 266
267 static bool g_use_virtualized_gl_context = false; 267 static bool g_use_virtualized_gl_context = false;
268 268
269 namespace { 269 namespace {
270 270
271 // Also calls DetachFromThread on all GLES2Decoders before the lock is released 271 // Also calls DetachFromThreadHack on all GLES2Decoders before the lock is
272 // to maintain the invariant that all decoders are unbounded while the lock is 272 // released to maintain the invariant that all decoders are unbound while the
273 // not held. This is to workaround DumpRenderTree uses WGC3DIPCBI with shared 273 // lock is not held. This is to workaround DumpRenderTree using WGC3DIPCBI with
274 // resources on different threads. 274 // shared resources on different threads.
275 // Remove this as part of crbug.com/234964.
275 class AutoLockAndDecoderDetachThread { 276 class AutoLockAndDecoderDetachThread {
276 public: 277 public:
277 AutoLockAndDecoderDetachThread(base::Lock& lock, 278 AutoLockAndDecoderDetachThread(base::Lock& lock,
278 const std::set<GLInProcessContext*>& contexts); 279 const std::set<GLInProcessContext*>& contexts);
279 ~AutoLockAndDecoderDetachThread(); 280 ~AutoLockAndDecoderDetachThread();
280 281
281 private: 282 private:
282 base::AutoLock auto_lock_; 283 base::AutoLock auto_lock_;
283 const std::set<GLInProcessContext*>& contexts_; 284 const std::set<GLInProcessContext*>& contexts_;
284 }; 285 };
285 286
286 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread( 287 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread(
287 base::Lock& lock, 288 base::Lock& lock,
288 const std::set<GLInProcessContext*>& contexts) 289 const std::set<GLInProcessContext*>& contexts)
289 : auto_lock_(lock), 290 : auto_lock_(lock),
290 contexts_(contexts) { 291 contexts_(contexts) {
291 } 292 }
292 293
293 void DetachThread(GLInProcessContext* context) { 294 void DetachThread(GLInProcessContext* context) {
294 if (context->GetDecoder()) 295 if (context->GetDecoder())
295 context->GetDecoder()->DetachFromThread(); 296 context->GetDecoder()->DetachFromThreadHack();
296 } 297 }
297 298
298 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() { 299 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() {
299 std::for_each(contexts_.begin(), 300 std::for_each(contexts_.begin(),
300 contexts_.end(), 301 contexts_.end(),
301 &DetachThread); 302 &DetachThread);
302 } 303 }
303 304
304 static WebGraphicsContext3DInProcessCommandBufferImpl::GpuMemoryBufferCreator* 305 static WebGraphicsContext3DInProcessCommandBufferImpl::GpuMemoryBufferCreator*
305 g_gpu_memory_buffer_creator = NULL; 306 g_gpu_memory_buffer_creator = NULL;
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1980 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 1981 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
1981 WGC3Denum) 1982 WGC3Denum)
1982 1983
1983 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator( 1984 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator(
1984 GpuMemoryBufferCreator* creator) { 1985 GpuMemoryBufferCreator* creator) {
1985 g_gpu_memory_buffer_creator = creator; 1986 g_gpu_memory_buffer_creator = creator;
1986 } 1987 }
1987 1988
1988 } // namespace gpu 1989 } // namespace gpu
1989 } // namespace webkit 1990 } // 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