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 "services/fake_surfaces/fake_surfaces_service_application.h" | 5 #include "services/fake_surfaces/fake_surfaces_service_application.h" |
6 | 6 |
7 #include "mojo/application/application_runner_chromium.h" | 7 #include "mojo/application/application_runner_chromium.h" |
8 #include "mojo/common/tracing_impl.h" | |
9 #include "mojo/public/c/system/main.h" | 8 #include "mojo/public/c/system/main.h" |
10 #include "mojo/public/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
11 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" | 11 #include "mojo/services/surfaces/public/interfaces/surfaces.mojom.h" |
12 | 12 |
13 using mojo::InterfaceRequest; | 13 using mojo::InterfaceRequest; |
14 | 14 |
15 namespace fake_surfaces { | 15 namespace fake_surfaces { |
16 | 16 |
17 class FakeSurfaceImpl : public mojo::Surface { | 17 class FakeSurfaceImpl : public mojo::Surface { |
18 public: | 18 public: |
19 FakeSurfaceImpl(uint32_t id_namespace, | 19 FakeSurfaceImpl(uint32_t id_namespace, |
20 mojo::InterfaceRequest<mojo::Surface> request) | 20 mojo::InterfaceRequest<mojo::Surface> request) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 }; | 85 }; |
86 | 86 |
87 FakeSurfacesServiceApplication::FakeSurfacesServiceApplication() | 87 FakeSurfacesServiceApplication::FakeSurfacesServiceApplication() |
88 : next_id_namespace_(1u) { | 88 : next_id_namespace_(1u) { |
89 } | 89 } |
90 | 90 |
91 FakeSurfacesServiceApplication::~FakeSurfacesServiceApplication() { | 91 FakeSurfacesServiceApplication::~FakeSurfacesServiceApplication() { |
92 } | 92 } |
93 | 93 |
94 void FakeSurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { | 94 void FakeSurfacesServiceApplication::Initialize(mojo::ApplicationImpl* app) { |
95 mojo::TracingImpl::Create(app); | 95 tracing_.Initialize(app); |
96 } | 96 } |
97 | 97 |
98 bool FakeSurfacesServiceApplication::ConfigureIncomingConnection( | 98 bool FakeSurfacesServiceApplication::ConfigureIncomingConnection( |
99 mojo::ApplicationConnection* connection) { | 99 mojo::ApplicationConnection* connection) { |
100 connection->AddService<mojo::SurfacesService>(this); | 100 connection->AddService<mojo::SurfacesService>(this); |
101 connection->AddService<mojo::Surface>(this); | 101 connection->AddService<mojo::Surface>(this); |
102 return true; | 102 return true; |
103 } | 103 } |
104 | 104 |
105 void FakeSurfacesServiceApplication::Create( | 105 void FakeSurfacesServiceApplication::Create( |
106 mojo::ApplicationConnection* connection, | 106 mojo::ApplicationConnection* connection, |
107 InterfaceRequest<mojo::SurfacesService> request) { | 107 InterfaceRequest<mojo::SurfacesService> request) { |
108 new FakeSurfacesServiceImpl(&next_id_namespace_, request.Pass()); | 108 new FakeSurfacesServiceImpl(&next_id_namespace_, request.Pass()); |
109 } | 109 } |
110 | 110 |
111 void FakeSurfacesServiceApplication::Create( | 111 void FakeSurfacesServiceApplication::Create( |
112 mojo::ApplicationConnection* connection, | 112 mojo::ApplicationConnection* connection, |
113 InterfaceRequest<mojo::Surface> request) { | 113 InterfaceRequest<mojo::Surface> request) { |
114 new FakeSurfaceImpl(next_id_namespace_++, request.Pass()); | 114 new FakeSurfaceImpl(next_id_namespace_++, request.Pass()); |
115 } | 115 } |
116 | 116 |
117 } // namespace fake_surfaces | 117 } // namespace fake_surfaces |
118 | 118 |
119 MojoResult MojoMain(MojoHandle shell_handle) { | 119 MojoResult MojoMain(MojoHandle shell_handle) { |
120 mojo::ApplicationRunnerChromium runner( | 120 mojo::ApplicationRunnerChromium runner( |
121 new fake_surfaces::FakeSurfacesServiceApplication); | 121 new fake_surfaces::FakeSurfacesServiceApplication); |
122 return runner.Run(shell_handle); | 122 return runner.Run(shell_handle); |
123 } | 123 } |
OLD | NEW |