| 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/files/file_util.h" | 8 #include "base/files/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" |
| 11 #include "gin/array_buffer.h" |
| 11 #include "gin/modules/console.h" | 12 #include "gin/modules/console.h" |
| 12 #include "gin/modules/module_runner_delegate.h" | 13 #include "gin/modules/module_runner_delegate.h" |
| 13 #include "gin/public/isolate_holder.h" | 14 #include "gin/public/isolate_holder.h" |
| 14 #include "gin/test/file_runner.h" | 15 #include "gin/test/file_runner.h" |
| 15 #include "gin/try_catch.h" | 16 #include "gin/try_catch.h" |
| 16 | 17 |
| 17 namespace gin { | 18 namespace gin { |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 std::string Load(const base::FilePath& path) { | 21 std::string Load(const base::FilePath& path) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 } // namespace | 57 } // namespace |
| 57 } // namespace gin | 58 } // namespace gin |
| 58 | 59 |
| 59 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
| 60 base::AtExitManager at_exit; | 61 base::AtExitManager at_exit; |
| 61 CommandLine::Init(argc, argv); | 62 CommandLine::Init(argc, argv); |
| 62 base::i18n::InitializeICU(); | 63 base::i18n::InitializeICU(); |
| 63 | 64 |
| 64 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); | 65 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 66 gin::ArrayBufferAllocator::SharedInstance()); |
| 67 gin::IsolateHolder instance; |
| 65 | 68 |
| 66 base::MessageLoop message_loop; | 69 base::MessageLoop message_loop; |
| 67 | 70 |
| 68 gin::GinShellRunnerDelegate delegate; | 71 gin::GinShellRunnerDelegate delegate; |
| 69 gin::ShellRunner runner(&delegate, instance.isolate()); | 72 gin::ShellRunner runner(&delegate, instance.isolate()); |
| 70 | 73 |
| 71 { | 74 { |
| 72 gin::Runner::Scope scope(&runner); | 75 gin::Runner::Scope scope(&runner); |
| 73 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); | 76 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); |
| 74 } | 77 } |
| 75 | 78 |
| 76 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); | 79 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); |
| 77 for (CommandLine::StringVector::const_iterator it = args.begin(); | 80 for (CommandLine::StringVector::const_iterator it = args.begin(); |
| 78 it != args.end(); ++it) { | 81 it != args.end(); ++it) { |
| 79 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 82 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
| 80 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); | 83 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); |
| 81 } | 84 } |
| 82 | 85 |
| 83 message_loop.RunUntilIdle(); | 86 message_loop.RunUntilIdle(); |
| 84 return 0; | 87 return 0; |
| 85 } | 88 } |
| OLD | NEW |