Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Side by Side Diff: services/service_manager/tests/shutdown/shutdown_service_app.cc

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 5 #include "base/macros.h"
6 #include "mojo/public/cpp/bindings/binding_set.h" 6 #include "mojo/public/cpp/bindings/binding_set.h"
7 #include "services/service_manager/public/c/main.h" 7 #include "services/service_manager/public/c/main.h"
8 #include "services/service_manager/public/cpp/bind_source_info.h"
8 #include "services/service_manager/public/cpp/binder_registry.h" 9 #include "services/service_manager/public/cpp/binder_registry.h"
9 #include "services/service_manager/public/cpp/interface_factory.h" 10 #include "services/service_manager/public/cpp/interface_factory.h"
10 #include "services/service_manager/public/cpp/service.h" 11 #include "services/service_manager/public/cpp/service.h"
11 #include "services/service_manager/public/cpp/service_info.h"
12 #include "services/service_manager/public/cpp/service_runner.h" 12 #include "services/service_manager/public/cpp/service_runner.h"
13 #include "services/service_manager/tests/shutdown/shutdown_unittest.mojom.h" 13 #include "services/service_manager/tests/shutdown/shutdown_unittest.mojom.h"
14 14
15 namespace service_manager { 15 namespace service_manager {
16 namespace { 16 namespace {
17 17
18 service_manager::ServiceRunner* g_app = nullptr; 18 service_manager::ServiceRunner* g_app = nullptr;
19 19
20 class ShutdownServiceApp 20 class ShutdownServiceApp
21 : public Service, 21 : public Service,
22 public InterfaceFactory<mojom::ShutdownTestService>, 22 public InterfaceFactory<mojom::ShutdownTestService>,
23 public mojom::ShutdownTestService { 23 public mojom::ShutdownTestService {
24 public: 24 public:
25 ShutdownServiceApp() { 25 ShutdownServiceApp() {
26 registry_.AddInterface<mojom::ShutdownTestService>(this); 26 registry_.AddInterface<mojom::ShutdownTestService>(this);
27 } 27 }
28 ~ShutdownServiceApp() override {} 28 ~ShutdownServiceApp() override {}
29 29
30 private: 30 private:
31 // service_manager::Service: 31 // service_manager::Service:
32 void OnBindInterface(const ServiceInfo& source_info, 32 void OnBindInterface(const BindSourceInfo& source_info,
33 const std::string& interface_name, 33 const std::string& interface_name,
34 mojo::ScopedMessagePipeHandle interface_pipe) override { 34 mojo::ScopedMessagePipeHandle interface_pipe) override {
35 registry_.BindInterface(source_info.identity, interface_name, 35 registry_.BindInterface(source_info.identity, interface_name,
36 std::move(interface_pipe)); 36 std::move(interface_pipe));
37 } 37 }
38 38
39 // InterfaceFactory<mojom::ShutdownTestService>: 39 // InterfaceFactory<mojom::ShutdownTestService>:
40 void Create(const Identity& remote_identity, 40 void Create(const Identity& remote_identity,
41 mojom::ShutdownTestServiceRequest request) override { 41 mojom::ShutdownTestServiceRequest request) override {
42 bindings_.AddBinding(this, std::move(request)); 42 bindings_.AddBinding(this, std::move(request));
(...skipping 11 matching lines...) Expand all
54 54
55 } // namespace 55 } // namespace
56 } // namespace service_manager 56 } // namespace service_manager
57 57
58 MojoResult ServiceMain(MojoHandle service_request_handle) { 58 MojoResult ServiceMain(MojoHandle service_request_handle) {
59 service_manager::ServiceRunner runner( 59 service_manager::ServiceRunner runner(
60 new service_manager::ShutdownServiceApp); 60 new service_manager::ShutdownServiceApp);
61 service_manager::g_app = &runner; 61 service_manager::g_app = &runner;
62 return runner.Run(service_request_handle); 62 return runner.Run(service_request_handle);
63 } 63 }
OLDNEW
« no previous file with comments | « services/service_manager/tests/shutdown/shutdown_client_app.cc ('k') | services/shape_detection/shape_detection_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698