OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stdio.h> | 5 #include <stdio.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <iostream> | 9 #include <iostream> |
10 | 10 |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/threading/platform_thread.h" |
18 #include "mojo/runner/context.h" | 19 #include "mojo/runner/context.h" |
19 #include "mojo/runner/switches.h" | 20 #include "mojo/runner/switches.h" |
20 #include "mojo/shell/switches.h" | 21 #include "mojo/shell/switches.h" |
21 | 22 |
22 namespace mojo { | 23 namespace mojo { |
23 namespace runner { | 24 namespace runner { |
24 | 25 |
25 int LauncherProcessMain(const GURL& mojo_url, const base::Closure& callback) { | 26 int LauncherProcessMain(const GURL& mojo_url, const base::Closure& callback) { |
26 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 27 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
27 if (!command_line->HasSwitch(switches::kMojoSingleProcess) && | 28 if (!command_line->HasSwitch(switches::kMojoSingleProcess) && |
28 !command_line->HasSwitch("gtest_list_tests")) | 29 !command_line->HasSwitch("gtest_list_tests")) |
29 command_line->AppendSwitch(switches::kEnableMultiprocess); | 30 command_line->AppendSwitch(switches::kEnableMultiprocess); |
30 command_line->AppendSwitch("use-new-edk"); | 31 command_line->AppendSwitch("use-new-edk"); |
31 // http://crbug.com/546644 | 32 // http://crbug.com/546644 |
32 command_line->AppendSwitch(switches::kMojoNoSandbox); | 33 command_line->AppendSwitch(switches::kMojoNoSandbox); |
33 | 34 |
| 35 base::PlatformThread::SetName("mojo_runner"); |
| 36 |
34 // We want the shell::Context to outlive the MessageLoop so that pipes are | 37 // We want the shell::Context to outlive the MessageLoop so that pipes are |
35 // all gracefully closed / error-out before we try to shut the Context down. | 38 // all gracefully closed / error-out before we try to shut the Context down. |
36 Context shell_context; | 39 Context shell_context; |
37 { | 40 { |
38 base::MessageLoop message_loop; | 41 base::MessageLoop message_loop; |
39 base::FilePath shell_dir; | 42 base::FilePath shell_dir; |
40 PathService::Get(base::DIR_MODULE, &shell_dir); | 43 PathService::Get(base::DIR_MODULE, &shell_dir); |
41 if (!shell_context.Init(shell_dir)) | 44 if (!shell_context.Init(shell_dir)) |
42 return 0; | 45 return 0; |
43 | 46 |
(...skipping 12 matching lines...) Expand all Loading... |
56 | 59 |
57 // Must be called before |message_loop| is destroyed. | 60 // Must be called before |message_loop| is destroyed. |
58 shell_context.Shutdown(); | 61 shell_context.Shutdown(); |
59 } | 62 } |
60 | 63 |
61 return 0; | 64 return 0; |
62 } | 65 } |
63 | 66 |
64 } // namespace runner | 67 } // namespace runner |
65 } // namespace mojo | 68 } // namespace mojo |
OLD | NEW |