| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/process/process.h" | 8 #include "base/process/process.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "mojo/shell/public/cpp/connection.h" | 10 #include "mojo/shell/public/cpp/connection.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 private: | 30 private: |
| 31 // mojo::ShellClient: | 31 // mojo::ShellClient: |
| 32 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, | 32 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, |
| 33 uint32_t id) override { | 33 uint32_t id) override { |
| 34 connector_ = connector; | 34 connector_ = connector; |
| 35 } | 35 } |
| 36 bool AcceptConnection(mojo::Connection* connection) override { | 36 bool AcceptConnection(mojo::Connection* connection) override { |
| 37 connection->AddInterface<ClientProcessTest>(this); | 37 connection->AddInterface<ClientProcessTest>(this); |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 void ShellConnectionLost() override { | 40 bool ShellConnectionLost() override { |
| 41 // TODO: This should exit cleanly. | 41 // TODO(rockot): http://crbug.com/596621. Should be able to remove this |
| 42 // override entirely. |
| 42 _exit(1); | 43 _exit(1); |
| 43 } | 44 } |
| 44 | 45 |
| 45 // mojo::InterfaceFactory<ConnectTestService>: | 46 // mojo::InterfaceFactory<ConnectTestService>: |
| 46 void Create(mojo::Connection* connection, | 47 void Create(mojo::Connection* connection, |
| 47 ClientProcessTestRequest request) override { | 48 ClientProcessTestRequest request) override { |
| 48 bindings_.AddBinding(this, std::move(request)); | 49 bindings_.AddBinding(this, std::move(request)); |
| 49 } | 50 } |
| 50 | 51 |
| 51 // test::mojom::ClientProcessTest: | 52 // test::mojom::ClientProcessTest: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 int main(int argc, char** argv) { | 80 int main(int argc, char** argv) { |
| 80 base::AtExitManager at_exit; | 81 base::AtExitManager at_exit; |
| 81 base::CommandLine::Init(argc, argv); | 82 base::CommandLine::Init(argc, argv); |
| 82 | 83 |
| 83 mojo::shell::InitializeLogging(); | 84 mojo::shell::InitializeLogging(); |
| 84 | 85 |
| 85 Driver driver; | 86 Driver driver; |
| 86 return mojo::shell::TestNativeMain(&driver); | 87 return mojo::shell::TestNativeMain(&driver); |
| 87 } | 88 } |
| OLD | NEW |