| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "examples/indirect_service/indirect_service_demo.mojom.h" | 7 #include "examples/indirect_service/indirect_service_demo.mojom.h" |
| 8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
| 9 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 IndirectIntegerServiceImpl(InterfaceRequest<IndirectIntegerService> request) | 22 IndirectIntegerServiceImpl(InterfaceRequest<IndirectIntegerService> request) |
| 23 : binding_(this, request.Pass()) {} | 23 : binding_(this, request.Pass()) {} |
| 24 | 24 |
| 25 ~IndirectIntegerServiceImpl() override { | 25 ~IndirectIntegerServiceImpl() override { |
| 26 for (auto itr = bindings_.begin(); itr < bindings_.end(); itr++) | 26 for (auto itr = bindings_.begin(); itr < bindings_.end(); itr++) |
| 27 delete *itr; | 27 delete *itr; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // IndirectIntegerService | 30 // IndirectIntegerService |
| 31 | 31 |
| 32 void Set(IntegerServicePtr service) override { | 32 void Set(InterfaceHandle<IntegerService> service) override { |
| 33 integer_service_ = service.Pass(); | 33 integer_service_ = IntegerServicePtr::Create(std::move(service)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 void Get(InterfaceRequest<IntegerService> service) override { | 36 void Get(InterfaceRequest<IntegerService> service) override { |
| 37 bindings_.push_back(new Binding<IntegerService>(this, service.Pass())); | 37 bindings_.push_back(new Binding<IntegerService>(this, service.Pass())); |
| 38 } | 38 } |
| 39 | 39 |
| 40 // IntegerService | 40 // IntegerService |
| 41 | 41 |
| 42 void Increment(const Callback<void(int32_t)>& callback) override { | 42 void Increment(const Callback<void(int32_t)>& callback) override { |
| 43 if (integer_service_.get()) | 43 if (integer_service_.get()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 } // namespace examples | 71 } // namespace examples |
| 72 } // namespace mojo | 72 } // namespace mojo |
| 73 | 73 |
| 74 MojoResult MojoMain(MojoHandle application_request) { | 74 MojoResult MojoMain(MojoHandle application_request) { |
| 75 mojo::ApplicationRunner runner( | 75 mojo::ApplicationRunner runner( |
| 76 std::unique_ptr<mojo::examples::IndirectIntegerServiceAppDelegate>( | 76 std::unique_ptr<mojo::examples::IndirectIntegerServiceAppDelegate>( |
| 77 new mojo::examples::IndirectIntegerServiceAppDelegate())); | 77 new mojo::examples::IndirectIntegerServiceAppDelegate())); |
| 78 return runner.Run(application_request); | 78 return runner.Run(application_request); |
| 79 } | 79 } |
| OLD | NEW |