| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 const JavaParamRef<jstring>& data) { | 178 const JavaParamRef<jstring>& data) { |
| 179 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( | 179 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( |
| 180 ConvertJavaStringToUTF8(env, type), | 180 ConvertJavaStringToUTF8(env, type), |
| 181 ConvertJavaStringToUTF8(env, data)); | 181 ConvertJavaStringToUTF8(env, data)); |
| 182 } | 182 } |
| 183 | 183 |
| 184 // ChromotingJniRuntime implementation. | 184 // ChromotingJniRuntime implementation. |
| 185 | 185 |
| 186 // static | 186 // static |
| 187 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { | 187 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { |
| 188 return Singleton<ChromotingJniRuntime>::get(); | 188 return base::Singleton<ChromotingJniRuntime>::get(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 ChromotingJniRuntime::ChromotingJniRuntime() { | 191 ChromotingJniRuntime::ChromotingJniRuntime() { |
| 192 // On Android, the UI thread is managed by Java, so we need to attach and | 192 // On Android, the UI thread is managed by Java, so we need to attach and |
| 193 // start a special type of message loop to allow Chromium code to run tasks. | 193 // start a special type of message loop to allow Chromium code to run tasks. |
| 194 ui_loop_.reset(new base::MessageLoopForUI()); | 194 ui_loop_.reset(new base::MessageLoopForUI()); |
| 195 ui_loop_->Start(); | 195 ui_loop_->Start(); |
| 196 | 196 |
| 197 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. | 197 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. |
| 198 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), | 198 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 JNIEnv* env = base::android::AttachCurrentThread(); | 368 JNIEnv* env = base::android::AttachCurrentThread(); |
| 369 Java_JniInterface_redrawGraphicsInternal(env); | 369 Java_JniInterface_redrawGraphicsInternal(env); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { | 372 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { |
| 373 base::android::DetachFromVM(); | 373 base::android::DetachFromVM(); |
| 374 waiter->Signal(); | 374 waiter->Signal(); |
| 375 } | 375 } |
| 376 } // namespace remoting | 376 } // namespace remoting |
| OLD | NEW |