OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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.content.browser; | |
6 | |
7 import android.graphics.SurfaceTexture; | |
8 import android.view.Surface; | |
9 | |
10 import org.chromium.base.CalledByNative; | |
11 import org.chromium.base.JNINamespace; | |
12 | |
13 @JNINamespace("content") | |
14 class BrowserProcessSurfaceTexture { | |
15 /** | |
16 * Called from native code to set up the peer surface texture producer in | |
17 * another process. | |
18 * | |
19 * @param pid Process handle of the sandboxed process to share the | |
20 * SurfaceTexture with. | |
21 * @param type The type of process that the SurfaceTexture is for. | |
22 * @param st The SurfaceTexture object to share with the sandboxed process. | |
23 * @param primaryID Used to route the call to the correct client instance. | |
24 * @param secondaryID Used to route the call to the correct client instance. | |
25 */ | |
26 @SuppressWarnings("unused") | |
27 @CalledByNative | |
28 static void establishSurfaceTexturePeer(int pid, int type, SurfaceTexture st
, int primaryID, | |
29 int secondaryID) { | |
30 Surface surface = new Surface(st); | |
31 SandboxedProcessLauncher.establishSurfacePeer(pid, type, surface, primar
yID, secondaryID); | |
32 | |
33 // We need to explicitly release the native resource of our newly create
d surface | |
34 // or the Surface class will print a warning message to the log in its f
inalizer. | |
35 // This should be ok to do since our caller is responsible for retaining
a | |
36 // reference to the SurfaceTexture that is being sent across processes a
nd the | |
37 // receiving end should have retained a reference before the binder call
finished. | |
38 surface.release(); | |
39 } | |
40 } | |
OLD | NEW |