OLD | NEW |
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/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "mojo/message_pump/message_pump_mojo.h" | 10 #include "mojo/message_pump/message_pump_mojo.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 at_exit.reset(new base::AtExitManager); | 22 at_exit.reset(new base::AtExitManager); |
23 } | 23 } |
24 | 24 |
25 { | 25 { |
26 scoped_ptr<base::MessageLoop> loop( | 26 scoped_ptr<base::MessageLoop> loop( |
27 new base::MessageLoop(common::MessagePumpMojo::Create())); | 27 new base::MessageLoop(common::MessagePumpMojo::Create())); |
28 scoped_refptr<base::SequencedWorkerPool> blocking_pool( | 28 scoped_refptr<base::SequencedWorkerPool> blocking_pool( |
29 new base::SequencedWorkerPool(kMaxBlockingPoolThreads, | 29 new base::SequencedWorkerPool(kMaxBlockingPoolThreads, |
30 "blocking_pool")); | 30 "blocking_pool")); |
31 scoped_ptr<mojo::ShellClient> shell_client( | 31 scoped_ptr<mojo::ShellClient> shell_client( |
32 new package_manager::PackageManager(blocking_pool.get(), true, | 32 new package_manager::PackageManager(blocking_pool.get(), nullptr)); |
33 nullptr)); | |
34 mojo::ShellConnection connection( | 33 mojo::ShellConnection connection( |
35 shell_client.get(), MakeRequest<mojo::shell::mojom::ShellClient>( | 34 shell_client.get(), MakeRequest<mojo::shell::mojom::ShellClient>( |
36 MakeScopedHandle(MessagePipeHandle(shell_handle)))); | 35 MakeScopedHandle(MessagePipeHandle(shell_handle)))); |
37 loop->Run(); | 36 loop->Run(); |
38 blocking_pool->Shutdown(); | 37 blocking_pool->Shutdown(); |
39 loop.reset(); | 38 loop.reset(); |
40 shell_client.reset(); | 39 shell_client.reset(); |
41 } | 40 } |
42 return MOJO_RESULT_OK; | 41 return MOJO_RESULT_OK; |
43 } | 42 } |
44 | 43 |
45 } // namespace mojo | 44 } // namespace mojo |
46 | 45 |
47 MojoResult MojoMain(MojoHandle shell_handle) { | 46 MojoResult MojoMain(MojoHandle shell_handle) { |
48 return mojo::Run(shell_handle); | 47 return mojo::Run(shell_handle); |
49 } | 48 } |
OLD | NEW |