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

Unified Diff: content/app/android/child_process_service.cc

Issue 195583003: Add initial GpuMemoryBufferSurfaceTexture implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add ::InitInstance comments. Created 6 years, 9 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
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..28b81d9d9568dd6aa49febca0e7dac654e5a240c 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)
no sievers 2014/03/14 01:24:51 Do you maybe just fold this into the existing Surf
reveman 2014/03/14 19:44:53 To fold this into the above class I'd like to merg
no sievers 2014/03/18 20:58:12 For the view surface lookup, it's slightly differe
+ : 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,11 @@ void InternalInitChildProcess(const std::vector<int>& file_ids,
content::SurfaceTexturePeer::InitInstance(
new SurfaceTexturePeerChildImpl(service));
+ // SurfaceTextureLookup instance must be set before we create a compositor
+ // thread that could be using it to initialize resources.
+ content::SurfaceTextureLookup::InitInstance(
+ new SurfaceTextureLookupChildImpl(service));
+
base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(env);
}

Powered by Google App Engine
This is Rietveld 408576698