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

Side by Side Diff: services/service_manager/public/cpp/interface_binder.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_ 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 callback.Run(source_info, std::move(request)); 61 callback.Run(source_info, std::move(request));
62 } 62 }
63 63
64 const BindCallback callback_; 64 const BindCallback callback_;
65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 65 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
66 DISALLOW_COPY_AND_ASSIGN(CallbackBinder); 66 DISALLOW_COPY_AND_ASSIGN(CallbackBinder);
67 }; 67 };
68 68
69 class GenericCallbackBinder : public InterfaceBinder { 69 class GenericCallbackBinder : public InterfaceBinder {
70 public: 70 public:
71 using BindCallback = base::Callback<void(mojo::ScopedMessagePipeHandle)>; 71 using BindCallback = base::Callback<void(const BindSourceInfo&,
72 const std::string&,
73 mojo::ScopedMessagePipeHandle)>;
72 74
73 GenericCallbackBinder( 75 GenericCallbackBinder(
74 const BindCallback& callback, 76 const BindCallback& callback,
75 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); 77 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
78 GenericCallbackBinder(
79 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback,
80 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
76 ~GenericCallbackBinder() override; 81 ~GenericCallbackBinder() override;
77 82
78 private: 83 private:
79 // InterfaceBinder: 84 // InterfaceBinder:
80 void BindInterface(const BindSourceInfo& source_info, 85 void BindInterface(const BindSourceInfo& source_info,
81 const std::string& interface_name, 86 const std::string& interface_name,
82 mojo::ScopedMessagePipeHandle handle) override; 87 mojo::ScopedMessagePipeHandle handle) override;
83 88
84 static void RunCallback(const BindCallback& callback, 89 static void RunCallback(const BindCallback& callback,
90 const BindSourceInfo& source_info,
91 const std::string& interface_name,
85 mojo::ScopedMessagePipeHandle client_handle); 92 mojo::ScopedMessagePipeHandle client_handle);
86 93
87 const BindCallback callback_; 94 const BindCallback callback_;
88 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 95 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
89 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder); 96 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder);
90 }; 97 };
91 98
92 } // namespace service_manager 99 } // namespace service_manager
93 100
94 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_ 101 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698