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

Side by Side Diff: media/mojo/services/main.cc

Issue 2484953002: Eliminate quit closure argument to embedded service factories (Closed)
Patch Set: . Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "media/mojo/services/media_service_factory.h" 9 #include "media/mojo/services/media_service_factory.h"
10 #include "services/service_manager/public/c/main.h" 10 #include "services/service_manager/public/c/main.h"
11 #include "services/service_manager/public/cpp/service_runner.h" 11 #include "services/service_manager/public/cpp/service_runner.h"
12 12
13 namespace {
14
15 service_manager::ServiceRunner* g_runner = nullptr;
16
17 void QuitApplication() {
18 DCHECK(g_runner);
19 g_runner->Quit();
20 }
21
22 } // namespace
23
24 MojoResult ServiceMain(MojoHandle mojo_handle) { 13 MojoResult ServiceMain(MojoHandle mojo_handle) {
25 // Enable logging. 14 // Enable logging.
26 base::AtExitManager at_exit; 15 base::AtExitManager at_exit;
27 service_manager::ServiceRunner::InitBaseCommandLine(); 16 service_manager::ServiceRunner::InitBaseCommandLine();
28 17
29 logging::LoggingSettings settings; 18 logging::LoggingSettings settings;
30 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 19 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
31 logging::InitLogging(settings); 20 logging::InitLogging(settings);
32 21
33 std::unique_ptr<service_manager::Service> service = 22 std::unique_ptr<service_manager::Service> service =
34 media::CreateMediaServiceForTesting(base::Bind(&QuitApplication)); 23 media::CreateMediaServiceForTesting();
35 service_manager::ServiceRunner runner(service.release()); 24 service_manager::ServiceRunner runner(service.release());
36 g_runner = &runner;
37 return runner.Run(mojo_handle, false /* init_base */); 25 return runner.Run(mojo_handle, false /* init_base */);
38 } 26 }
OLDNEW
« no previous file with comments | « content/shell/utility/shell_content_utility_client.cc ('k') | media/mojo/services/media_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698