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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 284 } |
285 if (gpu::error::IsError(command_buffer_->GetLastError())) { | 285 if (gpu::error::IsError(command_buffer_->GetLastError())) { |
286 LOG(ERROR) << "Context dead on arrival. Last error: " | 286 LOG(ERROR) << "Context dead on arrival. Last error: " |
287 << command_buffer_->GetLastError(); | 287 << command_buffer_->GetLastError(); |
288 return false; | 288 return false; |
289 } | 289 } |
290 | 290 |
291 return true; | 291 return true; |
292 } | 292 } |
293 | 293 |
| 294 void WebGraphicsContext3DCommandBufferImpl:: |
| 295 InvalidateWeakPtrsOnCurrentThread() { |
| 296 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 297 } |
| 298 |
294 void WebGraphicsContext3DCommandBufferImpl::Destroy() { | 299 void WebGraphicsContext3DCommandBufferImpl::Destroy() { |
295 share_group_->RemoveContext(this); | 300 share_group_->RemoveContext(this); |
296 | 301 |
297 gpu::gles2::GLES2Interface* gl = GetGLInterface(); | 302 gpu::gles2::GLES2Interface* gl = GetGLInterface(); |
298 if (gl) { | 303 if (gl) { |
299 // First flush the context to ensure that any pending frees of resources | 304 // First flush the context to ensure that any pending frees of resources |
300 // are completed. Otherwise, if this context is part of a share group, | 305 // are completed. Otherwise, if this context is part of a share group, |
301 // those resources might leak. Also, any remaining side effects of commands | 306 // those resources might leak. Also, any remaining side effects of commands |
302 // issued on this context might not be visible to other contexts in the | 307 // issued on this context might not be visible to other contexts in the |
303 // share group. | 308 // share group. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 { | 369 { |
365 base::AutoLock lock(g_default_share_groups_lock.Get()); | 370 base::AutoLock lock(g_default_share_groups_lock.Get()); |
366 g_default_share_groups.Get().erase(host_.get()); | 371 g_default_share_groups.Get().erase(host_.get()); |
367 } | 372 } |
368 | 373 |
369 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); | 374 gpu::CommandBuffer::State state = command_buffer_->GetLastState(); |
370 UmaRecordContextLost(context_type_, state.error, state.context_lost_reason); | 375 UmaRecordContextLost(context_type_, state.error, state.context_lost_reason); |
371 } | 376 } |
372 | 377 |
373 } // namespace content | 378 } // namespace content |
OLD | NEW |