| Index: content/app/android/child_process_service.cc
|
| diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc
|
| index dae54e5941d31fbba56b4f9ce75843ef42ed9eea..791b85ee5e5451b69cb19cb749cfcb199311cccf 100644
|
| --- a/content/app/android/child_process_service.cc
|
| +++ b/content/app/android/child_process_service.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/logging.h"
|
| #include "base/posix/global_descriptors.h"
|
| #include "content/child/child_thread.h"
|
| +#include "content/common/android/surface_texture_lookup.h"
|
| #include "content/common/android/surface_texture_peer.h"
|
| #include "content/common/gpu/gpu_surface_lookup.h"
|
| #include "content/public/app/android_library_loader_hooks.h"
|
| @@ -79,6 +80,37 @@ class SurfaceTexturePeerChildImpl : public content::SurfaceTexturePeer,
|
| DISALLOW_COPY_AND_ASSIGN(SurfaceTexturePeerChildImpl);
|
| };
|
|
|
| +class SurfaceTextureLookupChildImpl : public content::SurfaceTextureLookup {
|
| + public:
|
| + // |service| is the instance of
|
| + // org.chromium.content.app.ChildProcessService.
|
| + explicit SurfaceTextureLookupChildImpl(
|
| + const base::android::ScopedJavaLocalRef<jobject>& service)
|
| + : service_(service) {}
|
| +
|
| + virtual gfx::AcceleratedWidget AcquireNativeWidget(int surface_texture_id)
|
| + OVERRIDE {
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + gfx::ScopedJavaSurface surface(
|
| + content::Java_ChildProcessService_getSurfaceTextureSurface(
|
| + env, service_.obj(), surface_texture_id));
|
| +
|
| + if (surface.j_surface().is_null())
|
| + return NULL;
|
| +
|
| + ANativeWindow* native_window =
|
| + ANativeWindow_fromSurface(env, surface.j_surface().obj());
|
| +
|
| + return native_window;
|
| + }
|
| +
|
| + private:
|
| + // The instance of org.chromium.content.app.ChildProcessService.
|
| + base::android::ScopedJavaGlobalRef<jobject> service_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SurfaceTextureLookupChildImpl);
|
| +};
|
| +
|
| // Chrome actually uses the renderer code path for all of its child
|
| // processes such as renderers, plugins, etc.
|
| void InternalInitChildProcess(const std::vector<int>& file_ids,
|
| @@ -103,6 +135,9 @@ void InternalInitChildProcess(const std::vector<int>& file_ids,
|
| content::SurfaceTexturePeer::InitInstance(
|
| new SurfaceTexturePeerChildImpl(service));
|
|
|
| + content::SurfaceTextureLookup::InitInstance(
|
| + new SurfaceTextureLookupChildImpl(service));
|
| +
|
| base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env);
|
| }
|
|
|
|
|