| OLD | NEW |
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 callback.Run(source_info, std::move(request)); | 60 callback.Run(source_info, std::move(request)); |
| 61 } | 61 } |
| 62 | 62 |
| 63 const BindCallback callback_; | 63 const BindCallback callback_; |
| 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 65 DISALLOW_COPY_AND_ASSIGN(CallbackBinder); | 65 DISALLOW_COPY_AND_ASSIGN(CallbackBinder); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 class GenericCallbackBinder : public InterfaceBinder { | 68 class GenericCallbackBinder : public InterfaceBinder { |
| 69 public: | 69 public: |
| 70 using BindCallback = base::Callback<void(mojo::ScopedMessagePipeHandle)>; | 70 using BindCallback = base::Callback<void(const BindSourceInfo&, |
| 71 const std::string&, |
| 72 mojo::ScopedMessagePipeHandle)>; |
| 71 | 73 |
| 72 GenericCallbackBinder( | 74 GenericCallbackBinder( |
| 73 const BindCallback& callback, | 75 const BindCallback& callback, |
| 74 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 76 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 77 GenericCallbackBinder( |
| 78 const base::Callback<void(mojo::ScopedMessagePipeHandle)>& callback, |
| 79 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 75 ~GenericCallbackBinder() override; | 80 ~GenericCallbackBinder() override; |
| 76 | 81 |
| 77 private: | 82 private: |
| 78 // InterfaceBinder: | 83 // InterfaceBinder: |
| 79 void BindInterface(const BindSourceInfo& source_info, | 84 void BindInterface(const BindSourceInfo& source_info, |
| 80 const std::string& interface_name, | 85 const std::string& interface_name, |
| 81 mojo::ScopedMessagePipeHandle handle) override; | 86 mojo::ScopedMessagePipeHandle handle) override; |
| 82 | 87 |
| 83 static void RunCallback(const BindCallback& callback, | 88 static void RunCallback(const BindCallback& callback, |
| 89 const BindSourceInfo& source_info, |
| 90 const std::string& interface_name, |
| 84 mojo::ScopedMessagePipeHandle client_handle); | 91 mojo::ScopedMessagePipeHandle client_handle); |
| 85 | 92 |
| 86 const BindCallback callback_; | 93 const BindCallback callback_; |
| 87 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 94 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 88 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder); | 95 DISALLOW_COPY_AND_ASSIGN(GenericCallbackBinder); |
| 89 }; | 96 }; |
| 90 | 97 |
| 91 } // namespace service_manager | 98 } // namespace service_manager |
| 92 | 99 |
| 93 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_ | 100 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_INTERFACE_BINDER_H_ |
| OLD | NEW |