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

Side by Side Diff: services/service_manager/public/cpp/lib/interface_registry.cc

Issue 2695803004: Make browser process a singleton service (Closed)
Patch Set: . Created 3 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 | « services/service_manager/public/cpp/interface_registry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/service_manager/public/cpp/interface_registry.h" 5 #include "services/service_manager/public/cpp/interface_registry.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 DCHECK(interface_names); 176 DCHECK(interface_names);
177 for (auto& entry : name_to_binder_) 177 for (auto& entry : name_to_binder_)
178 interface_names->insert(entry.first); 178 interface_names->insert(entry.first);
179 } 179 }
180 180
181 void InterfaceRegistry::AddConnectionLostClosure( 181 void InterfaceRegistry::AddConnectionLostClosure(
182 const base::Closure& connection_lost_closure) { 182 const base::Closure& connection_lost_closure) {
183 connection_lost_closures_.push_back(connection_lost_closure); 183 connection_lost_closures_.push_back(connection_lost_closure);
184 } 184 }
185 185
186 void InterfaceRegistry::BindInterface(const std::string& name,
187 mojo::ScopedMessagePipeHandle handle) {
188 // NOTE: We don't expose GetInterface() publicly so as to avoid confusion
189 // with local and remote binding requests.
190 GetInterface(name, std::move(handle));
191 }
192
186 // mojom::InterfaceProvider: 193 // mojom::InterfaceProvider:
187 void InterfaceRegistry::GetInterface(const std::string& interface_name, 194 void InterfaceRegistry::GetInterface(const std::string& interface_name,
188 mojo::ScopedMessagePipeHandle handle) { 195 mojo::ScopedMessagePipeHandle handle) {
189 if (is_paused_) { 196 if (is_paused_) {
190 pending_interface_requests_.emplace(interface_name, std::move(handle)); 197 pending_interface_requests_.emplace(interface_name, std::move(handle));
191 return; 198 return;
192 } 199 }
193 200
194 if (CanBindRequestForInterface(interface_name)) { 201 if (CanBindRequestForInterface(interface_name)) {
195 auto iter = name_to_binder_.find(interface_name); 202 auto iter = name_to_binder_.find(interface_name);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 exposed_interfaces_.size() == 1 && exposed_interfaces_.count("*") == 1; 259 exposed_interfaces_.size() == 1 && exposed_interfaces_.count("*") == 1;
253 } 260 }
254 261
255 void InterfaceRegistry::OnConnectionError() { 262 void InterfaceRegistry::OnConnectionError() {
256 std::list<base::Closure> closures = connection_lost_closures_; 263 std::list<base::Closure> closures = connection_lost_closures_;
257 for (const auto& closure : closures) 264 for (const auto& closure : closures)
258 closure.Run(); 265 closure.Run();
259 } 266 }
260 267
261 } // namespace service_manager 268 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/interface_registry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698