Chromium Code Reviews| 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 "shell/android/main.h" | 5 #include "shell/android/main.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/android/fifo_utils.h" | 9 #include "base/android/fifo_utils.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 new JavaApplicationLoader(java_application_registry, url)), | 135 new JavaApplicationLoader(java_application_registry, url)), |
| 136 GURL(url)); | 136 GURL(url)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 // By default, the authenticated_network_service is handled by the | 139 // By default, the authenticated_network_service is handled by the |
| 140 // authentication service. | 140 // authentication service. |
| 141 context->url_resolver()->AddURLMapping( | 141 context->url_resolver()->AddURLMapping( |
| 142 GURL("mojo:authenticated_network_service"), GURL("mojo:authentication")); | 142 GURL("mojo:authenticated_network_service"), GURL("mojo:authentication")); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void QuitShellMessageLoopCallback() { | |
| 146 base::MessageLoop::current()->QuitWhenIdle(); | |
| 147 } | |
| 148 | |
| 145 void QuitShellThread() { | 149 void QuitShellThread() { |
| 146 g_internal_data.Get().shell_thread->Join(); | 150 g_internal_data.Get().shell_thread->Join(); |
| 147 g_internal_data.Get().shell_thread.reset(); | 151 g_internal_data.Get().shell_thread.reset(); |
| 148 Java_ShellService_finishActivities(base::android::AttachCurrentThread()); | 152 Java_ShellService_finishActivities(base::android::AttachCurrentThread()); |
| 149 exit(0); | 153 exit(0); |
| 150 } | 154 } |
| 151 | 155 |
| 152 void MojoShellRunner::Run() { | 156 void MojoShellRunner::Run() { |
| 153 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); | 157 base::MessageLoop loop(mojo::common::MessagePumpMojo::Create()); |
| 154 g_internal_data.Get().shell_task_runner = loop.task_runner(); | 158 g_internal_data.Get().shell_task_runner = loop.task_runner(); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 FROM_HERE, base::Bind(&StartApplicationByURL, url)); | 338 FROM_HERE, base::Bind(&StartApplicationByURL, url)); |
| 335 } | 339 } |
| 336 | 340 |
| 337 static void BindShell(JNIEnv* env, jclass clazz, jint shell_handle) { | 341 static void BindShell(JNIEnv* env, jclass clazz, jint shell_handle) { |
| 338 g_internal_data.Get().shell_task_runner->PostTask( | 342 g_internal_data.Get().shell_task_runner->PostTask( |
| 339 FROM_HERE, | 343 FROM_HERE, |
| 340 base::Bind(&BindShellImpl, base::Passed(mojo::ScopedMessagePipeHandle( | 344 base::Bind(&BindShellImpl, base::Passed(mojo::ScopedMessagePipeHandle( |
| 341 mojo::MessagePipeHandle(shell_handle))))); | 345 mojo::MessagePipeHandle(shell_handle))))); |
| 342 } | 346 } |
| 343 | 347 |
| 348 static void QuitShell(JNIEnv* env, jclass jcaller) { | |
| 349 g_internal_data.Get().shell_task_runner->PostTask( | |
| 350 FROM_HERE, base::Bind(&QuitShellMessageLoopCallback)); | |
|
qsr
2015/12/09 12:00:01
Why not use MessageLoop::QuitClosure() instead?
etiennej
2015/12/09 12:09:26
Done.
| |
| 351 } | |
| 352 | |
| 344 bool RegisterShellService(JNIEnv* env) { | 353 bool RegisterShellService(JNIEnv* env) { |
| 345 return RegisterNativesImpl(env); | 354 return RegisterNativesImpl(env); |
| 346 } | 355 } |
| 347 | 356 |
| 348 } // namespace shell | 357 } // namespace shell |
| OLD | NEW |