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 "mojo/runner/context.h" | 5 #include "mojo/runner/context.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 void Context::Shutdown() { | 281 void Context::Shutdown() { |
282 // Actions triggered by ApplicationManager's destructor may require a current | 282 // Actions triggered by ApplicationManager's destructor may require a current |
283 // message loop, so we should destruct it explicitly now as ~Context() occurs | 283 // message loop, so we should destruct it explicitly now as ~Context() occurs |
284 // post message loop shutdown. | 284 // post message loop shutdown. |
285 application_manager_.reset(); | 285 application_manager_.reset(); |
286 | 286 |
287 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); | 287 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); |
288 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 288 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
289 task_runners_->shell_runner()); | 289 task_runners_->shell_runner()); |
290 embedder::ShutdownIPCSupport(); | 290 // Post a task in case OnShutdownComplete is called synchronously. |
| 291 base::MessageLoop::current()->PostTask( |
| 292 FROM_HERE, base::Bind(embedder::ShutdownIPCSupport)); |
291 // We'll quit when we get OnShutdownComplete(). | 293 // We'll quit when we get OnShutdownComplete(). |
292 base::MessageLoop::current()->Run(); | 294 base::MessageLoop::current()->Run(); |
293 } | 295 } |
294 | 296 |
295 void Context::OnShutdownComplete() { | 297 void Context::OnShutdownComplete() { |
296 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 298 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
297 task_runners_->shell_runner()); | 299 task_runners_->shell_runner()); |
298 base::MessageLoop::current()->QuitWhenIdle(); | 300 base::MessageLoop::current()->QuitWhenIdle(); |
299 } | 301 } |
300 | 302 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 base::MessageLoop::current()->QuitWhenIdle(); | 343 base::MessageLoop::current()->QuitWhenIdle(); |
342 } else { | 344 } else { |
343 app_complete_callback_.Run(); | 345 app_complete_callback_.Run(); |
344 } | 346 } |
345 } | 347 } |
346 } | 348 } |
347 } | 349 } |
348 | 350 |
349 } // namespace runner | 351 } // namespace runner |
350 } // namespace mojo | 352 } // namespace mojo |
OLD | NEW |