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

Side by Side Diff: mojo/application/public/cpp/lib/application_impl.cc

Issue 1288743002: A few more spurious cleanups on ApplicationImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
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/application/public/cpp/application_impl.h" 5 #include "mojo/application/public/cpp/application_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return registry.Pass(); 83 return registry.Pass();
84 } 84 }
85 85
86 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) { 86 void ApplicationImpl::Initialize(ShellPtr shell, const mojo::String& url) {
87 shell_ = shell.Pass(); 87 shell_ = shell.Pass();
88 shell_.set_connection_error_handler([this]() { OnConnectionError(); }); 88 shell_.set_connection_error_handler([this]() { OnConnectionError(); });
89 url_ = url; 89 url_ = url;
90 delegate_->Initialize(this); 90 delegate_->Initialize(this);
91 } 91 }
92 92
93 void ApplicationImpl::WaitForInitialize() {
94 if (!shell_)
95 binding_.WaitForIncomingMethodCall();
96 }
97
98 void ApplicationImpl::UnbindConnections(
99 InterfaceRequest<Application>* application_request,
100 ShellPtr* shell) {
101 *application_request = binding_.Unbind();
102 shell->Bind(shell_.PassInterface());
103 }
104
105 void ApplicationImpl::Quit() { 93 void ApplicationImpl::Quit() {
106 // We can't quit immediately, since there could be in-flight requests from the 94 // We can't quit immediately, since there could be in-flight requests from the
107 // shell. So check with it first. 95 // shell. So check with it first.
108 if (shell_) { 96 if (shell_) {
109 quit_requested_ = true; 97 quit_requested_ = true;
110 shell_->QuitApplication(); 98 shell_->QuitApplication();
111 } else { 99 } else {
112 QuitNow(); 100 QuitNow();
113 } 101 }
114 } 102 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (!ptr) 143 if (!ptr)
156 return; 144 return;
157 shell_ = nullptr; 145 shell_ = nullptr;
158 } 146 }
159 147
160 void ApplicationImpl::QuitNow() { 148 void ApplicationImpl::QuitNow() {
161 delegate_->Quit(); 149 delegate_->Quit();
162 termination_closure_.Run(); 150 termination_closure_.Run();
163 } 151 }
164 152
153 void ApplicationImpl::UnbindConnections(
154 InterfaceRequest<Application>* application_request,
155 ShellPtr* shell) {
156 *application_request = binding_.Unbind();
157 shell->Bind(shell_.PassInterface());
158 }
159
165 } // namespace mojo 160 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/application/public/cpp/application_impl.h ('k') | mojo/application/public/cpp/lib/application_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698