Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: base/android/jni_onload_delegate.h

Issue 864563002: Separate JNI registration with initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: put delegate implementation into .cc Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698