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

Unified Diff: mojo/application/app_lifetime_helper.cc

Issue 1142323003: Remove duplicate application cpp files in mojo/application. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « mojo/application/app_lifetime_helper.h ('k') | mojo/application/application_runner_chromium.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/application/app_lifetime_helper.cc
diff --git a/mojo/application/app_lifetime_helper.cc b/mojo/application/app_lifetime_helper.cc
deleted file mode 100644
index 7859454a18d47306ded26538a8205ea9e6b4ee9c..0000000000000000000000000000000000000000
--- a/mojo/application/app_lifetime_helper.cc
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2015 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/application/app_lifetime_helper.h"
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "mojo/application/public/cpp/application_impl.h"
-
-namespace mojo {
-
-AppRefCount::AppRefCount(
- AppLifetimeHelper* app_lifetime_helper,
- scoped_refptr<base::SingleThreadTaskRunner> app_task_runner)
- : app_lifetime_helper_(app_lifetime_helper),
- app_task_runner_(app_task_runner) {
-}
-
-AppRefCount::~AppRefCount() {
-#ifndef NDEBUG
- // Ensure that this object is used on only one thread at a time, or else there
- // could be races where the object is being reset on one thread and cloned on
- // another.
- if (clone_task_runner_) {
- DCHECK(clone_task_runner_->BelongsToCurrentThread());
- }
-#endif
-
- if (app_task_runner_->BelongsToCurrentThread()) {
- app_lifetime_helper_->Release();
- return;
- }
-
- app_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AppLifetimeHelper::Release,
- base::Unretained(app_lifetime_helper_)));
-}
-
-scoped_ptr<AppRefCount> AppRefCount::Clone() {
- if (app_task_runner_->BelongsToCurrentThread()) {
- app_lifetime_helper_->AddRef();
- } else {
- app_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&AppLifetimeHelper::AddRef,
- base::Unretained(app_lifetime_helper_)));
- }
-
-#ifndef NDEBUG
- // Ensure that this object is used on only one thread at a time, or else there
- // could be races where the object is being reset on one thread and cloned on
- // another.
- if (clone_task_runner_) {
- DCHECK(clone_task_runner_->BelongsToCurrentThread());
- } else {
- clone_task_runner_ = base::MessageLoop::current()->task_runner();
- }
-#endif
-
- return make_scoped_ptr(new AppRefCount(
- app_lifetime_helper_, app_task_runner_));
-}
-
-AppLifetimeHelper::AppLifetimeHelper()
- : ref_count_(0) {
-}
-
-AppLifetimeHelper::~AppLifetimeHelper() {
-}
-
-scoped_ptr<AppRefCount> AppLifetimeHelper::CreateAppRefCount() {
- AddRef();
- return make_scoped_ptr(new AppRefCount(
- this, base::MessageLoop::current()->task_runner()));
-}
-
-void AppLifetimeHelper::AddRef() {
- ref_count_++;
-}
-
-void AppLifetimeHelper::Release() {
- if (!--ref_count_) {
- // Disabled until network_service tests pass again http://crbug.com/484234
- //ApplicationImpl::Terminate();
- }
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/application/app_lifetime_helper.h ('k') | mojo/application/application_runner_chromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698