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 "mojo/shell/context.h" | 5 #include "mojo/shell/context.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base_switches.h" | |
10 #include "base/bind.h" | 9 #include "base/bind.h" |
11 #include "base/command_line.h" | 10 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
13 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
17 #include "base/path_service.h" | 16 #include "base/path_service.h" |
18 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
19 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 230 |
232 GURL Context::ResolveCommandLineURL(const std::string& path) { | 231 GURL Context::ResolveCommandLineURL(const std::string& path) { |
233 return command_line_cwd_.Resolve(path); | 232 return command_line_cwd_.Resolve(path); |
234 } | 233 } |
235 | 234 |
236 bool Context::Init() { | 235 bool Context::Init() { |
237 TRACE_EVENT0("mojo_shell", "Context::Init"); | 236 TRACE_EVENT0("mojo_shell", "Context::Init"); |
238 const base::CommandLine& command_line = | 237 const base::CommandLine& command_line = |
239 *base::CommandLine::ForCurrentProcess(); | 238 *base::CommandLine::ForCurrentProcess(); |
240 | 239 |
241 if (command_line.HasSwitch(switches::kWaitForDebugger)) | |
242 base::debug::WaitForDebugger(60, true); | |
243 | |
244 EnsureEmbedderIsInitialized(); | 240 EnsureEmbedderIsInitialized(); |
245 task_runners_.reset( | 241 task_runners_.reset( |
246 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); | 242 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); |
247 | 243 |
248 // TODO(vtl): Probably these failures should be checked before |Init()|, and | 244 // TODO(vtl): Probably these failures should be checked before |Init()|, and |
249 // this function simply shouldn't fail. | 245 // this function simply shouldn't fail. |
250 if (!shell_file_root_.is_valid()) | 246 if (!shell_file_root_.is_valid()) |
251 return false; | 247 return false; |
252 if (!ConfigureURLMappings(command_line, this)) | 248 if (!ConfigureURLMappings(command_line, this)) |
253 return false; | 249 return false; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { | 315 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { |
320 DCHECK_EQ(base::MessageLoop::current()->task_runner(), | 316 DCHECK_EQ(base::MessageLoop::current()->task_runner(), |
321 task_runners_->shell_runner()); | 317 task_runners_->shell_runner()); |
322 base::MessageLoop::current()->Quit(); | 318 base::MessageLoop::current()->Quit(); |
323 } | 319 } |
324 } | 320 } |
325 } | 321 } |
326 | 322 |
327 } // namespace shell | 323 } // namespace shell |
328 } // namespace mojo | 324 } // namespace mojo |
OLD | NEW |