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

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

Issue 2859343003: Enable overriding interface binders for any services running in current process. (Closed)
Patch Set: Address nit 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 451f1ad0c8e297a65de8f14350be03ef6f6498b0..6bfe7ebd0f20d75d9077613d5fa7c73ab07b1d7b 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/service.h"
#include "services/service_manager/public/interfaces/connector.mojom.h"
@@ -104,6 +105,20 @@ class 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;

Powered by Google App Engine
This is Rietveld 408576698