summaryrefslogtreecommitdiffstats
path: root/mojo
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 14:43:13 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 14:43:13 +0000
commit828a3933dbfe452718e6602d1afaa2db4d80ab76 (patch)
tree56af77629470fae86de042bc0f9922e57bd5fafe /mojo
parentf3cad76934b9282f7a8d795b27862210ad9f488a (diff)
downloadchromium_src-828a3933dbfe452718e6602d1afaa2db4d80ab76.zip
chromium_src-828a3933dbfe452718e6602d1afaa2db4d80ab76.tar.gz
chromium_src-828a3933dbfe452718e6602d1afaa2db4d80ab76.tar.bz2
gpu: Lose context when BeginQueryEXT fails to allocate.
Instead of crashes, raise a GL_OUT_OF_MEMORY error. Since compositor does not want to deal with these errors and it would leave it in a bad state, add the ability to lose the context when GL_OUT_OF_MEMORY occurs. R=dmichael@chromium.org, jamesr@chromium.org, piman@chromium.org, piman BUG=351587 Review URL: https://codereview.chromium.org/199443004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo')
-rw-r--r--mojo/examples/aura_demo/demo_context_factory.cc8
-rw-r--r--mojo/gles2/gles2_context.cc7
2 files changed, 12 insertions, 3 deletions
diff --git a/mojo/examples/aura_demo/demo_context_factory.cc b/mojo/examples/aura_demo/demo_context_factory.cc
index e9312ad..4040208 100644
--- a/mojo/examples/aura_demo/demo_context_factory.cc
+++ b/mojo/examples/aura_demo/demo_context_factory.cc
@@ -56,8 +56,10 @@ DemoContextFactory::OffscreenCompositorContextProvider() {
// to leak the context provider when we shutdown to avoid destroying the
// contexts on the wrong thread.
DCHECK(!ui::Compositor::WasInitializedWithThread());
+ bool lose_context_when_out_of_memory = true;
offscreen_compositor_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen();
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen(
+ lose_context_when_out_of_memory);
}
return offscreen_compositor_contexts_;
}
@@ -66,8 +68,10 @@ scoped_refptr<cc::ContextProvider>
DemoContextFactory::SharedMainThreadContextProvider() {
if (!shared_main_thread_contexts_ ||
shared_main_thread_contexts_->DestroyedOnMainThread()) {
+ bool lose_context_when_out_of_memory = false;
shared_main_thread_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen();
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen(
+ lose_context_when_out_of_memory);
if (shared_main_thread_contexts_ &&
!shared_main_thread_contexts_->BindToCurrentThread())
shared_main_thread_contexts_ = NULL;
diff --git a/mojo/gles2/gles2_context.cc b/mojo/gles2/gles2_context.cc
index 6d4106d..306ffeb 100644
--- a/mojo/gles2/gles2_context.cc
+++ b/mojo/gles2/gles2_context.cc
@@ -40,11 +40,16 @@ bool GLES2Context::Initialize() {
return false;
gles2_helper_->SetAutomaticFlushes(false);
transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
+ bool bind_generates_resource = true;
+ // TODO(piman): Some contexts (such as compositor) want this to be true, so
+ // this needs to be a public parameter.
+ bool lose_context_when_out_of_memory = false;
implementation_.reset(
new gpu::gles2::GLES2Implementation(gles2_helper_.get(),
NULL,
transfer_buffer_.get(),
- true,
+ bind_generates_resource,
+ lose_context_when_out_of_memory,
&command_buffer_));
return implementation_->Initialize(kDefaultStartTransferBufferSize,
kDefaultMinTransferBufferSize,