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

Side by Side Diff: services/device/android/register_jni.cc

Issue 2774783003: [DeviceService] Add service tests for VibrationManager. (Closed)
Patch Set: Created 3 years, 8 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
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/device/android/register_jni.h" 5 #include "services/device/android/register_jni.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_registrar.h"
9 #include "mojo/android/system/core_impl.h"
10 #include "mojo/android/system/watcher_impl.h"
8 #include "services/device/time_zone_monitor/android/time_zone_monitor_jni_regist rar.h" 11 #include "services/device/time_zone_monitor/android/time_zone_monitor_jni_regist rar.h"
9 12
10 namespace device { 13 namespace device {
11 14
15 namespace {
16
17 const base::android::RegistrationMethod kRegisteredMethods[] = {
leonhsl(Using Gerrit) 2017/03/28 07:27:52 We must register these JNIs to enable InterfaceReg
blundell 2017/03/28 12:40:47 It seems like we should put this somewhere inside
leonhsl(Using Gerrit) 2017/03/29 07:37:16 To make sure I understand the suggestion clearly:
18 {"CoreImpl", mojo::android::RegisterCoreImpl},
19 {"WatcherImpl", mojo::android::RegisterWatcherImpl},
20 };
21
22 } // namespace
23
12 bool EnsureJniRegistered() { 24 bool EnsureJniRegistered() {
13 static bool g_jni_init_done = false; 25 static bool g_jni_init_done = false;
14 26
15 if (!g_jni_init_done) { 27 if (!g_jni_init_done) {
16 JNIEnv* env = base::android::AttachCurrentThread(); 28 JNIEnv* env = base::android::AttachCurrentThread();
17 29
30 if (!RegisterNativeMethods(env, kRegisteredMethods,
31 arraysize(kRegisteredMethods))) {
32 return false;
33 }
34
18 if (!android::RegisterTimeZoneMonitorJni(env)) 35 if (!android::RegisterTimeZoneMonitorJni(env))
19 return false; 36 return false;
20 37
21 g_jni_init_done = true; 38 g_jni_init_done = true;
22 } 39 }
23 40
24 return true; 41 return true;
25 } 42 }
26 43
27 } // namespace device 44 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698