Commit 3bc54dcf authored by tfarina's avatar tfarina Committed by Commit bot

android: Pass cc::ContextProvider to VideoContextProvider.

Instead of creating it under VideoContextProvider, which makes
refactoring this code harder, create it outside and pass it through
parameter.

This should help 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

AndroidWebView tests:
$ ninja -C out_android/Debug android_webview_apk android_webview_test_apk
$ build/android/adb_install_apk.py --apk=AndroidWebView.apk --debug
$ build/android/test_runner.py instrumentation --test-apk=AndroidWebViewTest
--test_data webview:android_webview/test/data/device_files --debug

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

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

Cr-Commit-Position: refs/heads/master@{#324309}
parent 808706e7
......@@ -83,11 +83,10 @@ class SynchronousCompositorFactoryImpl::VideoContextProvider
: public StreamTextureFactorySynchronousImpl::ContextProvider {
public:
VideoContextProvider(
scoped_ptr<gpu::GLInProcessContext> gl_in_process_context)
: gl_in_process_context_(gl_in_process_context.get()) {
context_provider_ = webkit::gpu::ContextProviderInProcess::Create(
WrapContext(gl_in_process_context.Pass(), GetDefaultAttribs()),
"Video-Offscreen-main-thread");
scoped_refptr<cc::ContextProvider> context_provider,
gpu::GLInProcessContext* gl_in_process_context)
: context_provider_(context_provider),
gl_in_process_context_(gl_in_process_context) {
context_provider_->BindToCurrentThread();
}
......@@ -262,9 +261,15 @@ SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory() {
attributes.shareResources = false;
// This needs to run in on-screen |service_| context due to SurfaceTexture
// limitations.
video_context_provider_ = new VideoContextProvider(CreateContextHolder(
attributes, service_, gpu::GLInProcessContextSharedMemoryLimits(),
false));
scoped_ptr<gpu::GLInProcessContext> context =
CreateContextHolder(attributes, service_,
gpu::GLInProcessContextSharedMemoryLimits(), false);
gpu::GLInProcessContext* context_ptr = context.get();
video_context_provider_ =
new VideoContextProvider(webkit::gpu::ContextProviderInProcess::Create(
WrapContext(context.Pass(), attributes),
"Video-Offscreen-main-thread"),
context_ptr);
}
return video_context_provider_;
}
......
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