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 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 class ShareGroup : public base::RefCountedThreadSafe<ShareGroup> { | 61 class ShareGroup : public base::RefCountedThreadSafe<ShareGroup> { |
62 public: | 62 public: |
63 ShareGroup(); | 63 ShareGroup(); |
64 | 64 |
65 WebGraphicsContext3DCommandBufferImpl* GetAnyContextLocked() { | 65 WebGraphicsContext3DCommandBufferImpl* GetAnyContextLocked() { |
66 // In order to ensure that the context returned is not removed while | 66 // In order to ensure that the context returned is not removed while |
67 // in use, the share group's lock should be aquired before calling this | 67 // in use, the share group's lock should be aquired before calling this |
68 // function. | 68 // function. |
69 lock_.AssertAcquired(); | 69 lock_.AssertAcquired(); |
70 if (contexts_.empty()) | 70 if (contexts_.empty()) |
71 return NULL; | 71 return nullptr; |
72 return contexts_.front(); | 72 return contexts_.front(); |
73 } | 73 } |
74 | 74 |
75 void AddContextLocked(WebGraphicsContext3DCommandBufferImpl* context) { | 75 void AddContextLocked(WebGraphicsContext3DCommandBufferImpl* context) { |
76 lock_.AssertAcquired(); | 76 lock_.AssertAcquired(); |
77 contexts_.push_back(context); | 77 contexts_.push_back(context); |
78 } | 78 } |
79 | 79 |
80 void RemoveContext(WebGraphicsContext3DCommandBufferImpl* context) { | 80 void RemoveContext(WebGraphicsContext3DCommandBufferImpl* context) { |
81 base::AutoLock auto_lock(lock_); | 81 base::AutoLock auto_lock(lock_); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); | 120 CONTENT_EXPORT gpu::ContextSupport* GetContextSupport(); |
121 | 121 |
122 gpu::gles2::GLES2Implementation* GetImplementation() { | 122 gpu::gles2::GLES2Implementation* GetImplementation() { |
123 return real_gl_.get(); | 123 return real_gl_.get(); |
124 } | 124 } |
125 | 125 |
126 // Return true if GPU process reported context lost or there was a | 126 // Return true if GPU process reported context lost or there was a |
127 // problem communicating with the GPU process. | 127 // problem communicating with the GPU process. |
128 bool IsCommandBufferContextLost(); | 128 bool IsCommandBufferContextLost(); |
129 | 129 |
130 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. Return NULL | 130 // Create & initialize a WebGraphicsContext3DCommandBufferImpl. |
131 // on any failure. | 131 // Return nullptr on any failure. |
132 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* | 132 static CONTENT_EXPORT WebGraphicsContext3DCommandBufferImpl* |
133 CreateOffscreenContext( | 133 CreateOffscreenContext( |
134 GpuChannelHost* host, | 134 GpuChannelHost* host, |
135 const WebGraphicsContext3D::Attributes& attributes, | 135 const WebGraphicsContext3D::Attributes& attributes, |
136 bool lose_context_when_out_of_memory, | 136 bool lose_context_when_out_of_memory, |
137 const GURL& active_url, | 137 const GURL& active_url, |
138 const SharedMemoryLimits& limits, | 138 const SharedMemoryLimits& limits, |
139 WebGraphicsContext3DCommandBufferImpl* share_context); | 139 WebGraphicsContext3DCommandBufferImpl* share_context); |
140 | 140 |
141 size_t GetMappedMemoryLimit() { | 141 size_t GetMappedMemoryLimit() { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // Member variables should appear before the WeakPtrFactory, to ensure | 210 // Member variables should appear before the WeakPtrFactory, to ensure |
211 // that any WeakPtrs to Controller are invalidated before its members | 211 // that any WeakPtrs to Controller are invalidated before its members |
212 // variable's destructors are executed, rendering them invalid. | 212 // variable's destructors are executed, rendering them invalid. |
213 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; | 213 base::WeakPtrFactory<WebGraphicsContext3DCommandBufferImpl> weak_ptr_factory_; |
214 }; | 214 }; |
215 | 215 |
216 } // namespace content | 216 } // namespace content |
217 | 217 |
218 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ | 218 #endif // CONTENT_COMMON_GPU_CLIENT_WEBGRAPHICSCONTEXT3D_COMMAND_BUFFER_IMPL_H_ |
OLD | NEW |