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

Unified Diff: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc

Issue 10446093: Upon receiving OnError callback against a context, only clear the set of created contexts if the re… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index bcce8135965e76aeec0c569058cd6cbde893a56a..e59a87e32e6f61f0f11025ed37904e8af37b02d5 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -45,6 +45,26 @@ void ClearSharedContexts() {
g_all_shared_contexts.Pointer()->clear();
}
+void ClearSharedContextsIfInShareSet(
+ WebGraphicsContext3DCommandBufferImpl* context) {
+ // If the given context isn't in the share set, that means that it
+ // or another context it was previously sharing with already
+ // provoked a lost context. Other contexts might have since been
+ // successfully created and added to the share set, so do not clear
+ // out the share set unless we know that all the contexts in there
+ // are supposed to be lost simultaneously.
+ base::AutoLock lock(g_all_shared_contexts_lock.Get());
+ std::set<WebGraphicsContext3DCommandBufferImpl*>* share_set =
+ g_all_shared_contexts.Pointer();
+ for (std::set<WebGraphicsContext3DCommandBufferImpl*>::iterator iter =
+ share_set->begin(); iter != share_set->end(); ++iter) {
+ if (context == *iter) {
+ share_set->clear();
+ return;
+ }
+ }
+}
+
const int32 kCommandBufferSize = 1024 * 1024;
// TODO(kbr): make the transfer buffer size configurable via context
// creation attributes.
@@ -140,6 +160,9 @@ WebGraphicsContext3DCommandBufferImpl::
if (host_) {
if (host_->WillGpuSwitchOccur(false, gpu_preference_)) {
host_->ForciblyCloseChannel();
+ TRACE_EVENT0(
+ "gpu",
+ "WebGfxCtx3DCmdBfrImpl::~WebGfxCtx3DCmdBfrImpl closed channel");
ClearSharedContexts();
}
}
@@ -192,6 +215,9 @@ bool WebGraphicsContext3DCommandBufferImpl::Initialize(
// channel and recreate it.
if (host_->WillGpuSwitchOccur(true, gpu_preference_)) {
host_->ForciblyCloseChannel();
+ TRACE_EVENT0(
+ "gpu",
+ "WebGfxCtx3DCmdBfrImpl::Initialize closed channel");
ClearSharedContexts();
retry = true;
}
@@ -1515,7 +1541,7 @@ void WebGraphicsContext3DCommandBufferImpl::OnContextLost() {
context_lost_callback_->onContextLost();
}
if (attributes_.shareResources)
- ClearSharedContexts();
+ ClearSharedContextsIfInShareSet(this);
if (ShouldUseSwapClient())
swap_client_->OnViewContextSwapBuffersAborted();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698