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 "gpu/blink/webgraphicscontext3d_in_process_command_buffer_impl.h" | 5 #include "gpu/blink/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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 base::Unretained(this)); | 132 base::Unretained(this)); |
133 context_->SetContextLostCallback(context_lost_callback); | 133 context_->SetContextLostCallback(context_lost_callback); |
134 } else { | 134 } else { |
135 initialize_failed_ = true; | 135 initialize_failed_ = true; |
136 return false; | 136 return false; |
137 } | 137 } |
138 | 138 |
139 real_gl_ = context_->GetImplementation(); | 139 real_gl_ = context_->GetImplementation(); |
140 setGLInterface(real_gl_); | 140 setGLInterface(real_gl_); |
141 | 141 |
| 142 real_gl_->TraceBeginCHROMIUM("WebGraphicsContext3D", |
| 143 "InProcessContext"); |
| 144 |
142 initialized_ = true; | 145 initialized_ = true; |
143 return true; | 146 return true; |
144 } | 147 } |
145 | 148 |
146 bool | 149 bool |
147 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { | 150 WebGraphicsContext3DInProcessCommandBufferImpl::InitializeOnCurrentThread() { |
148 if (!MaybeInitializeGL()) | 151 if (!MaybeInitializeGL()) |
149 return false; | 152 return false; |
150 return context_ && !isContextLost(); | 153 return context_ && !isContextLost(); |
151 } | 154 } |
152 | 155 |
153 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { | 156 void WebGraphicsContext3DInProcessCommandBufferImpl::SetLock(base::Lock* lock) { |
154 context_->SetLock(lock); | 157 context_->SetLock(lock); |
155 } | 158 } |
156 | 159 |
157 ::gpu::ContextSupport* | 160 ::gpu::ContextSupport* |
158 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { | 161 WebGraphicsContext3DInProcessCommandBufferImpl::GetContextSupport() { |
159 return real_gl_; | 162 return real_gl_; |
160 } | 163 } |
161 | 164 |
162 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { | 165 void WebGraphicsContext3DInProcessCommandBufferImpl::OnContextLost() { |
163 if (context_lost_callback_) { | 166 if (context_lost_callback_) { |
164 context_lost_callback_->onContextLost(); | 167 context_lost_callback_->onContextLost(); |
165 } | 168 } |
166 } | 169 } |
167 | 170 |
168 } // namespace gpu_blink | 171 } // namespace gpu_blink |
OLD | NEW |