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

Unified Diff: services/service_manager/public/cpp/lib/connector_impl.cc

Issue 2775483003: Use public Service Manager Connector API in Blink (Closed)
Patch Set: . Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/service_manager/public/cpp/lib/connector_impl.h ('k') | third_party/WebKit/Source/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/service_manager/public/cpp/lib/connector_impl.cc
diff --git a/services/service_manager/public/cpp/lib/connector_impl.cc b/services/service_manager/public/cpp/lib/connector_impl.cc
index a0b11df59d6ff5f39e9a7122e7c567e59750409f..3e7c841007835a56f32ceb89bde9d8d4d3d6bd49 100644
--- a/services/service_manager/public/cpp/lib/connector_impl.cc
+++ b/services/service_manager/public/cpp/lib/connector_impl.cc
@@ -76,10 +76,13 @@ void ConnectorImpl::BindInterface(
if (!BindConnectorIfNecessary())
return;
- if (!local_binder_overrides_.empty() &&
- local_binder_overrides_.count(interface_name)) {
- local_binder_overrides_[interface_name].Run(std::move(interface_pipe));
- return;
+ auto service_overrides_iter = local_binder_overrides_.find(target.name());
+ if (service_overrides_iter != local_binder_overrides_.end()) {
+ auto override_iter = service_overrides_iter->second.find(interface_name);
+ if (override_iter != service_overrides_iter->second.end()) {
+ override_iter->second.Run(std::move(interface_pipe));
+ return;
+ }
}
connector_->BindInterface(target, interface_name, std::move(interface_pipe),
@@ -106,9 +109,10 @@ base::WeakPtr<Connector> ConnectorImpl::GetWeakPtr() {
return weak_factory_.GetWeakPtr();
}
-void ConnectorImpl::OverrideBinderForTesting(const std::string& interface_name,
+void ConnectorImpl::OverrideBinderForTesting(const std::string& service_name,
+ const std::string& interface_name,
const TestApi::Binder& binder) {
- local_binder_overrides_[interface_name] = binder;
+ local_binder_overrides_[service_name][interface_name] = binder;
}
void ConnectorImpl::ClearBinderOverrides() {
« no previous file with comments | « services/service_manager/public/cpp/lib/connector_impl.h ('k') | third_party/WebKit/Source/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698