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

Unified Diff: mojo/shell/keep_alive.cc

Issue 491443005: Get rid of KeepAlive. Quit shell when all urls run directly by Context are closed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring back ConnectToServiceViaNetwork Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/shell/keep_alive.cc
diff --git a/mojo/shell/keep_alive.cc b/mojo/shell/keep_alive.cc
deleted file mode 100644
index 5e1bb62a178db488017b5f53a876177d97876ae2..0000000000000000000000000000000000000000
--- a/mojo/shell/keep_alive.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/shell/keep_alive.h"
-
-#include "base/bind.h"
-#include "mojo/shell/context.h"
-
-namespace mojo {
-namespace shell {
-
-KeepAlive::KeepAlive(Context* context) : context_(context) {
- DCHECK(context_->task_runners()->shell_runner()->RunsTasksOnCurrentThread());
- ++context_->keep_alive_counter()->count_;
-}
-
-KeepAlive::~KeepAlive() {
- DCHECK(context_->task_runners()->shell_runner()->RunsTasksOnCurrentThread());
- if (--context_->keep_alive_counter()->count_ == 0) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&KeepAlive::MaybeQuit, context_));
- }
-}
-
-// static
-void KeepAlive::MaybeQuit(Context* context) {
- if (context->keep_alive_counter()->count_ == 0)
- base::MessageLoop::current()->Quit();
-}
-
-} // namespace shell
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698