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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/i18n/icu_util.h" | 9 #include "base/i18n/icu_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 void Run(base::WeakPtr<Runner> runner, const base::FilePath& path) { | 27 void Run(base::WeakPtr<Runner> runner, const base::FilePath& path) { |
28 if (!runner) | 28 if (!runner) |
29 return; | 29 return; |
30 Runner::Scope scope(runner.get()); | 30 Runner::Scope scope(runner.get()); |
31 runner->Run(Load(path), path.AsUTF8Unsafe()); | 31 runner->Run(Load(path), path.AsUTF8Unsafe()); |
32 } | 32 } |
33 | 33 |
34 std::vector<base::FilePath> GetModuleSearchPaths() { | 34 std::vector<base::FilePath> GetModuleSearchPaths() { |
35 std::vector<base::FilePath> module_base(1); | 35 std::vector<base::FilePath> module_base(1); |
36 CHECK(file_util::GetCurrentDirectory(&module_base[0])); | 36 CHECK(base::GetCurrentDirectory(&module_base[0])); |
37 return module_base; | 37 return module_base; |
38 } | 38 } |
39 | 39 |
40 class ShellRunnerDelegate : public ModuleRunnerDelegate { | 40 class ShellRunnerDelegate : public ModuleRunnerDelegate { |
41 public: | 41 public: |
42 ShellRunnerDelegate() : ModuleRunnerDelegate(GetModuleSearchPaths()) { | 42 ShellRunnerDelegate() : ModuleRunnerDelegate(GetModuleSearchPaths()) { |
43 AddBuiltinModule(Console::kModuleName, Console::GetModule); | 43 AddBuiltinModule(Console::kModuleName, Console::GetModule); |
44 } | 44 } |
45 | 45 |
46 virtual void UnhandledException(ShellRunner* runner, | 46 virtual void UnhandledException(ShellRunner* runner, |
(...skipping 29 matching lines...) Expand all Loading... |
76 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); | 76 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); |
77 for (CommandLine::StringVector::const_iterator it = args.begin(); | 77 for (CommandLine::StringVector::const_iterator it = args.begin(); |
78 it != args.end(); ++it) { | 78 it != args.end(); ++it) { |
79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
80 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); | 80 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); |
81 } | 81 } |
82 | 82 |
83 message_loop.RunUntilIdle(); | 83 message_loop.RunUntilIdle(); |
84 return 0; | 84 return 0; |
85 } | 85 } |
OLD | NEW |