| 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 29 matching lines...) Expand all Loading... |
| 40 #include "webkit/common/gpu/gl_bindings_skia_cmd_buffer.h" | 40 #include "webkit/common/gpu/gl_bindings_skia_cmd_buffer.h" |
| 41 | 41 |
| 42 namespace content { | 42 namespace content { |
| 43 static base::LazyInstance<base::Lock>::Leaky | 43 static base::LazyInstance<base::Lock>::Leaky |
| 44 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; | 44 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; |
| 45 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > | 45 static base::LazyInstance<std::set<WebGraphicsContext3DCommandBufferImpl*> > |
| 46 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; | 46 g_all_shared_contexts = LAZY_INSTANCE_INITIALIZER; |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 const size_t kDefaultCommandBufferSize = 1024 * 1024; | |
| 51 const size_t kDefaultStartTransferBufferSize = 1 * 1024 * 1024; | |
| 52 const size_t kDefaultMinTransferBufferSize = 1 * 256 * 1024; | |
| 53 const size_t kDefaultMaxTransferBufferSize = 16 * 1024 * 1024; | |
| 54 | |
| 55 void ClearSharedContextsIfInShareSet( | 50 void ClearSharedContextsIfInShareSet( |
| 56 WebGraphicsContext3DCommandBufferImpl* context) { | 51 WebGraphicsContext3DCommandBufferImpl* context) { |
| 57 // If the given context isn't in the share set, that means that it | 52 // If the given context isn't in the share set, that means that it |
| 58 // or another context it was previously sharing with already | 53 // or another context it was previously sharing with already |
| 59 // provoked a lost context. Other contexts might have since been | 54 // provoked a lost context. Other contexts might have since been |
| 60 // successfully created and added to the share set, so do not clear | 55 // successfully created and added to the share set, so do not clear |
| 61 // out the share set unless we know that all the contexts in there | 56 // out the share set unless we know that all the contexts in there |
| 62 // are supposed to be lost simultaneously. | 57 // are supposed to be lost simultaneously. |
| 63 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 58 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
| 64 std::set<WebGraphicsContext3DCommandBufferImpl*>* share_set = | 59 std::set<WebGraphicsContext3DCommandBufferImpl*>* share_set = |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 | 1655 |
| 1661 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1656 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
| 1662 const std::string& message, int id) { | 1657 const std::string& message, int id) { |
| 1663 if (error_message_callback_) { | 1658 if (error_message_callback_) { |
| 1664 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1659 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
| 1665 error_message_callback_->onErrorMessage(str, id); | 1660 error_message_callback_->onErrorMessage(str, id); |
| 1666 } | 1661 } |
| 1667 } | 1662 } |
| 1668 | 1663 |
| 1669 } // namespace content | 1664 } // namespace content |
| OLD | NEW |