OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 package org.chromium.media; |
| 6 |
| 7 import android.os.IBinder; |
| 8 import android.os.RemoteException; |
| 9 |
| 10 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.base.annotations.JNINamespace; |
| 12 |
| 13 /** |
| 14 * Wrapper for IDialogSurfaceManager, to provide JNI bindings for arbitrary |
| 15 * implementations of IDialogSurfaceManager. In practice, there is one: the |
| 16 * IBinder stub we get from the browser. However, if one creates a local |
| 17 * manager such as in the GPU process, then this will work too. |
| 18 * |
| 19 * When one gets an IDialogSurfaceManager, whether remote from the browser or |
| 20 * local (if supported), it can be used by native classes by wrapping it in a |
| 21 * DialogSurfaceManagerWrapper instance. |
| 22 * |
| 23 * While it's not strictly needed, the wrapper implements IDialogSurfaceManager |
| 24 * too. It's helpful, since it makes changes to the interface into compile- |
| 25 * time errors. |
| 26 * |
| 27 * Note that all of that is wrapped in the C++ bindings for this class, so see |
| 28 * the docs in dialog_surface_manager.h if you'd like to use this in C++. |
| 29 */ |
| 30 @JNINamespace("media") |
| 31 class DialogSurfaceManagerWrapper implements IDialogSurfaceManager { |
| 32 private final IDialogSurfaceManager mManager; |
| 33 |
| 34 private DialogSurfaceManagerWrapper(IDialogSurfaceManager manager) { |
| 35 mManager = manager; |
| 36 } |
| 37 |
| 38 @CalledByNative |
| 39 private static DialogSurfaceManagerWrapper wrap(IBinder manager) { |
| 40 return new DialogSurfaceManagerWrapper(IDialogSurfaceManager.Stub.asInte
rface(manager)); |
| 41 } |
| 42 |
| 43 @Override |
| 44 @CalledByNative |
| 45 public IDialogSurface createSurface(int rendererPid, int renderFrameId, |
| 46 IDialogSurfaceCallback callback, int x, int y, int width, int height
) |
| 47 throws RemoteException { |
| 48 return mManager.createSurface(rendererPid, renderFrameId, callback, x, y
, width, height); |
| 49 } |
| 50 |
| 51 // We don't really implement a binderable interface, though I suppose that |
| 52 // we could return mManager.asBinder(). |
| 53 @Override |
| 54 public IBinder asBinder() { |
| 55 return null; |
| 56 } |
| 57 } |
OLD | NEW |