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

Side by Side Diff: mojo/examples/aura_demo/demo_context_factory.cc

Issue 199443004: gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: checkmem: benchmark Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « gpu/gles2_conform_support/egl/display.cc ('k') | mojo/gles2/gles2_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/examples/aura_demo/demo_context_factory.h" 5 #include "mojo/examples/aura_demo/demo_context_factory.h"
6 6
7 #include "cc/output/output_surface.h" 7 #include "cc/output/output_surface.h"
8 #include "mojo/examples/aura_demo/window_tree_host_mojo.h" 8 #include "mojo/examples/aura_demo/window_tree_host_mojo.h"
9 #include "mojo/examples/compositor_app/mojo_context_provider.h" 9 #include "mojo/examples/compositor_app/mojo_context_provider.h"
10 #include "ui/compositor/reflector.h" 10 #include "ui/compositor/reflector.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 49 }
50 50
51 scoped_refptr<cc::ContextProvider> 51 scoped_refptr<cc::ContextProvider>
52 DemoContextFactory::OffscreenCompositorContextProvider() { 52 DemoContextFactory::OffscreenCompositorContextProvider() {
53 if (!offscreen_compositor_contexts_.get() || 53 if (!offscreen_compositor_contexts_.get() ||
54 offscreen_compositor_contexts_->DestroyedOnMainThread()) { 54 offscreen_compositor_contexts_->DestroyedOnMainThread()) {
55 // If the compositor was initialized with its own thread then we would need 55 // If the compositor was initialized with its own thread then we would need
56 // to leak the context provider when we shutdown to avoid destroying the 56 // to leak the context provider when we shutdown to avoid destroying the
57 // contexts on the wrong thread. 57 // contexts on the wrong thread.
58 DCHECK(!ui::Compositor::WasInitializedWithThread()); 58 DCHECK(!ui::Compositor::WasInitializedWithThread());
59 bool lose_context_when_out_of_memory = true;
59 offscreen_compositor_contexts_ = 60 offscreen_compositor_contexts_ =
60 webkit::gpu::ContextProviderInProcess::CreateOffscreen(); 61 webkit::gpu::ContextProviderInProcess::CreateOffscreen(
62 lose_context_when_out_of_memory);
61 } 63 }
62 return offscreen_compositor_contexts_; 64 return offscreen_compositor_contexts_;
63 } 65 }
64 66
65 scoped_refptr<cc::ContextProvider> 67 scoped_refptr<cc::ContextProvider>
66 DemoContextFactory::SharedMainThreadContextProvider() { 68 DemoContextFactory::SharedMainThreadContextProvider() {
67 if (!shared_main_thread_contexts_ || 69 if (!shared_main_thread_contexts_ ||
68 shared_main_thread_contexts_->DestroyedOnMainThread()) { 70 shared_main_thread_contexts_->DestroyedOnMainThread()) {
71 bool lose_context_when_out_of_memory = false;
69 shared_main_thread_contexts_ = 72 shared_main_thread_contexts_ =
70 webkit::gpu::ContextProviderInProcess::CreateOffscreen(); 73 webkit::gpu::ContextProviderInProcess::CreateOffscreen(
74 lose_context_when_out_of_memory);
71 if (shared_main_thread_contexts_ && 75 if (shared_main_thread_contexts_ &&
72 !shared_main_thread_contexts_->BindToCurrentThread()) 76 !shared_main_thread_contexts_->BindToCurrentThread())
73 shared_main_thread_contexts_ = NULL; 77 shared_main_thread_contexts_ = NULL;
74 } 78 }
75 return shared_main_thread_contexts_; 79 return shared_main_thread_contexts_;
76 } 80 }
77 81
78 void DemoContextFactory::RemoveCompositor(ui::Compositor* compositor) { 82 void DemoContextFactory::RemoveCompositor(ui::Compositor* compositor) {
79 } 83 }
80 84
81 bool DemoContextFactory::DoesCreateTestContexts() { return false; } 85 bool DemoContextFactory::DoesCreateTestContexts() { return false; }
82 86
83 } // namespace examples 87 } // namespace examples
84 } // namespace mojo 88 } // namespace mojo
85 89
OLDNEW
« no previous file with comments | « gpu/gles2_conform_support/egl/display.cc ('k') | mojo/gles2/gles2_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698