| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(GinShellRunnerDelegate); | 52 DISALLOW_COPY_AND_ASSIGN(GinShellRunnerDelegate); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 } // namespace gin | 56 } // namespace gin |
| 57 | 57 |
| 58 int main(int argc, char** argv) { | 58 int main(int argc, char** argv) { |
| 59 base::AtExitManager at_exit; | 59 base::AtExitManager at_exit; |
| 60 CommandLine::Init(argc, argv); | 60 base::CommandLine::Init(argc, argv); |
| 61 base::i18n::InitializeICU(); | 61 base::i18n::InitializeICU(); |
| 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 63 gin::IsolateHolder::LoadV8Snapshot(); | 63 gin::IsolateHolder::LoadV8Snapshot(); |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 66 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
| 67 gin::ArrayBufferAllocator::SharedInstance()); | 67 gin::ArrayBufferAllocator::SharedInstance()); |
| 68 gin::IsolateHolder instance; | 68 gin::IsolateHolder instance; |
| 69 | 69 |
| 70 base::MessageLoop message_loop; | 70 base::MessageLoop message_loop; |
| 71 | 71 |
| 72 gin::GinShellRunnerDelegate delegate; | 72 gin::GinShellRunnerDelegate delegate; |
| 73 gin::ShellRunner runner(&delegate, instance.isolate()); | 73 gin::ShellRunner runner(&delegate, instance.isolate()); |
| 74 | 74 |
| 75 { | 75 { |
| 76 gin::Runner::Scope scope(&runner); | 76 gin::Runner::Scope scope(&runner); |
| 77 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); | 77 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); |
| 78 } | 78 } |
| 79 | 79 |
| 80 CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); | 80 base::CommandLine::StringVector args = |
| 81 for (CommandLine::StringVector::const_iterator it = args.begin(); | 81 base::CommandLine::ForCurrentProcess()->GetArgs(); |
| 82 for (base::CommandLine::StringVector::const_iterator it = args.begin(); |
| 82 it != args.end(); ++it) { | 83 it != args.end(); ++it) { |
| 83 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 84 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
| 84 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); | 85 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); |
| 85 } | 86 } |
| 86 | 87 |
| 87 message_loop.RunUntilIdle(); | 88 message_loop.RunUntilIdle(); |
| 88 return 0; | 89 return 0; |
| 89 } | 90 } |
| OLD | NEW |