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 "mojo/application/application_runner_chromium.h" | 5 #include "mojo/application/application_runner_chromium.h" |
6 #include "mojo/common/weak_binding_set.h" | 6 #include "mojo/common/weak_binding_set.h" |
7 #include "mojo/common/weak_interface_ptr_set.h" | 7 #include "mojo/common/weak_interface_ptr_set.h" |
8 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 virtual ~Server(); | 32 virtual ~Server(); |
33 | 33 |
34 private: | 34 private: |
35 // mojo::ApplicationDelegate: | 35 // mojo::ApplicationDelegate: |
36 void Initialize(mojo::ApplicationImpl* app) override { | 36 void Initialize(mojo::ApplicationImpl* app) override { |
37 } | 37 } |
38 bool ConfigureIncomingConnection( | 38 bool ConfigureIncomingConnection( |
39 mojo::ApplicationConnection* connection) override { | 39 mojo::ApplicationConnection* connection) override { |
40 connection->AddService<InspectorFrontend>(this); | 40 connection->AddService<InspectorFrontend>(this); |
41 connection->AddService<InspectorServer>(this); | 41 connection->AddService<InspectorServer>(this); |
42 // The application connecting to us may implement InspectorBackend, | 42 if (connection->GetServiceProvider()) { |
43 // attempt to establish a connection to find out. If it doesn't then this | 43 // The application connecting to us may implement InspectorBackend, |
44 // pipe will close. | 44 // attempt to establish a connection to find out. If it doesn't then this |
45 InspectorBackendPtr backend; | 45 // pipe will close. |
46 connection->ConnectToService(&backend); | 46 InspectorBackendPtr backend; |
47 backends_.AddInterfacePtr(backend.Pass()); | 47 connection->ConnectToService(&backend); |
| 48 backends_.AddInterfacePtr(backend.Pass()); |
| 49 } |
48 return true; | 50 return true; |
49 } | 51 } |
50 | 52 |
51 // InterfaceFactory<InspectorFrontend>: | 53 // InterfaceFactory<InspectorFrontend>: |
52 void Create(mojo::ApplicationConnection* connection, | 54 void Create(mojo::ApplicationConnection* connection, |
53 mojo::InterfaceRequest<InspectorFrontend> request) override { | 55 mojo::InterfaceRequest<InspectorFrontend> request) override { |
54 frontend_bindings_.AddBinding(this, request.Pass()); | 56 frontend_bindings_.AddBinding(this, request.Pass()); |
55 } | 57 } |
56 | 58 |
57 // InterfaceFactory<InspectorServer>: | 59 // InterfaceFactory<InspectorServer>: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 145 } |
144 | 146 |
145 } // namespace inspector | 147 } // namespace inspector |
146 } // namespace sky | 148 } // namespace sky |
147 | 149 |
148 MojoResult MojoMain(MojoHandle shell_handle) { | 150 MojoResult MojoMain(MojoHandle shell_handle) { |
149 mojo::ApplicationRunnerChromium runner(new sky::inspector::Server); | 151 mojo::ApplicationRunnerChromium runner(new sky::inspector::Server); |
150 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); | 152 runner.set_message_loop_type(base::MessageLoop::TYPE_IO); |
151 return runner.Run(shell_handle); | 153 return runner.Run(shell_handle); |
152 } | 154 } |
OLD | NEW |