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

Side by Side Diff: blimp/client/android/blimp_library_loader.cc

Issue 1636163002: Restructure contents of blimp/client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « blimp/client/android/blimp_library_loader.h ('k') | blimp/client/android/blimp_view.h » ('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 "blimp/client/android/blimp_library_loader.h"
6
7 #include <vector>
8
9 #include "base/android/base_jni_onload.h"
10 #include "base/android/base_jni_registrar.h"
11 #include "base/android/jni_android.h"
12 #include "base/android/library_loader/library_loader_hooks.h"
13 #include "base/bind.h"
14 #include "base/message_loop/message_loop.h"
15 #include "blimp/client/android/blimp_jni_registrar.h"
16 #include "blimp/client/blimp_startup.h"
17 #include "jni/BlimpLibraryLoader_jni.h"
18 #include "ui/gl/gl_surface.h"
19
20 namespace {
21
22 bool OnLibrariesLoaded(JNIEnv* env, jclass clazz) {
23 blimp::client::InitializeLogging();
24 return true;
25 }
26
27 bool OnJniInitializationComplete() {
28 base::android::SetLibraryLoadedHook(&OnLibrariesLoaded);
29 return true;
30 }
31
32 bool RegisterJni(JNIEnv* env) {
33 if (!base::android::RegisterJni(env))
34 return false;
35
36 if (!blimp::client::RegisterBlimpJni(env))
37 return false;
38
39 return true;
40 }
41
42 } // namespace
43
44 namespace blimp {
45 namespace client {
46
47 static jboolean StartBlimp(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
48 if (!InitializeMainMessageLoop())
49 return false;
50
51 base::MessageLoopForUI::current()->Start();
52
53 return true;
54 }
55
56 bool RegisterBlimpLibraryLoaderJni(JNIEnv* env) {
57 return RegisterNativesImpl(env);
58 }
59
60 } // namespace client
61 } // namespace blimp
62
63 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
64 std::vector<base::android::RegisterCallback> register_callbacks;
65 register_callbacks.push_back(base::Bind(&RegisterJni));
66
67 std::vector<base::android::InitCallback> init_callbacks;
68 init_callbacks.push_back(base::Bind(&OnJniInitializationComplete));
69
70 // Although we only need to register JNI for base/ and blimp/, this follows
71 // the general Chrome for Android pattern, to be future-proof against future
72 // changes to JNI.
73 if (!base::android::OnJNIOnLoadRegisterJNI(vm, register_callbacks) ||
74 !base::android::OnJNIOnLoadInit(init_callbacks)) {
75 return -1;
76 }
77
78 return JNI_VERSION_1_4;
79 }
OLDNEW
« no previous file with comments | « blimp/client/android/blimp_library_loader.h ('k') | blimp/client/android/blimp_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698