Skip to content

Instantly share code, notes, and snippets.

@tiagovignatti
Created October 10, 2013 12:57
Show Gist options
  • Save tiagovignatti/6917897 to your computer and use it in GitHub Desktop.
Save tiagovignatti/6917897 to your computer and use it in GitHub Desktop.
diff --git a/content/browser/aura/gpu_process_transport_factory.cc b/content/browser/aura/gpu_process_transport_factory.cc
index 2d09b24..43173d9 100644
--- a/content/browser/aura/gpu_process_transport_factory.cc
+++ b/content/browser/aura/gpu_process_transport_factory.cc
@@ -435,8 +435,10 @@ GpuProcessTransportFactory::SharedMainThreadContextProvider() {
base::Bind(&GpuProcessTransportFactory::
OnLostMainThreadSharedContextInsideCallback,
callback_factory_.GetWeakPtr()));
- if (!shared_main_thread_contexts_->BindToCurrentThread())
+ if (!shared_main_thread_contexts_->BindToCurrentThread()) {
+ shared_main_thread_contexts_->UnsetLostContextCallback();
shared_main_thread_contexts_ = NULL;
+ }
}
return shared_main_thread_contexts_;
}
diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc
index 9d4a183..7a556fe 100644
--- a/content/common/gpu/client/context_provider_command_buffer.cc
+++ b/content/common/gpu/client/context_provider_command_buffer.cc
@@ -300,6 +300,13 @@ void ContextProviderCommandBuffer::SetLostContextCallback(
lost_context_callback_ = lost_context_callback;
}
+void ContextProviderCommandBuffer::UnsetLostContextCallback() {
+ DCHECK(context_thread_checker_.CalledOnValidThread());
+ DCHECK(!lost_context_callback_.is_null());
+
+ base::ResetAndReturn(&lost_context_callback_);
+}
+
void ContextProviderCommandBuffer::SetSwapBuffersCompleteCallback(
const SwapBuffersCompleteCallback& swap_buffers_complete_callback) {
DCHECK(context_thread_checker_.CalledOnValidThread());
diff --git a/content/common/gpu/client/context_provider_command_buffer.h b/content/common/gpu/client/context_provider_command_buffer.h
index 63cd6ef..cb67936 100644
--- a/content/common/gpu/client/context_provider_command_buffer.h
+++ b/content/common/gpu/client/context_provider_command_buffer.h
@@ -35,6 +35,7 @@ class ContextProviderCommandBuffer : public cc::ContextProvider {
virtual bool DestroyedOnMainThread() OVERRIDE;
virtual void SetLostContextCallback(
const LostContextCallback& lost_context_callback) OVERRIDE;
+ virtual void UnsetLostContextCallback() OVERRIDE;
virtual void SetSwapBuffersCompleteCallback(
const SwapBuffersCompleteCallback& swap_buffers_complete_callback)
OVERRIDE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment