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

Side by Side Diff: content/browser/renderer_host/image_transport_factory_android.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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/image_transport_factory_android.h" 5 #include "content/browser/renderer_host/image_transport_factory_android.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 9 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
10 #include "content/common/gpu/client/gl_helper.h" 10 #include "content/common/gpu/client/gl_helper.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 display_info.GetDisplayWidth() * 75 display_info.GetDisplayWidth() *
76 kBytesPerPixel; 76 kBytesPerPixel;
77 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 77 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
78 limits.command_buffer_size = 64 * 1024; 78 limits.command_buffer_size = 64 * 1024;
79 limits.start_transfer_buffer_size = 64 * 1024; 79 limits.start_transfer_buffer_size = 64 * 1024;
80 limits.min_transfer_buffer_size = 64 * 1024; 80 limits.min_transfer_buffer_size = 64 * 1024;
81 limits.max_transfer_buffer_size = std::min( 81 limits.max_transfer_buffer_size = std::min(
82 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize); 82 3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
83 limits.mapped_memory_reclaim_limit = 83 limits.mapped_memory_reclaim_limit =
84 WebGraphicsContext3DCommandBufferImpl::kNoLimit; 84 WebGraphicsContext3DCommandBufferImpl::kNoLimit;
85 bool bind_generates_resource = false;
86 bool lose_context_when_out_of_memory = false;
85 context_.reset( 87 context_.reset(
86 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen 88 new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
87 url, 89 url,
88 gpu_channel_host.get(), 90 gpu_channel_host.get(),
89 attrs, 91 attrs,
90 false, 92 bind_generates_resource,
93 lose_context_when_out_of_memory,
91 limits, 94 limits,
92 NULL)); 95 NULL));
93 context_->setContextLostCallback(context_lost_listener_.get()); 96 context_->setContextLostCallback(context_lost_listener_.get());
94 if (context_->makeContextCurrent()) 97 if (context_->makeContextCurrent())
95 context_->pushGroupMarkerEXT( 98 context_->pushGroupMarkerEXT(
96 base::StringPrintf("CmdBufferImageTransportFactory-%p", 99 base::StringPrintf("CmdBufferImageTransportFactory-%p",
97 context_.get()).c_str()); 100 context_.get()).c_str());
98 } 101 }
99 102
100 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() { 103 CmdBufferImageTransportFactory::~CmdBufferImageTransportFactory() {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 191
189 void GLContextLostListener::DidLoseContext() { 192 void GLContextLostListener::DidLoseContext() {
190 delete g_factory; 193 delete g_factory;
191 g_factory = NULL; 194 g_factory = NULL;
192 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver, 195 FOR_EACH_OBSERVER(ImageTransportFactoryAndroidObserver,
193 g_factory_observers.Get(), 196 g_factory_observers.Get(),
194 OnLostResources()); 197 OnLostResources());
195 } 198 }
196 199
197 } // namespace content 200 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698