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

Unified Diff: content/browser/android/in_process/synchronous_compositor_factory_impl.cc

Issue 455083002: Add memory limits struct to in-process context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | « cc/test/test_in_process_context_provider.cc ('k') | gpu/command_buffer/client/gl_in_process_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/in_process/synchronous_compositor_factory_impl.cc
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
index af50011c7b90b994f70ed2c229f1e85f16075a5b..9e5c89de40bcf92975c98ae39c2ba602babdf4b9 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -44,38 +44,41 @@ scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext(
attributes, &in_process_attribs);
in_process_attribs.lose_context_when_out_of_memory = true;
- scoped_ptr<gpu::GLInProcessContext> context(
- gpu::GLInProcessContext::Create(NULL /* service */,
- NULL /* surface */,
- true /* is_offscreen */,
- gfx::kNullAcceleratedWidget,
- gfx::Size(1, 1),
- NULL /* share_context */,
- false /* share_resources */,
- in_process_attribs,
- gpu_preference));
+ scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
+ NULL /* service */,
+ NULL /* surface */,
+ true /* is_offscreen */,
+ gfx::kNullAcceleratedWidget,
+ gfx::Size(1, 1),
+ NULL /* share_context */,
+ false /* share_resources */,
+ in_process_attribs,
+ gpu_preference,
+ gpu::GLInProcessContextSharedMemoryLimits()));
return context.Pass();
}
scoped_ptr<gpu::GLInProcessContext> CreateContext(
scoped_refptr<gpu::InProcessCommandBuffer::Service> service,
- gpu::GLInProcessContext* share_context) {
+ gpu::GLInProcessContext* share_context,
+ const gpu::GLInProcessContextSharedMemoryLimits& mem_limits) {
const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
gpu::gles2::ContextCreationAttribHelper in_process_attribs;
WebGraphicsContext3DImpl::ConvertAttributes(
GetDefaultAttribs(), &in_process_attribs);
in_process_attribs.lose_context_when_out_of_memory = true;
- scoped_ptr<gpu::GLInProcessContext> context(
- gpu::GLInProcessContext::Create(service,
- NULL /* surface */,
- false /* is_offscreen */,
- gfx::kNullAcceleratedWidget,
- gfx::Size(1, 1),
- share_context,
- false /* share_resources */,
- in_process_attribs,
- gpu_preference));
+ scoped_ptr<gpu::GLInProcessContext> context(gpu::GLInProcessContext::Create(
+ service,
+ NULL /* surface */,
+ false /* is_offscreen */,
+ gfx::kNullAcceleratedWidget,
+ gfx::Size(1, 1),
+ share_context,
+ false /* share_resources */,
+ in_process_attribs,
+ gpu_preference,
+ mem_limits));
return context.Pass();
}
@@ -184,10 +187,15 @@ scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl::
CreateOnscreenContextProviderForCompositorThread() {
DCHECK(service_);
- if (!share_context_.get())
- share_context_ = CreateContext(service_, NULL);
+ if (!share_context_.get()) {
+ share_context_ = CreateContext(
+ service_, NULL, gpu::GLInProcessContextSharedMemoryLimits());
+ }
+ gpu::GLInProcessContextSharedMemoryLimits mem_limits;
+ mem_limits.mapped_memory_reclaim_limit =
+ static_cast<size_t>(6.4 * 1024 * 1024);
piman 2014/08/19 22:58:13 nit: it's odd to use doubles to select a memory li
boliu 2014/08/19 23:06:38 It's from this code in render_widget.cc, but using
return webkit::gpu::ContextProviderInProcess::Create(
- WrapContext(CreateContext(service_, share_context_.get())),
+ WrapContext(CreateContext(service_, share_context_.get(), mem_limits)),
"Child-Compositor");
}
@@ -248,7 +256,9 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() {
DCHECK(share_context_.get());
video_context_provider_ = new VideoContextProvider(
- CreateContext(service_, share_context_.get()));
+ CreateContext(service_,
+ share_context_.get(),
+ gpu::GLInProcessContextSharedMemoryLimits()));
}
return video_context_provider_;
}
« no previous file with comments | « cc/test/test_in_process_context_provider.cc ('k') | gpu/command_buffer/client/gl_in_process_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698