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 #ifndef CONTENT_COMMON_ANDROID_SURFACE_CALLBACK_H_ | |
6 #define CONTENT_COMMON_ANDROID_SURFACE_CALLBACK_H_ | |
7 #pragma once | |
8 | |
9 #include <jni.h> | |
10 | |
11 #include "base/callback.h" | |
12 #include "content/common/android/surface_texture_peer.h" | |
13 | |
14 struct ANativeWindow; | |
15 | |
16 namespace base { | |
17 class MessageLoopProxy; | |
18 class WaitableEvent; | |
19 } | |
20 | |
21 namespace content { | |
22 // This file implements support for passing surface handles from Java | |
jam
2012/06/11 20:13:17
nit: usually there's a blank line after the namesp
michaelbai
2012/06/11 20:30:16
Done.
| |
23 // to the correct thread on the native side. On Android, these surface | |
24 // handles can only be passed across processes through Java IPC (Binder), | |
25 // which means calls from Java come in on arbitrary threads. Hence the | |
26 // static nature and the need for the client to register a callback with | |
27 // the corresponding message loop. | |
28 | |
29 // Asynchronously sets the Surface. This can be called from any thread. | |
30 // The Surface will be set to the proper thread based on the type. The | |
31 // nature of primary_id and secondary_id depend on the type of surface | |
32 // and are used to route the surface to the correct client. | |
33 // This method will call release() on the jsurface object to release | |
34 // all the resources. So after calling this method, the caller should | |
35 // not use the jsurface object again. | |
36 void SetSurfaceAsync(JNIEnv* env, | |
37 jobject jsurface, | |
38 content::SurfaceTexturePeer::SurfaceTextureTarget type, | |
jam
2012/06/11 20:13:17
nit: no need for content::
michaelbai
2012/06/11 20:30:16
Done.
| |
39 int primary_id, | |
40 int secondary_id, | |
41 base::WaitableEvent* completion); | |
42 | |
43 void ReleaseSurface(jobject surface); | |
44 | |
45 typedef base::Callback<void(int, int, ANativeWindow*, base::WaitableEvent*)> | |
46 NativeWindowCallback; | |
47 void RegisterNativeWindowCallback(base::MessageLoopProxy* loop, | |
48 NativeWindowCallback& callback); | |
49 | |
50 typedef base::Callback<void(int, int, jobject surface)> VideoSurfaceCallback; | |
51 void RegisterVideoSurfaceCallback(base::MessageLoopProxy* loop, | |
52 VideoSurfaceCallback& callback); | |
53 | |
54 bool RegisterSurfaceCallback(JNIEnv* env); | |
55 | |
56 } // namespace content | |
57 | |
58 #endif // CONTENT_COMMON_ANDROID_SURFACE_CALLBACK_H_ | |
OLD | NEW |