Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Side by Side Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 1317743002: cc: Implement shared worker contexts. (v1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: invalidate weak ptrs when detaching context from thread Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698