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

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

Issue 1249643004: media: Quit MojoMediaApplication when no ServiceFactory service is bound. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 ApplicationImpl::~ApplicationImpl() { 60 ApplicationImpl::~ApplicationImpl() {
61 DCHECK(!in_destructor_); 61 DCHECK(!in_destructor_);
62 in_destructor_ = true; 62 in_destructor_ = true;
63 ClearConnections(); 63 ClearConnections();
64 app_lifetime_helper_.ApplicationTerminated(); 64 app_lifetime_helper_.ApplicationTerminated();
65 } 65 }
66 66
67 ApplicationConnection* ApplicationImpl::ConnectToApplication( 67 ApplicationConnection* ApplicationImpl::ConnectToApplication(
68 mojo::URLRequestPtr request) { 68 mojo::URLRequestPtr request) {
69 return ConnectToApplication(request.Pass(), base::Bind(&base::DoNothing));
70 }
71
72 ApplicationConnection* ApplicationImpl::ConnectToApplication(
73 mojo::URLRequestPtr request,
74 const base::Closure& terminate_cb) {
69 if (!shell_) 75 if (!shell_)
70 return nullptr; 76 return nullptr;
71 ServiceProviderPtr local_services; 77 ServiceProviderPtr local_services;
72 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services); 78 InterfaceRequest<ServiceProvider> local_request = GetProxy(&local_services);
73 ServiceProviderPtr remote_services; 79 ServiceProviderPtr remote_services;
74 std::string application_url = request->url.To<std::string>(); 80 std::string application_url = request->url.To<std::string>();
75 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services), 81 shell_->ConnectToApplication(request.Pass(), GetProxy(&remote_services),
76 local_services.Pass()); 82 local_services.Pass());
83 remote_services.set_connection_error_handler(terminate_cb);
77 internal::ServiceRegistry* registry = new internal::ServiceRegistry( 84 internal::ServiceRegistry* registry = new internal::ServiceRegistry(
78 this, application_url, application_url, remote_services.Pass(), 85 this, application_url, application_url, remote_services.Pass(),
79 local_request.Pass()); 86 local_request.Pass());
80 if (!delegate_->ConfigureOutgoingConnection(registry)) { 87 if (!delegate_->ConfigureOutgoingConnection(registry)) {
81 registry->CloseConnection(); 88 registry->CloseConnection();
82 return nullptr; 89 return nullptr;
83 } 90 }
84 outgoing_service_registries_.push_back(registry); 91 outgoing_service_registries_.push_back(registry);
85 return registry; 92 return registry;
86 } 93 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // than the one to the shell. 181 // than the one to the shell.
175 bool quit_now = delegate_->OnShellConnectionError(); 182 bool quit_now = delegate_->OnShellConnectionError();
176 if (quit_now) 183 if (quit_now)
177 QuitNow(); 184 QuitNow();
178 if (!ptr) 185 if (!ptr)
179 return; 186 return;
180 shell_ = nullptr; 187 shell_ = nullptr;
181 } 188 }
182 189
183 } // namespace mojo 190 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698