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

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

Issue 2879843002: Reland 1: Enable overriding interface binders for any services running in current process. (Closed)
Patch Set: Identical with original CL Created 3 years, 7 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/service_context.h
diff --git a/services/service_manager/public/cpp/service_context.h b/services/service_manager/public/cpp/service_context.h
index d082913d088d1c1e8afabfa4ad6a2b62c5695a6b..4d6d72a09c60e2ecfdd74c2a5fa4a44945230c6b 100644
--- a/services/service_manager/public/cpp/service_context.h
+++ b/services/service_manager/public/cpp/service_context.h
@@ -13,6 +13,7 @@
#include "base/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/system/core.h"
+#include "services/service_manager/public/cpp/binder_registry.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/export.h"
#include "services/service_manager/public/cpp/service.h"
@@ -105,6 +106,20 @@ class SERVICE_MANAGER_PUBLIC_CPP_EXPORT ServiceContext : public mojom::Service {
// disconnection from the Service Manager.
void QuitNow();
+ // Overrides the interface binder for |interface_name| of |service_name|.
+ // This is a process-wide override, meaning that |binder| can intercept
+ // requests against only those |service_name| service instances running in the
+ // same process with caller of this function.
+ static void SetGlobalBinderForTesting(
+ const std::string& service_name,
+ const std::string& interface_name,
+ const BinderRegistry::Binder& binder,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner = nullptr);
+
+ // Clears all overridden interface binders for service |service_name| set via
+ // SetGlobalBinderForTesting().
+ static void ClearGlobalBindersForTesting(const std::string& service_name);
+
private:
friend class service_manager::Service;
« no previous file with comments | « services/service_manager/public/cpp/interface_binder.cc ('k') | services/service_manager/public/cpp/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698