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

Side by Side Diff: mojo/shell/public/cpp/lib/app_lifetime_helper.cc

Issue 1691493002: Revise comments on various Shell interfaces. Make some methods private on ShellConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 10 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
« no previous file with comments | « mojo/shell/public/cpp/connection.h ('k') | mojo/shell/public/cpp/shell.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 2015 The Chromium Authors. All rights reserved. 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 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/public/cpp/app_lifetime_helper.h" 5 #include "mojo/shell/public/cpp/app_lifetime_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "mojo/shell/public/cpp/shell_connection.h" 9 #include "mojo/shell/public/cpp/shell_connection.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 DCHECK(clone_task_runner_->BelongsToCurrentThread()); 56 DCHECK(clone_task_runner_->BelongsToCurrentThread());
57 } else { 57 } else {
58 clone_task_runner_ = base::MessageLoop::current()->task_runner(); 58 clone_task_runner_ = base::MessageLoop::current()->task_runner();
59 } 59 }
60 #endif 60 #endif
61 61
62 return make_scoped_ptr(new AppRefCount( 62 return make_scoped_ptr(new AppRefCount(
63 app_lifetime_helper_, app_task_runner_)); 63 app_lifetime_helper_, app_task_runner_));
64 } 64 }
65 65
66 AppLifetimeHelper::AppLifetimeHelper(ShellConnection* app) 66 AppLifetimeHelper::AppLifetimeHelper(Shell* shell)
67 : app_(app), ref_count_(0) { 67 : shell_(shell), ref_count_(0) {
68 } 68 }
69 69
70 AppLifetimeHelper::~AppLifetimeHelper() { 70 AppLifetimeHelper::~AppLifetimeHelper() {
71 } 71 }
72 72
73 scoped_ptr<AppRefCount> AppLifetimeHelper::CreateAppRefCount() { 73 scoped_ptr<AppRefCount> AppLifetimeHelper::CreateAppRefCount() {
74 AddRef(); 74 AddRef();
75 return make_scoped_ptr(new AppRefCount( 75 return make_scoped_ptr(new AppRefCount(
76 this, base::MessageLoop::current()->task_runner())); 76 this, base::MessageLoop::current()->task_runner()));
77 } 77 }
78 78
79 void AppLifetimeHelper::AddRef() { 79 void AppLifetimeHelper::AddRef() {
80 ref_count_++; 80 ref_count_++;
81 } 81 }
82 82
83 void AppLifetimeHelper::Release() { 83 void AppLifetimeHelper::Release() {
84 if (!--ref_count_) { 84 if (!--ref_count_) {
85 if (app_) 85 if (shell_)
86 app_->Quit(); 86 shell_->Quit();
87 } 87 }
88 } 88 }
89 89
90 void AppLifetimeHelper::OnQuit() { 90 void AppLifetimeHelper::OnQuit() {
91 app_ = nullptr; 91 shell_ = nullptr;
92 } 92 }
93 93
94 } // namespace mojo 94 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/connection.h ('k') | mojo/shell/public/cpp/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698