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

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: 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
« no previous file with comments | « content/test/BUILD.gn ('k') | services/service_manager/public/cpp/service_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..03571874aeb16974bb389fd719f352fa09bd35f8 100644
--- a/services/service_manager/public/cpp/service_context.h
+++ b/services/service_manager/public/cpp/service_context.h
@@ -42,6 +42,32 @@ namespace service_manager {
// client.
class ServiceContext : public mojom::Service {
public:
+ class TestApi {
Ken Rockot(use gerrit already) 2017/05/09 15:29:34 nit: I'm not really a fan of these TestApi subclas
leonhsl(Using Gerrit) 2017/05/09 23:31:53 Acknowledged.
leonhsl(Using Gerrit) 2017/05/10 09:57:11 Done.
+ public:
+ ~TestApi() = default;
+
+ // Overrides the interface binder for |interface_name| of |service|. This is
+ // a process-wide override, means that |binder| can intercept requests only
+ // if |service| runs in the same process with caller of this function.
+ // You can specify |service| as identity of a particular instance of service
+ // "Foo", or just an identity only having the name "Foo" to specify any
+ // instances of service "Foo" in general.
+ static void SetGlobalBinder(
+ const Identity& service,
Ken Rockot(use gerrit already) 2017/05/09 15:29:34 I wonder if we really want a specific identity to
leonhsl(Using Gerrit) 2017/05/09 23:31:53 Yeah I was afraid in future some test cases may wa
blundell 2017/05/10 08:54:39 Let's leave it simple for now and it will be easy
leonhsl(Using Gerrit) 2017/05/10 09:57:11 I see, will update CL soon.
leonhsl(Using Gerrit) 2017/05/11 02:21:47 Done.
+ const std::string& interface_name,
+ const base::Callback<void(mojo::ScopedMessagePipeHandle)>& binder,
Ken Rockot(use gerrit already) 2017/05/09 15:29:34 In keeping with existing binder callbacks today, t
leonhsl(Using Gerrit) 2017/05/09 23:31:53 Acknowledged.
leonhsl(Using Gerrit) 2017/05/10 09:57:11 Done and Thanks!
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner =
+ nullptr);
+
+ // Clears all overridden interface binders for |service|.
+ static void ClearGlobalBinders(const Identity& service);
blundell 2017/05/05 12:56:07 nit: Maybe ClearGlobalBindersForService()?
leonhsl(Using Gerrit) 2017/05/09 00:08:54 Acknowledged.
+
+ private:
+ TestApi() = default;
+
+ DISALLOW_COPY_AND_ASSIGN(TestApi);
+ };
+
// Creates a new ServiceContext bound to |request|. This connection may be
// used immediately to make outgoing connections via connector().
//
« no previous file with comments | « content/test/BUILD.gn ('k') | services/service_manager/public/cpp/service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698