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

Side by Side Diff: services/shell/tests/lifecycle/parent.cc

Issue 2215133002: Change signature of OnConnect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: . Created 4 years, 4 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
« no previous file with comments | « services/shell/tests/lifecycle/package.cc ('k') | services/shell/tests/shell/driver.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "mojo/public/cpp/bindings/binding_set.h" 10 #include "mojo/public/cpp/bindings/binding_set.h"
11 #include "services/shell/public/c/main.h" 11 #include "services/shell/public/c/main.h"
12 #include "services/shell/public/cpp/connector.h" 12 #include "services/shell/public/cpp/connector.h"
13 #include "services/shell/public/cpp/interface_factory.h"
14 #include "services/shell/public/cpp/interface_registry.h"
13 #include "services/shell/public/cpp/service.h" 15 #include "services/shell/public/cpp/service.h"
14 #include "services/shell/public/cpp/service_runner.h" 16 #include "services/shell/public/cpp/service_runner.h"
15 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h" 17 #include "services/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
16 18
17 namespace { 19 namespace {
18 20
19 void QuitLoop(base::RunLoop* loop) { 21 void QuitLoop(base::RunLoop* loop) {
20 loop->Quit(); 22 loop->Quit();
21 } 23 }
22 24
23 class Parent : public shell::Service, 25 class Parent : public shell::Service,
24 public shell::InterfaceFactory<shell::test::mojom::Parent>, 26 public shell::InterfaceFactory<shell::test::mojom::Parent>,
25 public shell::test::mojom::Parent { 27 public shell::test::mojom::Parent {
26 public: 28 public:
27 Parent() {} 29 Parent() {}
28 ~Parent() override { 30 ~Parent() override {
29 child_connection_.reset(); 31 child_connection_.reset();
30 parent_bindings_.CloseAllBindings(); 32 parent_bindings_.CloseAllBindings();
31 } 33 }
32 34
33 private: 35 private:
34 // Service: 36 // Service:
35 bool OnConnect(shell::Connection* connection) override { 37 bool OnConnect(const shell::Identity& remote_identity,
36 connection->AddInterface<shell::test::mojom::Parent>(this); 38 shell::InterfaceRegistry* registry) override {
39 registry->AddInterface<shell::test::mojom::Parent>(this);
37 return true; 40 return true;
38 } 41 }
39 42
40 // InterfaceFactory<shell::test::mojom::Parent>: 43 // InterfaceFactory<shell::test::mojom::Parent>:
41 void Create(const shell::Identity& remote_identity, 44 void Create(const shell::Identity& remote_identity,
42 shell::test::mojom::ParentRequest request) override { 45 shell::test::mojom::ParentRequest request) override {
43 parent_bindings_.AddBinding(this, std::move(request)); 46 parent_bindings_.AddBinding(this, std::move(request));
44 } 47 }
45 48
46 // Parent: 49 // Parent:
(...skipping 19 matching lines...) Expand all
66 69
67 DISALLOW_COPY_AND_ASSIGN(Parent); 70 DISALLOW_COPY_AND_ASSIGN(Parent);
68 }; 71 };
69 72
70 } // namespace 73 } // namespace
71 74
72 MojoResult ServiceMain(MojoHandle service_request_handle) { 75 MojoResult ServiceMain(MojoHandle service_request_handle) {
73 Parent* parent = new Parent; 76 Parent* parent = new Parent;
74 return shell::ServiceRunner(parent).Run(service_request_handle); 77 return shell::ServiceRunner(parent).Run(service_request_handle);
75 } 78 }
OLDNEW
« no previous file with comments | « services/shell/tests/lifecycle/package.cc ('k') | services/shell/tests/shell/driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698