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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace { | 43 namespace { |
44 | 44 |
45 static base::LazyInstance<base::Lock>::Leaky | 45 static base::LazyInstance<base::Lock>::Leaky |
46 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; | 46 g_all_shared_contexts_lock = LAZY_INSTANCE_INITIALIZER; |
47 | 47 |
48 typedef std::multimap<GpuChannelHost*, WebGraphicsContext3DCommandBufferImpl*> | 48 typedef std::multimap<GpuChannelHost*, WebGraphicsContext3DCommandBufferImpl*> |
49 ContextMap; | 49 ContextMap; |
50 static base::LazyInstance<ContextMap> g_all_shared_contexts = | 50 static base::LazyInstance<ContextMap> g_all_shared_contexts = |
51 LAZY_INSTANCE_INITIALIZER; | 51 LAZY_INSTANCE_INITIALIZER; |
52 | 52 |
53 size_t ClampUint64ToSizeT(uint64 value) { | |
54 value = std::min(value, | |
55 static_cast<uint64>(std::numeric_limits<size_t>::max())); | |
56 return static_cast<size_t>(value); | |
57 } | |
58 | |
59 uint32_t GenFlushID() { | 53 uint32_t GenFlushID() { |
60 static base::subtle::Atomic32 flush_id = 0; | 54 static base::subtle::Atomic32 flush_id = 0; |
61 | 55 |
62 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement( | 56 base::subtle::Atomic32 my_id = base::subtle::Barrier_AtomicIncrement( |
63 &flush_id, 1); | 57 &flush_id, 1); |
64 return static_cast<uint32_t>(my_id); | 58 return static_cast<uint32_t>(my_id); |
65 } | 59 } |
66 | 60 |
67 // Singleton used to initialize and terminate the gles2 library. | 61 // Singleton used to initialize and terminate the gles2 library. |
68 class GLES2Initializer { | 62 class GLES2Initializer { |
(...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 | 1452 |
1459 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1453 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
1460 const std::string& message, int id) { | 1454 const std::string& message, int id) { |
1461 if (error_message_callback_) { | 1455 if (error_message_callback_) { |
1462 blink::WebString str = blink::WebString::fromUTF8(message.c_str()); | 1456 blink::WebString str = blink::WebString::fromUTF8(message.c_str()); |
1463 error_message_callback_->onErrorMessage(str, id); | 1457 error_message_callback_->onErrorMessage(str, id); |
1464 } | 1458 } |
1465 } | 1459 } |
1466 | 1460 |
1467 } // namespace content | 1461 } // namespace content |
OLD | NEW |