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

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

Issue 1775243002: Rename PackageManager->Catalog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@42cpi
Patch Set: . Created 4 years, 9 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 | « mojo/services/package_manager/loader.cc ('k') | mojo/services/package_manager/manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/at_exit.h"
6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/sequenced_worker_pool.h"
10 #include "mojo/message_pump/message_pump_mojo.h"
11 #include "mojo/public/c/system/main.h"
12 #include "mojo/services/package_manager/package_manager.h"
13 #include "mojo/shell/public/cpp/shell_connection.h"
14
15 namespace mojo {
16 const size_t kMaxBlockingPoolThreads = 3;
17
18 MojoResult Run(MojoHandle shell_handle) {
19 scoped_ptr<base::AtExitManager> at_exit;
20 if (!base::CommandLine::InitializedForCurrentProcess() ||
21 !base::CommandLine::ForCurrentProcess()->HasSwitch("single-process")) {
22 at_exit.reset(new base::AtExitManager);
23 }
24
25 {
26 scoped_ptr<base::MessageLoop> loop(
27 new base::MessageLoop(common::MessagePumpMojo::Create()));
28 scoped_refptr<base::SequencedWorkerPool> blocking_pool(
29 new base::SequencedWorkerPool(kMaxBlockingPoolThreads,
30 "blocking_pool"));
31 scoped_ptr<mojo::ShellClient> shell_client(
32 new package_manager::PackageManager(blocking_pool.get(), nullptr));
33 mojo::ShellConnection connection(
34 shell_client.get(), MakeRequest<mojo::shell::mojom::ShellClient>(
35 MakeScopedHandle(MessagePipeHandle(shell_handle))));
36 loop->Run();
37 blocking_pool->Shutdown();
38 loop.reset();
39 shell_client.reset();
40 }
41 return MOJO_RESULT_OK;
42 }
43
44 } // namespace mojo
45
46 MojoResult MojoMain(MojoHandle shell_handle) {
47 return mojo::Run(shell_handle);
48 }
OLDNEW
« no previous file with comments | « mojo/services/package_manager/loader.cc ('k') | mojo/services/package_manager/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698