| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 // ChromotingJniRuntime implementation. | 63 // ChromotingJniRuntime implementation. |
| 64 | 64 |
| 65 // static | 65 // static |
| 66 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { | 66 ChromotingJniRuntime* ChromotingJniRuntime::GetInstance() { |
| 67 return base::Singleton<ChromotingJniRuntime>::get(); | 67 return base::Singleton<ChromotingJniRuntime>::get(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 ChromotingJniRuntime::ChromotingJniRuntime() { | 70 ChromotingJniRuntime::ChromotingJniRuntime() { |
| 71 // Grab or create the threads. | 71 // Grab or create the threads. |
| 72 // TODO(nicholss) We could runtime this as a constructor argument when jni | 72 // TODO(nicholss): We could runtime this as a constructor argument when jni |
| 73 // runtime is not no longer a singleton. | 73 // runtime is not no longer a singleton. |
| 74 | 74 |
| 75 if (!base::MessageLoop::current()) { | 75 if (!base::MessageLoop::current()) { |
| 76 VLOG(1) << "Starting main message loop"; | 76 VLOG(1) << "Starting main message loop"; |
| 77 // On Android, the UI thread is managed by Java, so we need to attach and | 77 // On Android, the UI thread is managed by Java, so we need to attach and |
| 78 // start a special type of message loop to allow Chromium code to run tasks. | 78 // start a special type of message loop to allow Chromium code to run tasks. |
| 79 ui_loop_.reset(new base::MessageLoopForUI()); | 79 ui_loop_.reset(new base::MessageLoopForUI()); |
| 80 ui_loop_->Start(); | 80 ui_loop_->Start(); |
| 81 } else { | 81 } else { |
| 82 VLOG(1) << "Using existing main message loop"; | 82 VLOG(1) << "Using existing main message loop"; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 logger_->Start( | 132 logger_->Start( |
| 133 base::WrapUnique( | 133 base::WrapUnique( |
| 134 new ChromiumUrlRequestFactory(runtime_->url_requester())), | 134 new ChromiumUrlRequestFactory(runtime_->url_requester())), |
| 135 kTelemetryBaseUrl); | 135 kTelemetryBaseUrl); |
| 136 logger_->SetAuthClosure( | 136 logger_->SetAuthClosure( |
| 137 base::Bind(&ChromotingJniRuntime::FetchAuthToken, | 137 base::Bind(&ChromotingJniRuntime::FetchAuthToken, |
| 138 base::Unretained(this))); | 138 base::Unretained(this))); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace remoting | 141 } // namespace remoting |
| OLD | NEW |