OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remoting/client/jni/chromoting_jni_runtime.h" | 5 #include "remoting/client/jni/chromoting_jni_runtime.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/library_loader/library_loader_hooks.h" | 10 #include "base/android/library_loader/library_loader_hooks.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 jstring data) { | 171 jstring data) { |
172 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( | 172 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( |
173 ConvertJavaStringToUTF8(env, type), | 173 ConvertJavaStringToUTF8(env, type), |
174 ConvertJavaStringToUTF8(env, data)); | 174 ConvertJavaStringToUTF8(env, data)); |
175 } | 175 } |
176 | 176 |
177 // ChromotingJniRuntime implementation. | 177 // ChromotingJniRuntime implementation. |
178 | 178 |
179 // static | 179 // static |
180 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { | 180 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { |
181 return Singleton<ChromotingJniRuntime>::get(); | 181 return base::Singleton<ChromotingJniRuntime>::get(); |
182 } | 182 } |
183 | 183 |
184 ChromotingJniRuntime::ChromotingJniRuntime() { | 184 ChromotingJniRuntime::ChromotingJniRuntime() { |
185 // On Android, the UI thread is managed by Java, so we need to attach and | 185 // On Android, the UI thread is managed by Java, so we need to attach and |
186 // start a special type of message loop to allow Chromium code to run tasks. | 186 // start a special type of message loop to allow Chromium code to run tasks. |
187 ui_loop_.reset(new base::MessageLoopForUI()); | 187 ui_loop_.reset(new base::MessageLoopForUI()); |
188 ui_loop_->Start(); | 188 ui_loop_->Start(); |
189 | 189 |
190 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. | 190 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. |
191 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), | 191 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 JNIEnv* env = base::android::AttachCurrentThread(); | 364 JNIEnv* env = base::android::AttachCurrentThread(); |
365 Java_JniInterface_redrawGraphicsInternal(env); | 365 Java_JniInterface_redrawGraphicsInternal(env); |
366 } | 366 } |
367 | 367 |
368 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { | 368 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { |
369 base::android::DetachFromVM(); | 369 base::android::DetachFromVM(); |
370 waiter->Signal(); | 370 waiter->Signal(); |
371 } | 371 } |
372 } // namespace remoting | 372 } // namespace remoting |
OLD | NEW |