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

Unified Diff: services/service_manager/public/cpp/interface_provider.h

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 8 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
Index: services/service_manager/public/cpp/interface_provider.h
diff --git a/services/service_manager/public/cpp/interface_provider.h b/services/service_manager/public/cpp/interface_provider.h
index 6a872bc4e9d63311d215876ac9f34b62cc37896d..744ed5fbdde455a8ef4911307c0d62adcd8886ad 100644
--- a/services/service_manager/public/cpp/interface_provider.h
+++ b/services/service_manager/public/cpp/interface_provider.h
@@ -10,6 +10,8 @@
namespace service_manager {
+struct BindSourceInfo;
+
// Encapsulates a mojom::InterfaceProviderPtr implemented in a remote
// application. Provides two main features:
// - a typesafe GetInterface() method for binding InterfacePtrs.
@@ -81,19 +83,23 @@ class InterfaceProvider {
mojo::ScopedMessagePipeHandle request_handle);
// Returns a callback to GetInterface<Interface>(). This can be passed to
- // InterfaceRegistry::AddInterface() to forward requests.
+ // BinderRegistry::AddInterface() to forward requests.
template <typename Interface>
- base::Callback<void(mojo::InterfaceRequest<Interface>)>
+ base::Callback<void(const BindSourceInfo&, mojo::InterfaceRequest<Interface>)>
CreateInterfaceFactory() {
- // InterfaceProvider::GetInterface() is overloaded, so static_cast to select
- // the overload that takes an mojo::InterfaceRequest<Interface>.
- return base::Bind(static_cast<void (InterfaceProvider::*)(
- mojo::InterfaceRequest<Interface>)>(
- &InterfaceProvider::GetInterface<Interface>),
- GetWeakPtr());
+ return base::Bind(
+ &InterfaceProvider::BindInterfaceRequestFromSource<Interface>,
+ GetWeakPtr());
}
private:
+ template <typename Interface>
+ void BindInterfaceRequestFromSource(
+ const BindSourceInfo& source_info,
+ mojo::InterfaceRequest<Interface> request) {
+ GetInterface<Interface>(std::move(request));
+ }
+
void SetBinderForName(
const std::string& name,
const base::Callback<void(mojo::ScopedMessagePipeHandle)>& binder) {
« no previous file with comments | « services/service_manager/public/cpp/binder_registry.h ('k') | services/service_manager/public/cpp/lib/callback_binder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698