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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 return base::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( |
199 base::MessageLoop::QuitClosure()); | 199 ui_loop_->task_runner(), base::MessageLoop::QuitWhenIdleClosure()); |
200 network_task_runner_ = AutoThread::CreateWithType("native_net", | 200 network_task_runner_ = AutoThread::CreateWithType("native_net", |
201 ui_task_runner_, | 201 ui_task_runner_, |
202 base::MessageLoop::TYPE_IO); | 202 base::MessageLoop::TYPE_IO); |
203 display_task_runner_ = AutoThread::Create("native_disp", | 203 display_task_runner_ = AutoThread::Create("native_disp", |
204 ui_task_runner_); | 204 ui_task_runner_); |
205 | 205 |
206 url_requester_ = | 206 url_requester_ = |
207 new URLRequestContextGetter(network_task_runner_, network_task_runner_); | 207 new URLRequestContextGetter(network_task_runner_, network_task_runner_); |
208 } | 208 } |
209 | 209 |
(...skipping 157 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 |