| OLD | NEW |
| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 LAZY_INSTANCE_INITIALIZER; | 247 LAZY_INSTANCE_INITIALIZER; |
| 248 | 248 |
| 249 static base::LazyInstance< | 249 static base::LazyInstance< |
| 250 std::set<GLInProcessContext*> > | 250 std::set<GLInProcessContext*> > |
| 251 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; | 251 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; |
| 252 | 252 |
| 253 static bool g_use_virtualized_gl_context = false; | 253 static bool g_use_virtualized_gl_context = false; |
| 254 | 254 |
| 255 namespace { | 255 namespace { |
| 256 | 256 |
| 257 // Also calls DetachFromThread on all GLES2Decoders before the lock is released | 257 // Also calls DetachFromThreadHack on all GLES2Decoders before the lock is |
| 258 // to maintain the invariant that all decoders are unbounded while the lock is | 258 // released to maintain the invariant that all decoders are unbound while the |
| 259 // not held. This is to workaround DumpRenderTree uses WGC3DIPCBI with shared | 259 // lock is not held. This is to workaround DumpRenderTree using WGC3DIPCBI with |
| 260 // resources on different threads. | 260 // shared resources on different threads. |
| 261 // Remove this as part of crbug.com/234964. |
| 261 class AutoLockAndDecoderDetachThread { | 262 class AutoLockAndDecoderDetachThread { |
| 262 public: | 263 public: |
| 263 AutoLockAndDecoderDetachThread(base::Lock& lock, | 264 AutoLockAndDecoderDetachThread(base::Lock& lock, |
| 264 const std::set<GLInProcessContext*>& contexts); | 265 const std::set<GLInProcessContext*>& contexts); |
| 265 ~AutoLockAndDecoderDetachThread(); | 266 ~AutoLockAndDecoderDetachThread(); |
| 266 | 267 |
| 267 private: | 268 private: |
| 268 base::AutoLock auto_lock_; | 269 base::AutoLock auto_lock_; |
| 269 const std::set<GLInProcessContext*>& contexts_; | 270 const std::set<GLInProcessContext*>& contexts_; |
| 270 }; | 271 }; |
| 271 | 272 |
| 272 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread( | 273 AutoLockAndDecoderDetachThread::AutoLockAndDecoderDetachThread( |
| 273 base::Lock& lock, | 274 base::Lock& lock, |
| 274 const std::set<GLInProcessContext*>& contexts) | 275 const std::set<GLInProcessContext*>& contexts) |
| 275 : auto_lock_(lock), | 276 : auto_lock_(lock), |
| 276 contexts_(contexts) { | 277 contexts_(contexts) { |
| 277 } | 278 } |
| 278 | 279 |
| 279 void DetachThread(GLInProcessContext* context) { | 280 void DetachThread(GLInProcessContext* context) { |
| 280 if (context->GetDecoder()) | 281 if (context->GetDecoder()) |
| 281 context->GetDecoder()->DetachFromThread(); | 282 context->GetDecoder()->DetachFromThreadHack(); |
| 282 } | 283 } |
| 283 | 284 |
| 284 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() { | 285 AutoLockAndDecoderDetachThread::~AutoLockAndDecoderDetachThread() { |
| 285 std::for_each(contexts_.begin(), | 286 std::for_each(contexts_.begin(), |
| 286 contexts_.end(), | 287 contexts_.end(), |
| 287 &DetachThread); | 288 &DetachThread); |
| 288 } | 289 } |
| 289 | 290 |
| 290 } // namespace | 291 } // namespace |
| 291 | 292 |
| (...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1855 | 1856 |
| 1856 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, | 1857 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, |
| 1857 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, | 1858 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, |
| 1858 WGC3Denum, WGC3Denum, const void*) | 1859 WGC3Denum, WGC3Denum, const void*) |
| 1859 | 1860 |
| 1860 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1861 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
| 1861 WGC3Denum) | 1862 WGC3Denum) |
| 1862 | 1863 |
| 1863 } // namespace gpu | 1864 } // namespace gpu |
| 1864 } // namespace webkit | 1865 } // namespace webkit |
| OLD | NEW |