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

Side by Side Diff: mojo/application/app_lifetime_helper.cc

Issue 1139673003: Make Mandoline shut down cleanly. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix crash in surfaces if surfaceimpl outlives the app, and a double delete in browser 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/application/app_lifetime_helper.h"
6
7 #include "base/time/tick_clock.h"
8 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h"
9
10 namespace mojo {
11
12 ServiceRefcount::ServiceRefcount(AppLifetimeHelper* app_lifetime_helper)
13 : app_lifetime_helper_(app_lifetime_helper) {
14 }
15
16 ServiceRefcount::~ServiceRefcount() {
17 app_lifetime_helper_->Release();
18 }
19
20 AppLifetimeHelper::AppLifetimeHelper() : ref_count_(0) {
21 }
22
23 AppLifetimeHelper::~AppLifetimeHelper() {
24 }
25
26 scoped_ptr<ServiceRefcount> AppLifetimeHelper::CreateServiceRefCount() {
27 ref_count_++;
28 return make_scoped_ptr(new ServiceRefcount(this));
29 }
30
31 void AppLifetimeHelper::Release() {
32 if (!--ref_count_)
33 ApplicationImpl::Terminate();
34 }
35
36 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698