OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/android/system/watcher_impl.h" | 5 #include "mojo/android/system/watcher_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/android/base_jni_registrar.h" | 10 #include "base/android/base_jni_registrar.h" |
11 #include "base/android/jni_android.h" | 11 #include "base/android/jni_android.h" |
12 #include "base/android/jni_registrar.h" | 12 #include "base/android/jni_registrar.h" |
13 #include "base/android/library_loader/library_loader_hooks.h" | 13 #include "base/android/library_loader/library_loader_hooks.h" |
14 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "jni/WatcherImpl_jni.h" | 16 #include "jni/WatcherImpl_jni.h" |
17 #include "mojo/public/cpp/system/handle.h" | 17 #include "mojo/public/cpp/system/handle.h" |
18 #include "mojo/public/cpp/system/watcher.h" | 18 #include "mojo/public/cpp/system/watcher.h" |
19 | 19 |
20 namespace mojo { | 20 namespace mojo { |
21 namespace android { | 21 namespace android { |
22 | 22 |
23 using base::android::JavaParamRef; | 23 using base::android::JavaParamRef; |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 class WatcherImpl { | 27 class WatcherImpl { |
28 public: | 28 public: |
29 WatcherImpl() : watcher_(FROM_HERE) {} | 29 WatcherImpl() : watcher_(FROM_HERE, Watcher::ArmingPolicy::AUTOMATIC) {} |
30 | 30 |
31 ~WatcherImpl() = default; | 31 ~WatcherImpl() = default; |
32 | 32 |
33 jint Start(JNIEnv* env, | 33 jint Start(JNIEnv* env, |
34 const JavaParamRef<jobject>& jcaller, | 34 const JavaParamRef<jobject>& jcaller, |
35 jint mojo_handle, | 35 jint mojo_handle, |
36 jint signals) { | 36 jint signals) { |
37 java_watcher_.Reset(env, jcaller); | 37 java_watcher_.Reset(env, jcaller); |
38 | 38 |
39 auto ready_callback = | 39 auto ready_callback = |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 jlong watcher_ptr) { | 100 jlong watcher_ptr) { |
101 delete reinterpret_cast<WatcherImpl*>(watcher_ptr); | 101 delete reinterpret_cast<WatcherImpl*>(watcher_ptr); |
102 } | 102 } |
103 | 103 |
104 bool RegisterWatcherImpl(JNIEnv* env) { | 104 bool RegisterWatcherImpl(JNIEnv* env) { |
105 return RegisterNativesImpl(env); | 105 return RegisterNativesImpl(env); |
106 } | 106 } |
107 | 107 |
108 } // namespace android | 108 } // namespace android |
109 } // namespace mojo | 109 } // namespace mojo |
OLD | NEW |