Index: media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
diff --git a/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java b/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9142a4bffc22f8542b23b1f97c995865d9a2a93 |
--- /dev/null |
+++ b/media/base/android/java/src/org/chromium/media/DialogSurfaceManagerWrapper.java |
@@ -0,0 +1,57 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.media; |
+ |
+import android.os.IBinder; |
+import android.os.RemoteException; |
+ |
+import org.chromium.base.annotations.CalledByNative; |
+import org.chromium.base.annotations.JNINamespace; |
+ |
+/** |
+ * Wrapper for IDialogSurfaceManager, to provide JNI bindings for arbitrary |
+ * implementations of IDialogSurfaceManager. In practice, there is one: the |
+ * IBinder stub we get from the browser. However, if one creates a local |
+ * manager such as in the GPU process, then this will work too. |
+ * |
+ * When one gets an IDialogSurfaceManager, whether remote from the browser or |
+ * local (if supported), it can be used by native classes by wrapping it in a |
+ * DialogSurfaceManagerWrapper instance. |
+ * |
+ * While it's not strictly needed, the wrapper implements IDialogSurfaceManager |
+ * too. It's helpful, since it makes changes to the interface into compile- |
+ * time errors. |
+ * |
+ * Note that all of that is wrapped in the C++ bindings for this class, so see |
+ * the docs in dialog_surface_manager.h if you'd like to use this in C++. |
+ */ |
+@JNINamespace("media") |
+class DialogSurfaceManagerWrapper implements IDialogSurfaceManager { |
boliu
2017/01/04 01:48:44
ditto about not needing to inherit from IDialogSur
liberato (no reviews please)
2017/01/11 22:17:57
will be removed along with the renaming in a separ
|
+ private final IDialogSurfaceManager mManager; |
+ |
+ private DialogSurfaceManagerWrapper(IDialogSurfaceManager manager) { |
+ mManager = manager; |
+ } |
+ |
+ @CalledByNative |
+ private static DialogSurfaceManagerWrapper wrap(IBinder manager) { |
+ return new DialogSurfaceManagerWrapper(IDialogSurfaceManager.Stub.asInterface(manager)); |
+ } |
+ |
+ @Override |
+ @CalledByNative |
+ public IDialogSurface createSurface(int rendererPid, int renderFrameId, |
+ IDialogSurfaceCallback callback, int x, int y, int width, int height) |
+ throws RemoteException { |
+ return mManager.createSurface(rendererPid, renderFrameId, callback, x, y, width, height); |
+ } |
+ |
+ // We don't really implement a binderable interface, though I suppose that |
+ // we could return mManager.asBinder(). |
+ @Override |
+ public IBinder asBinder() { |
+ return null; |
+ } |
+} |