Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: mojo/shell/keep_alive.cc

Issue 323593002: Mojo: Use network service to load non-local Mojo Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/shell/in_process_dynamic_service_runner.cc ('k') | mojo/shell/loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shell/keep_alive.h" 5 #include "mojo/shell/keep_alive.h"
6 6
7 #include "base/bind.h"
7 #include "mojo/shell/context.h" 8 #include "mojo/shell/context.h"
8 9
9 namespace mojo { 10 namespace mojo {
10 namespace shell { 11 namespace shell {
11 12
12 KeepAlive::KeepAlive(Context* context) : context_(context) { 13 KeepAlive::KeepAlive(Context* context) : context_(context) {
13 DCHECK(context_->task_runners()->ui_runner()->RunsTasksOnCurrentThread()); 14 DCHECK(context_->task_runners()->ui_runner()->RunsTasksOnCurrentThread());
14 ++context_->keep_alive_counter()->count_; 15 ++context_->keep_alive_counter()->count_;
15 } 16 }
16 17
17 KeepAlive::~KeepAlive() { 18 KeepAlive::~KeepAlive() {
18 DCHECK(context_->task_runners()->ui_runner()->RunsTasksOnCurrentThread()); 19 DCHECK(context_->task_runners()->ui_runner()->RunsTasksOnCurrentThread());
19 if (--context_->keep_alive_counter()->count_ == 0) { 20 if (--context_->keep_alive_counter()->count_ == 0) {
20 base::MessageLoop::current()->PostTask( 21 base::MessageLoop::current()->PostTask(
21 FROM_HERE, 22 FROM_HERE,
22 base::Bind(&KeepAlive::MaybeQuit, context_)); 23 base::Bind(&KeepAlive::MaybeQuit, context_));
23 } 24 }
24 } 25 }
25 26
26 // static 27 // static
27 void KeepAlive::MaybeQuit(Context* context) { 28 void KeepAlive::MaybeQuit(Context* context) {
28 if (context->keep_alive_counter()->count_ == 0) 29 if (context->keep_alive_counter()->count_ == 0)
29 base::MessageLoop::current()->Quit(); 30 base::MessageLoop::current()->Quit();
30 } 31 }
31 32
32 } // namespace shell 33 } // namespace shell
33 } // namespace mojo 34 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/in_process_dynamic_service_runner.cc ('k') | mojo/shell/loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698