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

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

Issue 10467004: Merge 139884 - Upon receiving OnError callback against a context, only clear the set of created con… (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1132/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
===================================================================
--- content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc (revision 140019)
+++ content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc (working copy)
@@ -45,6 +45,26 @@
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 @@
if (host_) {
if (host_->WillGpuSwitchOccur(false, gpu_preference_)) {
host_->ForciblyCloseChannel();
+ TRACE_EVENT0(
+ "gpu",
+ "WebGfxCtx3DCmdBfrImpl::~WebGfxCtx3DCmdBfrImpl closed channel");
ClearSharedContexts();
}
}
@@ -192,6 +215,9 @@
// channel and recreate it.
if (host_->WillGpuSwitchOccur(true, gpu_preference_)) {
host_->ForciblyCloseChannel();
+ TRACE_EVENT0(
+ "gpu",
+ "WebGfxCtx3DCmdBfrImpl::Initialize closed channel");
ClearSharedContexts();
retry = true;
}
@@ -1514,7 +1540,7 @@
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