OLD | NEW |
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 "mandoline/app/desktop/launcher_process.h" |
| 6 |
5 #include <stdio.h> | 7 #include <stdio.h> |
6 #include <string.h> | 8 #include <string.h> |
7 | 9 |
8 #include <algorithm> | 10 #include <algorithm> |
9 #include <iostream> | 11 #include <iostream> |
10 | 12 |
11 #include "base/base_switches.h" | 13 #include "base/base_switches.h" |
12 #include "base/bind.h" | 14 #include "base/bind.h" |
13 #include "base/command_line.h" | 15 #include "base/command_line.h" |
14 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
15 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
16 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
17 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
18 #include "components/tracing/trace_config_file.h" | 20 #include "components/tracing/trace_config_file.h" |
19 #include "components/tracing/tracing_switches.h" | 21 #include "components/tracing/tracing_switches.h" |
20 #include "mandoline/app/core_services_initialization.h" | 22 #include "mandoline/app/core_services_initialization.h" |
21 #include "mandoline/app/desktop/launcher_process.h" | 23 #include "mandoline/ui/common/mandoline_switches.h" |
22 #include "mojo/runner/context.h" | 24 #include "mojo/runner/context.h" |
23 #include "mojo/runner/switches.h" | 25 #include "mojo/runner/switches.h" |
24 | 26 |
25 namespace mandoline { | 27 namespace mandoline { |
26 namespace { | 28 namespace { |
27 | 29 |
28 // Whether we're currently tracing. | 30 // Whether we're currently tracing. |
29 bool g_tracing = false; | 31 bool g_tracing = false; |
30 | 32 |
31 // Number of tracing blocks written. | 33 // Number of tracing blocks written. |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 base::MessageLoop message_loop; | 107 base::MessageLoop message_loop; |
106 if (!shell_context.Init()) { | 108 if (!shell_context.Init()) { |
107 return 0; | 109 return 0; |
108 } | 110 } |
109 if (g_tracing) { | 111 if (g_tracing) { |
110 message_loop.PostDelayedTask(FROM_HERE, | 112 message_loop.PostDelayedTask(FROM_HERE, |
111 base::Bind(StopTracingAndFlushToDisk), | 113 base::Bind(StopTracingAndFlushToDisk), |
112 base::TimeDelta::FromSeconds(5)); | 114 base::TimeDelta::FromSeconds(5)); |
113 } | 115 } |
114 | 116 |
| 117 bool check_sys_deps = |
| 118 command_line.HasSwitch(switches::kCheckLayoutTestSysDeps); |
| 119 bool run_layout_tests = command_line.HasSwitch(switches::kRunLayoutTest); |
| 120 GURL launch((run_layout_tests || check_sys_deps) ? "mojo:test_runner" |
| 121 : "mojo:desktop_ui"); |
115 message_loop.PostTask(FROM_HERE, | 122 message_loop.PostTask(FROM_HERE, |
116 base::Bind(&mojo::runner::Context::Run, | 123 base::Bind(&mojo::runner::Context::Run, |
117 base::Unretained(&shell_context), | 124 base::Unretained(&shell_context), launch)); |
118 GURL("mojo:desktop_ui"))); | |
119 message_loop.Run(); | 125 message_loop.Run(); |
120 | 126 |
121 // Must be called before |message_loop| is destroyed. | 127 // Must be called before |message_loop| is destroyed. |
122 shell_context.Shutdown(); | 128 shell_context.Shutdown(); |
123 } | 129 } |
124 | 130 |
125 if (g_tracing) | 131 if (g_tracing) |
126 StopTracingAndFlushToDisk(); | 132 StopTracingAndFlushToDisk(); |
127 return 0; | 133 return 0; |
128 } | 134 } |
129 | 135 |
130 } // namespace mandoline | 136 } // namespace mandoline |
OLD | NEW |