| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
| 7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
| 8 #include "mojo/common/weak_binding_set.h" | 8 #include "mojo/common/weak_binding_set.h" |
| 9 #include "mojo/common/weak_interface_ptr_set.h" | 9 #include "mojo/common/weak_interface_ptr_set.h" |
| 10 #include "mojo/public/c/system/main.h" | 10 #include "mojo/public/c/system/main.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class TracingApp : public mojo::ApplicationDelegate, | 43 class TracingApp : public mojo::ApplicationDelegate, |
| 44 public mojo::InterfaceFactory<TraceCoordinator>, | 44 public mojo::InterfaceFactory<TraceCoordinator>, |
| 45 public TraceCoordinator { | 45 public TraceCoordinator { |
| 46 public: | 46 public: |
| 47 TracingApp() {} | 47 TracingApp() {} |
| 48 ~TracingApp() override {} | 48 ~TracingApp() override {} |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // mojo::ApplicationDelegate implementation. | 51 // mojo::ApplicationDelegate implementation. |
| 52 bool ConfigureIncomingConnection( | 52 bool ConfigureIncomingConnection( |
| 53 mojo::ApplicationConnection* connection) override { | 53 mojo::ApplicationConnection* connection, |
| 54 const std::string& url) override { |
| 54 connection->AddService<TraceCoordinator>(this); | 55 connection->AddService<TraceCoordinator>(this); |
| 55 | 56 |
| 56 // If someone connects to us they may want to use the TraceCoordinator | 57 // If someone connects to us they may want to use the TraceCoordinator |
| 57 // interface and/or they may want to expose themselves to be traced. Attempt | 58 // interface and/or they may want to expose themselves to be traced. Attempt |
| 58 // to connect to the TraceController interface to see if the application | 59 // to connect to the TraceController interface to see if the application |
| 59 // connecting to us wants to be traced. They can refuse the connection or | 60 // connecting to us wants to be traced. They can refuse the connection or |
| 60 // close the pipe if not. | 61 // close the pipe if not. |
| 61 TraceControllerPtr controller_ptr; | 62 TraceControllerPtr controller_ptr; |
| 62 connection->ConnectToService(&controller_ptr); | 63 connection->ConnectToService(&controller_ptr); |
| 63 controller_ptrs_.AddInterfacePtr(controller_ptr.Pass()); | 64 controller_ptrs_.AddInterfacePtr(controller_ptr.Pass()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 108 |
| 108 DISALLOW_COPY_AND_ASSIGN(TracingApp); | 109 DISALLOW_COPY_AND_ASSIGN(TracingApp); |
| 109 }; | 110 }; |
| 110 | 111 |
| 111 } // namespace tracing | 112 } // namespace tracing |
| 112 | 113 |
| 113 MojoResult MojoMain(MojoHandle shell_handle) { | 114 MojoResult MojoMain(MojoHandle shell_handle) { |
| 114 mojo::ApplicationRunnerChromium runner(new tracing::TracingApp); | 115 mojo::ApplicationRunnerChromium runner(new tracing::TracingApp); |
| 115 return runner.Run(shell_handle); | 116 return runner.Run(shell_handle); |
| 116 } | 117 } |
| OLD | NEW |