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