OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/public/cpp/bindings/binding_set.h" | 10 #include "mojo/public/cpp/bindings/binding_set.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 public: | 30 public: |
31 Parent() { | 31 Parent() { |
32 registry_.AddInterface<service_manager::test::mojom::Parent>(this); | 32 registry_.AddInterface<service_manager::test::mojom::Parent>(this); |
33 } | 33 } |
34 ~Parent() override { | 34 ~Parent() override { |
35 parent_bindings_.CloseAllBindings(); | 35 parent_bindings_.CloseAllBindings(); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 // Service: | 39 // Service: |
40 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 40 void OnBindInterface(const service_manager::BindSourceInfo& source_info, |
41 const std::string& interface_name, | 41 const std::string& interface_name, |
42 mojo::ScopedMessagePipeHandle interface_pipe) override { | 42 mojo::ScopedMessagePipeHandle interface_pipe) override { |
43 registry_.BindInterface(source_info.identity, interface_name, | 43 registry_.BindInterface(source_info.identity, interface_name, |
44 std::move(interface_pipe)); | 44 std::move(interface_pipe)); |
45 } | 45 } |
46 | 46 |
47 // InterfaceFactory<service_manager::test::mojom::Parent>: | 47 // InterfaceFactory<service_manager::test::mojom::Parent>: |
48 void Create(const service_manager::Identity& remote_identity, | 48 void Create(const service_manager::Identity& remote_identity, |
49 service_manager::test::mojom::ParentRequest request) override { | 49 service_manager::test::mojom::ParentRequest request) override { |
50 parent_bindings_.AddBinding(this, std::move(request)); | 50 parent_bindings_.AddBinding(this, std::move(request)); |
(...skipping 21 matching lines...) Expand all Loading... |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(Parent); | 73 DISALLOW_COPY_AND_ASSIGN(Parent); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 MojoResult ServiceMain(MojoHandle service_request_handle) { | 78 MojoResult ServiceMain(MojoHandle service_request_handle) { |
79 Parent* parent = new Parent; | 79 Parent* parent = new Parent; |
80 return service_manager::ServiceRunner(parent).Run(service_request_handle); | 80 return service_manager::ServiceRunner(parent).Run(service_request_handle); |
81 } | 81 } |
OLD | NEW |