| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 jstring data) { | 169 jstring data) { |
| 170 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( | 170 remoting::ChromotingJniRuntime::GetInstance()->session()->SendClientMessage( |
| 171 ConvertJavaStringToUTF8(env, type), | 171 ConvertJavaStringToUTF8(env, type), |
| 172 ConvertJavaStringToUTF8(env, data)); | 172 ConvertJavaStringToUTF8(env, data)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // ChromotingJniRuntime implementation. | 175 // ChromotingJniRuntime implementation. |
| 176 | 176 |
| 177 // static | 177 // static |
| 178 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { | 178 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { |
| 179 return Singleton<ChromotingJniRuntime>::get(); | 179 return base::Singleton<ChromotingJniRuntime>::get(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 ChromotingJniRuntime::ChromotingJniRuntime() { | 182 ChromotingJniRuntime::ChromotingJniRuntime() { |
| 183 // On Android, the UI thread is managed by Java, so we need to attach and | 183 // On Android, the UI thread is managed by Java, so we need to attach and |
| 184 // start a special type of message loop to allow Chromium code to run tasks. | 184 // start a special type of message loop to allow Chromium code to run tasks. |
| 185 ui_loop_.reset(new base::MessageLoopForUI()); | 185 ui_loop_.reset(new base::MessageLoopForUI()); |
| 186 ui_loop_->Start(); | 186 ui_loop_->Start(); |
| 187 | 187 |
| 188 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. | 188 // TODO(solb) Stop pretending to control the managed UI thread's lifetime. |
| 189 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), | 189 ui_task_runner_ = new AutoThreadTaskRunner(ui_loop_->task_runner(), |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 358 |
| 359 JNIEnv* env = base::android::AttachCurrentThread(); | 359 JNIEnv* env = base::android::AttachCurrentThread(); |
| 360 Java_JniInterface_redrawGraphicsInternal(env); | 360 Java_JniInterface_redrawGraphicsInternal(env); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { | 363 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { |
| 364 base::android::DetachFromVM(); | 364 base::android::DetachFromVM(); |
| 365 waiter->Signal(); | 365 waiter->Signal(); |
| 366 } | 366 } |
| 367 } // namespace remoting | 367 } // namespace remoting |
| OLD | NEW |