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 "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
6 | 6 |
7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/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 26 matching lines...) Expand all Loading... |
37 #include "gpu/ipc/command_buffer_proxy.h" | 37 #include "gpu/ipc/command_buffer_proxy.h" |
38 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" | 38 #include "webkit/glue/gl_bindings_skia_cmd_buffer.h" |
39 | 39 |
40 static base::LazyInstance<base::Lock>::Leaky | 40 static base::LazyInstance<base::Lock>::Leaky |
41 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; | 41 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; |
42 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > | 42 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > |
43 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; | 43 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 void ClearSharedContexts() { | |
48 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | |
49 g_all_shared_contexts.Pointer()->clear(); | |
50 } | |
51 | |
52 void ClearSharedContextsIfInShareSet( | 47 void ClearSharedContextsIfInShareSet( |
53 WebGraphicsContext3DCommandBufferImpl* context) { | 48 WebGraphicsContext3DCommandBufferImpl* context) { |
54 // If the given context isn't in the share set, that means that it | 49 // If the given context isn't in the share set, that means that it |
55 // or another context it was previously sharing with already | 50 // or another context it was previously sharing with already |
56 // provoked a lost context. Other contexts might have since been | 51 // provoked a lost context. Other contexts might have since been |
57 // successfully created and added to the share set, so do not clear | 52 // successfully created and added to the share set, so do not clear |
58 // out the share set unless we know that all the contexts in there | 53 // out the share set unless we know that all the contexts in there |
59 // are supposed to be lost simultaneously. | 54 // are supposed to be lost simultaneously. |
60 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 55 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
61 std::set<WebGraphicsContext3DCommandBufferImpl*>* share_set = | 56 std::set<WebGraphicsContext3DCommandBufferImpl*>* share_set = |
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 swap_client_->OnViewContextSwapBuffersAborted(); | 1588 swap_client_->OnViewContextSwapBuffersAborted(); |
1594 } | 1589 } |
1595 | 1590 |
1596 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1591 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1597 const std::string& message, int id) { | 1592 const std::string& message, int id) { |
1598 if (error_message_callback_) { | 1593 if (error_message_callback_) { |
1599 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1594 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
1600 error_message_callback_->onErrorMessage(str, id); | 1595 error_message_callback_->onErrorMessage(str, id); |
1601 } | 1596 } |
1602 } | 1597 } |
OLD | NEW |