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