| 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 17 matching lines...) Expand all Loading... |
| 28 public service_manager::test::mojom::Parent { | 28 public service_manager::test::mojom::Parent { |
| 29 public: | 29 public: |
| 30 Parent() {} | 30 Parent() {} |
| 31 ~Parent() override { | 31 ~Parent() override { |
| 32 child_connection_.reset(); | 32 child_connection_.reset(); |
| 33 parent_bindings_.CloseAllBindings(); | 33 parent_bindings_.CloseAllBindings(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 // Service: | 37 // Service: |
| 38 bool OnConnect(const service_manager::Identity& remote_identity, | 38 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 39 service_manager::InterfaceRegistry* registry) override { | 39 service_manager::InterfaceRegistry* registry) override { |
| 40 registry->AddInterface<service_manager::test::mojom::Parent>(this); | 40 registry->AddInterface<service_manager::test::mojom::Parent>(this); |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 // InterfaceFactory<service_manager::test::mojom::Parent>: | 44 // InterfaceFactory<service_manager::test::mojom::Parent>: |
| 45 void Create(const service_manager::Identity& remote_identity, | 45 void Create(const service_manager::Identity& remote_identity, |
| 46 service_manager::test::mojom::ParentRequest request) override { | 46 service_manager::test::mojom::ParentRequest request) override { |
| 47 parent_bindings_.AddBinding(this, std::move(request)); | 47 parent_bindings_.AddBinding(this, std::move(request)); |
| 48 } | 48 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(Parent); | 71 DISALLOW_COPY_AND_ASSIGN(Parent); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 MojoResult ServiceMain(MojoHandle service_request_handle) { | 76 MojoResult ServiceMain(MojoHandle service_request_handle) { |
| 77 Parent* parent = new Parent; | 77 Parent* parent = new Parent; |
| 78 return service_manager::ServiceRunner(parent).Run(service_request_handle); | 78 return service_manager::ServiceRunner(parent).Run(service_request_handle); |
| 79 } | 79 } |
| OLD | NEW |