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

Side by Side Diff: content/app/android/content_jni_onload.cc

Issue 864563002: Separate JNI registration with initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and sync Created 5 years, 10 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
« no previous file with comments | « content/app/BUILD.gn ('k') | content/content_app.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/public/app/content_jni_onload.h"
6
7 #include <vector>
8
9 #include "base/android/base_jni_onload.h"
10 #include "base/android/jni_onload_delegate.h"
11 #include "base/android/library_loader/library_loader_hooks.h"
12 #include "content/public/app/android_library_loader_hooks.h"
13 #include "content/public/app/content_main.h"
14
15 namespace content {
16 namespace android {
17
18 namespace {
19
20 class ContentJNIOnLoadDelegate
21 : public base::android::JNIOnLoadDelegate {
22 public:
23 bool RegisterJNI(JNIEnv* env) override;
24 bool Init() override;
25 };
26
27 bool ContentJNIOnLoadDelegate::RegisterJNI(JNIEnv* env) {
28 // TODO(michaelbai): Remove the EnsureJniRegistered from
29 // content::LibraryLoaded and move android_library_loader_hooks.h to
30 // content/app/android/.
31 return content::EnsureJniRegistered(env);
32 }
33
34 bool ContentJNIOnLoadDelegate::Init() {
35 base::android::SetLibraryLoadedHook(&content::LibraryLoaded);
36 return true;
37 }
38
39 } // namespace
40
41
42 bool OnJNIOnLoad(JavaVM* vm,
43 base::android::JNIOnLoadDelegate* delegate) {
44 std::vector<base::android::JNIOnLoadDelegate*> delegates;
45 ContentJNIOnLoadDelegate content_delegate;
46 delegates.push_back(delegate);
47 delegates.push_back(&content_delegate);
48 return base::android::OnJNIOnLoad(vm, &delegates);
49 }
50
51 } // namespace android
52 } // namespace content
OLDNEW
« no previous file with comments | « content/app/BUILD.gn ('k') | content/content_app.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698