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

Side by Side Diff: services/service_manager/public/cpp/lib/service_runner.cc

Issue 2701883002: service_manager: More consistent Service lifecycle API (Closed)
Patch Set: . Created 3 years, 10 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 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/service_manager/public/cpp/service_runner.h" 5 #include "services/service_manager/public/cpp/service_runner.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 { 51 {
52 std::unique_ptr<base::MessageLoop> loop; 52 std::unique_ptr<base::MessageLoop> loop;
53 loop.reset(new base::MessageLoop(message_loop_type_)); 53 loop.reset(new base::MessageLoop(message_loop_type_));
54 54
55 context_.reset(new ServiceContext( 55 context_.reset(new ServiceContext(
56 std::move(service_), 56 std::move(service_),
57 mojo::MakeRequest<mojom::Service>(mojo::MakeScopedHandle( 57 mojo::MakeRequest<mojom::Service>(mojo::MakeScopedHandle(
58 mojo::MessagePipeHandle(service_request_handle))))); 58 mojo::MessagePipeHandle(service_request_handle)))));
59 base::RunLoop run_loop; 59 base::RunLoop run_loop;
60 context_->SetConnectionLostClosure(run_loop.QuitClosure()); 60 context_->SetQuitClosure(run_loop.QuitClosure());
61 run_loop.Run(); 61 run_loop.Run();
62 context_.reset(); 62 context_.reset();
63 } 63 }
64 return MOJO_RESULT_OK; 64 return MOJO_RESULT_OK;
65 } 65 }
66 66
67 MojoResult ServiceRunner::Run(MojoHandle service_request_handle) { 67 MojoResult ServiceRunner::Run(MojoHandle service_request_handle) {
68 return Run(service_request_handle, false); 68 return Run(service_request_handle, false);
69 } 69 }
70 70
71 void ServiceRunner::Quit() { 71 void ServiceRunner::Quit() {
72 base::MessageLoop::current()->QuitWhenIdle(); 72 base::MessageLoop::current()->QuitWhenIdle();
73 } 73 }
74 74
75 } // namespace service_manager 75 } // namespace service_manager
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/lib/service_context.cc ('k') | services/service_manager/public/cpp/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698