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" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #endif | 73 #endif |
74 | 74 |
75 base::MessageLoop message_loop; | 75 base::MessageLoop message_loop; |
76 | 76 |
77 // Initialize the base::FeatureList since IsolateHolder can depend on it. | 77 // Initialize the base::FeatureList since IsolateHolder can depend on it. |
78 base::FeatureList::SetInstance(base::WrapUnique(new base::FeatureList)); | 78 base::FeatureList::SetInstance(base::WrapUnique(new base::FeatureList)); |
79 | 79 |
80 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, | 80 gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode, |
81 gin::IsolateHolder::kStableV8Extras, | 81 gin::IsolateHolder::kStableV8Extras, |
82 gin::ArrayBufferAllocator::SharedInstance()); | 82 gin::ArrayBufferAllocator::SharedInstance()); |
83 gin::IsolateHolder instance; | 83 gin::IsolateHolder instance(base::ThreadTaskRunnerHandle::Get()); |
84 | |
85 | 84 |
86 gin::GinShellRunnerDelegate delegate; | 85 gin::GinShellRunnerDelegate delegate; |
87 gin::ShellRunner runner(&delegate, instance.isolate()); | 86 gin::ShellRunner runner(&delegate, instance.isolate()); |
88 | 87 |
89 { | 88 { |
90 gin::Runner::Scope scope(&runner); | 89 gin::Runner::Scope scope(&runner); |
91 runner.GetContextHolder() | 90 runner.GetContextHolder() |
92 ->isolate() | 91 ->isolate() |
93 ->SetCaptureStackTraceForUncaughtExceptions(true); | 92 ->SetCaptureStackTraceForUncaughtExceptions(true); |
94 } | 93 } |
95 | 94 |
96 base::CommandLine::StringVector args = | 95 base::CommandLine::StringVector args = |
97 base::CommandLine::ForCurrentProcess()->GetArgs(); | 96 base::CommandLine::ForCurrentProcess()->GetArgs(); |
98 for (base::CommandLine::StringVector::const_iterator it = args.begin(); | 97 for (base::CommandLine::StringVector::const_iterator it = args.begin(); |
99 it != args.end(); ++it) { | 98 it != args.end(); ++it) { |
100 base::ThreadTaskRunnerHandle::Get()->PostTask( | 99 base::ThreadTaskRunnerHandle::Get()->PostTask( |
101 FROM_HERE, | 100 FROM_HERE, |
102 base::Bind(gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); | 101 base::Bind(gin::Run, runner.GetWeakPtr(), base::FilePath(*it))); |
103 } | 102 } |
104 | 103 |
105 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
106 return 0; | 105 return 0; |
107 } | 106 } |
OLD | NEW |