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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 252 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
253 task_runners_->shell_runner()); | 253 task_runners_->shell_runner()); |
254 embedder::ShutdownIPCSupport(); | 254 embedder::ShutdownIPCSupport(); |
255 // We'll quit when we get OnShutdownComplete(). | 255 // We'll quit when we get OnShutdownComplete(). |
256 base::MessageLoop::current()->Run(); | 256 base::MessageLoop::current()->Run(); |
257 } | 257 } |
258 | 258 |
259 void Context::OnShutdownComplete() { | 259 void Context::OnShutdownComplete() { |
260 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 260 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
261 task_runners_->shell_runner()); | 261 task_runners_->shell_runner()); |
262 base::MessageLoop::current()->Quit(); | 262 base::MessageLoop::current()->QuitWhenIdle(); |
263 } | 263 } |
264 | 264 |
265 void Context::Run(const GURL& url) { | 265 void Context::Run(const GURL& url) { |
266 DCHECK(app_complete_callback_.is_null()); | 266 DCHECK(app_complete_callback_.is_null()); |
267 ServiceProviderPtr services; | 267 ServiceProviderPtr services; |
268 ServiceProviderPtr exposed_services; | 268 ServiceProviderPtr exposed_services; |
269 | 269 |
270 app_urls_.insert(url); | 270 app_urls_.insert(url); |
271 | 271 |
272 scoped_ptr<shell::ConnectToApplicationParams> params( | 272 scoped_ptr<shell::ConnectToApplicationParams> params( |
(...skipping 22 matching lines...) Expand all Loading... |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 void Context::OnApplicationEnd(const GURL& url) { | 298 void Context::OnApplicationEnd(const GURL& url) { |
299 if (app_urls_.find(url) != app_urls_.end()) { | 299 if (app_urls_.find(url) != app_urls_.end()) { |
300 app_urls_.erase(url); | 300 app_urls_.erase(url); |
301 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 301 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
302 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 302 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
303 task_runners_->shell_runner()); | 303 task_runners_->shell_runner()); |
304 if (app_complete_callback_.is_null()) { | 304 if (app_complete_callback_.is_null()) { |
305 base::MessageLoop::current()->Quit(); | 305 base::MessageLoop::current()->QuitWhenIdle(); |
306 } else { | 306 } else { |
307 app_complete_callback_.Run(); | 307 app_complete_callback_.Run(); |
308 } | 308 } |
309 } | 309 } |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 } // namespace runner | 313 } // namespace runner |
314 } // namespace mojo | 314 } // namespace mojo |
OLD | NEW |