OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 BASE_ANDROID_JNI_ONLOAD_DELEGATE_H_ | |
6 #define BASE_ANDROID_JNI_ONLOAD_DELEGATE_H_ | |
7 | |
8 #include <jni.h> | |
9 | |
10 #include "base/base_export.h" | |
11 | |
12 namespace base { | |
13 namespace android { | |
14 | |
15 // This delegate class is used to implement component specific JNI registration | |
16 // and initialization. All methods are called in JNI_OnLoad(). | |
17 // | |
18 // Both RegisterJNI() and Init() methods are called if the shared library | |
19 // is loaded by crazy linker that can't find JNI methods without JNI | |
20 // registration, otherwise, only Init() is invoked where dynamic lookup is | |
21 // used to find the JNI methods. | |
22 // | |
23 // It is important to make sure the JNI registration code is only in | |
24 // RegisterJNI(), so it could be strip out when JNI registration isn't needed. | |
25 class BASE_EXPORT JNIOnLoadDelegate { | |
26 public: | |
27 virtual ~JNIOnLoadDelegate() {}; | |
jam
2015/01/27 16:10:33
nit: semicolon not needed
michaelbai
2015/01/27 20:13:50
Done.
| |
28 | |
29 // Returns true if the JNI registration succeeded. | |
30 virtual bool RegisterJNI(JNIEnv* env) = 0; | |
31 | |
32 // Returns true if the initialization succeeded. This method is called after | |
33 // RegisterJNI(), all JNI methods shall ready to be used. | |
34 virtual bool Init() = 0; | |
35 }; | |
36 | |
37 } // namespace android | |
38 } // namespace base | |
39 | |
40 #endif // BASE_ANDROID_JNI_ONLOAD_DELEGATE_H_ | |
OLD | NEW |