Commit 838538ba authored by tfarina's avatar tfarina Committed by Commit bot

android: Merge WrapContext and WrapContextWithAttributes into a single function.

Refactored these two functions into a single one to ease the
transition of https://codereview.chromium.org/920443003.

Tested on Android (with Nexus 5 device) with the following command
lines:

$ ./build/gyp_chromium -DOS=android -Goutput_dir=out_android
$ ninja -C out_android/Debug content_unittests content_unittests_apk
$ export CHROMIUM_OUT_DIR=out_android
$ build/android/test_runner.py gtest -s content_unittests --debug

BUG=338338
TEST=see above
R=boliu@chromium.org

Review URL: https://codereview.chromium.org/1064033002

Cr-Commit-Position: refs/heads/master@{#324111}
parent 905e4348
...@@ -67,17 +67,6 @@ scoped_ptr<gpu::GLInProcessContext> CreateContextHolder( ...@@ -67,17 +67,6 @@ scoped_ptr<gpu::GLInProcessContext> CreateContextHolder(
} }
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext(
scoped_ptr<gpu::GLInProcessContext> context) {
if (!context.get())
return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>();
return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(
WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
context.Pass(), GetDefaultAttribs()));
}
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
WrapContextWithAttributes(
scoped_ptr<gpu::GLInProcessContext> context, scoped_ptr<gpu::GLInProcessContext> context,
const blink::WebGraphicsContext3D::Attributes& attributes) { const blink::WebGraphicsContext3D::Attributes& attributes) {
if (!context.get()) if (!context.get())
...@@ -96,9 +85,8 @@ class SynchronousCompositorFactoryImpl::VideoContextProvider ...@@ -96,9 +85,8 @@ class SynchronousCompositorFactoryImpl::VideoContextProvider
VideoContextProvider( VideoContextProvider(
scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) scoped_ptr<gpu::GLInProcessContext> gl_in_process_context)
: gl_in_process_context_(gl_in_process_context.get()) { : gl_in_process_context_(gl_in_process_context.get()) {
context_provider_ = webkit::gpu::ContextProviderInProcess::Create( context_provider_ = webkit::gpu::ContextProviderInProcess::Create(
WrapContext(gl_in_process_context.Pass()), WrapContext(gl_in_process_context.Pass(), GetDefaultAttribs()),
"Video-Offscreen-main-thread"); "Video-Offscreen-main-thread");
context_provider_->BindToCurrentThread(); context_provider_->BindToCurrentThread();
} }
...@@ -185,20 +173,21 @@ SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider( ...@@ -185,20 +173,21 @@ SynchronousCompositorFactoryImpl::CreateOffscreenContextProvider(
scoped_ptr<gpu::GLInProcessContext> context = CreateContextHolder( scoped_ptr<gpu::GLInProcessContext> context = CreateContextHolder(
attributes, nullptr, gpu::GLInProcessContextSharedMemoryLimits(), true); attributes, nullptr, gpu::GLInProcessContextSharedMemoryLimits(), true);
return webkit::gpu::ContextProviderInProcess::Create( return webkit::gpu::ContextProviderInProcess::Create(
WrapContext(context.Pass()), debug_name); WrapContext(context.Pass(), attributes), debug_name);
} }
scoped_refptr<cc::ContextProvider> scoped_refptr<cc::ContextProvider>
SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() { SynchronousCompositorFactoryImpl::CreateContextProviderForCompositor() {
DCHECK(service_.get()); DCHECK(service_.get());
blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs();
gpu::GLInProcessContextSharedMemoryLimits mem_limits; gpu::GLInProcessContextSharedMemoryLimits mem_limits;
// This is half of what RenderWidget uses because synchronous compositor // This is half of what RenderWidget uses because synchronous compositor
// pipeline is only one frame deep. // pipeline is only one frame deep.
mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024; mem_limits.mapped_memory_reclaim_limit = 6 * 1024 * 1024;
return webkit::gpu::ContextProviderInProcess::Create( return webkit::gpu::ContextProviderInProcess::Create(
WrapContext( WrapContext(CreateContextHolder(attributes, nullptr, mem_limits, true),
CreateContextHolder(GetDefaultAttribs(), nullptr, mem_limits, true)), attributes),
"Child-Compositor"); "Child-Compositor");
} }
...@@ -216,11 +205,10 @@ SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) { ...@@ -216,11 +205,10 @@ SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int frame_id) {
WebGraphicsContext3DInProcessCommandBufferImpl* WebGraphicsContext3DInProcessCommandBufferImpl*
SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D(
const blink::WebGraphicsContext3D::Attributes& attributes) { const blink::WebGraphicsContext3D::Attributes& attributes) {
return WrapContextWithAttributes( return WrapContext(CreateContextHolder(
CreateContextHolder(attributes, nullptr, attributes, nullptr,
gpu::GLInProcessContextSharedMemoryLimits(), gpu::GLInProcessContextSharedMemoryLimits(), true),
true), attributes).release();
attributes).release();
} }
void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment