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/feature_list.h" | 8 #include "base/feature_list.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
13 #include "gin/array_buffer.h" | 14 #include "gin/array_buffer.h" |
14 #include "gin/modules/console.h" | 15 #include "gin/modules/console.h" |
15 #include "gin/modules/module_runner_delegate.h" | 16 #include "gin/modules/module_runner_delegate.h" |
16 #include "gin/public/isolate_holder.h" | 17 #include "gin/public/isolate_holder.h" |
17 #include "gin/try_catch.h" | 18 #include "gin/try_catch.h" |
18 #include "gin/v8_initializer.h" | 19 #include "gin/v8_initializer.h" |
19 | 20 |
20 namespace gin { | 21 namespace gin { |
21 namespace { | 22 namespace { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 base::CommandLine::Init(argc, argv); | 64 base::CommandLine::Init(argc, argv); |
64 base::i18n::InitializeICU(); | 65 base::i18n::InitializeICU(); |
65 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 66 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
66 gin::V8Initializer::LoadV8Snapshot(); | 67 gin::V8Initializer::LoadV8Snapshot(); |
67 gin::V8Initializer::LoadV8Natives(); | 68 gin::V8Initializer::LoadV8Natives(); |
68 #endif | 69 #endif |
69 | 70 |
70 base::MessageLoop message_loop; | 71 base::MessageLoop message_loop; |
71 | 72 |
72 // Initialize the base::FeatureList since IsolateHolder can depend on it. | 73 // Initialize the base::FeatureList since IsolateHolder can depend on it. |
73 base::FeatureList::SetInstance(make_scoped_ptr(new base::FeatureList)); | 74 base::FeatureList::SetInstance(base::WrapUnique(new base::FeatureList)); |
74 | 75 |
75 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 76 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
76 gin::IsolateHolder::kStableV8Extras, | 77 gin::IsolateHolder::kStableV8Extras, |
77 gin::ArrayBufferAllocator::SharedInstance()); | 78 gin::ArrayBufferAllocator::SharedInstance()); |
78 gin::IsolateHolder instance; | 79 gin::IsolateHolder instance; |
79 | 80 |
80 | 81 |
81 gin::GinShellRunnerDelegate delegate; | 82 gin::GinShellRunnerDelegate delegate; |
82 gin::ShellRunner runner(&delegate, instance.isolate()); | 83 gin::ShellRunner runner(&delegate, instance.isolate()); |
83 | 84 |
84 { | 85 { |
85 gin::Runner::Scope scope(&runner); | 86 gin::Runner::Scope scope(&runner); |
86 runner.GetContextHolder() | 87 runner.GetContextHolder() |
87 ->isolate() | 88 ->isolate() |
88 ->SetCaptureStackTraceForUncaughtExceptions(true); | 89 ->SetCaptureStackTraceForUncaughtExceptions(true); |
89 } | 90 } |
90 | 91 |
91 base::CommandLine::StringVector args = | 92 base::CommandLine::StringVector args = |
92 base::CommandLine::ForCurrentProcess()->GetArgs(); | 93 base::CommandLine::ForCurrentProcess()->GetArgs(); |
93 for (base::CommandLine::StringVector::const_iterator it = args.begin(); | 94 for (base::CommandLine::StringVector::const_iterator it = args.begin(); |
94 it != args.end(); ++it) { | 95 it != args.end(); ++it) { |
95 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( | 96 base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( |
96 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); | 97 gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); |
97 } | 98 } |
98 | 99 |
99 message_loop.RunUntilIdle(); | 100 message_loop.RunUntilIdle(); |
100 return 0; | 101 return 0; |
101 } | 102 } |
OLD | NEW |