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