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

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: Simplify threading comments. 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
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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 LAZY_INSTANCE_INITIALIZER; 262 LAZY_INSTANCE_INITIALIZER;
263 263
264 static base::LazyInstance< 264 static base::LazyInstance<
265 std::set<GLInProcessContext*> > 265 std::set<GLInProcessContext*> >
266 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; 266 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER;
267 267
268 static bool g_use_virtualized_gl_context = false; 268 static bool g_use_virtualized_gl_context = false;
269 269
270 namespace { 270 namespace {
271 271
272 // Also calls DetachFromThread on all GLES2Decoders before the lock is released 272 // Also calls DetachFromThreadHack on all GLES2Decoders before the lock is
273 // to maintain the invariant that all decoders are unbounded while the lock is 273 // released to maintain the invariant that all decoders are unbound while the
274 // not held. This is to workaround DumpRenderTree uses WGC3DIPCBI with shared 274 // lock is not held. This is to workaround DumpRenderTree using WGC3DIPCBI with
275 // resources on different threads. 275 // shared resources on different threads.
276 // Remove this as part of crbug.com/234964.
276 class AutoLockAndDecoderDetachThread { 277 class AutoLockAndDecoderDetachThread {
277 public: 278 public:
278 AutoLockAndDecoderDetachThread(base::Lock& lock, 279 AutoLockAndDecoderDetachThread(base::Lock& lock,
279 const std::set<GLInProcessContext*>& contexts); 280 const std::set<GLInProcessContext*>& contexts);
280 ~AutoLockAndDecoderDetachThread(); 281 ~AutoLockAndDecoderDetachThread();
281 282
282 private: 283 private:
283 base::AutoLock auto_lock_; 284 base::AutoLock auto_lock_;
284 const std::set<GLInProcessContext*>& contexts_; 285 const std::set<GLInProcessContext*>& contexts_;
285 }; 286 };
286 287
287 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread( 288 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread(
288 base::Lock& lock, 289 base::Lock& lock,
289 const std::set<GLInProcessContext*>& contexts) 290 const std::set<GLInProcessContext*>& contexts)
290 : auto_lock_(lock), 291 : auto_lock_(lock),
291 contexts_(contexts) { 292 contexts_(contexts) {
292 } 293 }
293 294
294 void DetachThread(GLInProcessContext* context) { 295 void DetachThread(GLInProcessContext* context) {
295 if (context->GetDecoder()) 296 if (context->GetDecoder())
296 context->GetDecoder()->DetachFromThread(); 297 context->GetDecoder()->DetachFromThreadHack();
297 } 298 }
298 299
299 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() { 300 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() {
300 std::for_each(contexts_.begin(), 301 std::for_each(contexts_.begin(),
301 contexts_.end(), 302 contexts_.end(),
302 &DetachThread); 303 &DetachThread);
303 } 304 }
304 305
305 class ImageFactoryInProcess 306 class ImageFactoryInProcess
306 : public ImageFactory, 307 : public ImageFactory,
(...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1975 1976
1976 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, 1977 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM,
1977 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, 1978 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei,
1978 WGC3Denum, WGC3Denum, const void*) 1979 WGC3Denum, WGC3Denum, const void*)
1979 1980
1980 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 1981 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
1981 WGC3Denum) 1982 WGC3Denum)
1982 1983
1983 } // namespace gpu 1984 } // namespace gpu
1984 } // namespace webkit 1985 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698