| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/render_process_impl.h" | 5 #include "content/renderer/render_process_impl.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 const base::Feature kV8SerializeAgeCodeFeature{ | 63 const base::Feature kV8SerializeAgeCodeFeature{ |
| 64 "V8_Serialize_Age_Code", base::FEATURE_DISABLED_BY_DEFAULT}; | 64 "V8_Serialize_Age_Code", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 65 | 65 |
| 66 void SetV8FlagIfFeature(const base::Feature& feature, const char* v8_flag) { | 66 void SetV8FlagIfFeature(const base::Feature& feature, const char* v8_flag) { |
| 67 if (base::FeatureList::IsEnabled(feature)) { | 67 if (base::FeatureList::IsEnabled(feature)) { |
| 68 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); | 68 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 void SetV8FlagIfNotFeature(const base::Feature& feature, const char* v8_flag) { |
| 73 if (!base::FeatureList::IsEnabled(feature)) { |
| 74 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); |
| 75 } |
| 76 } |
| 77 |
| 72 void SetV8FlagIfHasSwitch(const char* switch_name, const char* v8_flag) { | 78 void SetV8FlagIfHasSwitch(const char* switch_name, const char* v8_flag) { |
| 73 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) { | 79 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) { |
| 74 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); | 80 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); |
| 75 } | 81 } |
| 76 } | 82 } |
| 77 | 83 |
| 78 std::vector<base::SchedulerWorkerPoolParams> | 84 std::vector<base::SchedulerWorkerPoolParams> |
| 79 GetDefaultSchedulerWorkerPoolParams() { | 85 GetDefaultSchedulerWorkerPoolParams() { |
| 80 using StandbyThreadPolicy = | 86 using StandbyThreadPolicy = |
| 81 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; | 87 base::SchedulerWorkerPoolParams::StandbyThreadPolicy; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 170 |
| 165 SetV8FlagIfFeature(kV8_ES2015_TailCalls_Feature, "--harmony-tailcalls"); | 171 SetV8FlagIfFeature(kV8_ES2015_TailCalls_Feature, "--harmony-tailcalls"); |
| 166 SetV8FlagIfFeature(kV8_ES2016_ExplicitTailCalls_Feature, | 172 SetV8FlagIfFeature(kV8_ES2016_ExplicitTailCalls_Feature, |
| 167 "--harmony-explicit-tailcalls"); | 173 "--harmony-explicit-tailcalls"); |
| 168 SetV8FlagIfFeature(kV8SerializeEagerFeature, "--serialize_eager"); | 174 SetV8FlagIfFeature(kV8SerializeEagerFeature, "--serialize_eager"); |
| 169 SetV8FlagIfFeature(kV8SerializeAgeCodeFeature, "--serialize_age_code"); | 175 SetV8FlagIfFeature(kV8SerializeAgeCodeFeature, "--serialize_age_code"); |
| 170 SetV8FlagIfHasSwitch(switches::kDisableJavaScriptHarmonyShipping, | 176 SetV8FlagIfHasSwitch(switches::kDisableJavaScriptHarmonyShipping, |
| 171 "--noharmony-shipping"); | 177 "--noharmony-shipping"); |
| 172 SetV8FlagIfHasSwitch(switches::kJavaScriptHarmony, "--harmony"); | 178 SetV8FlagIfHasSwitch(switches::kJavaScriptHarmony, "--harmony"); |
| 173 SetV8FlagIfFeature(features::kAsmJsToWebAssembly, "--validate-asm"); | 179 SetV8FlagIfFeature(features::kAsmJsToWebAssembly, "--validate-asm"); |
| 174 SetV8FlagIfFeature(features::kWebAssembly, "--expose-wasm"); | 180 SetV8FlagIfNotFeature(features::kWebAssembly, |
| 181 "--wasm-disable-structured-cloning"); |
| 175 SetV8FlagIfFeature(features::kSharedArrayBuffer, | 182 SetV8FlagIfFeature(features::kSharedArrayBuffer, |
| 176 "--harmony-sharedarraybuffer"); | 183 "--harmony-sharedarraybuffer"); |
| 177 | 184 |
| 178 const base::CommandLine& command_line = | 185 const base::CommandLine& command_line = |
| 179 *base::CommandLine::ForCurrentProcess(); | 186 *base::CommandLine::ForCurrentProcess(); |
| 180 | 187 |
| 181 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { | 188 if (command_line.HasSwitch(switches::kJavaScriptFlags)) { |
| 182 std::string flags( | 189 std::string flags( |
| 183 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); | 190 command_line.GetSwitchValueASCII(switches::kJavaScriptFlags)); |
| 184 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); | 191 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 index_to_traits_callback = | 225 index_to_traits_callback = |
| 219 base::Bind(&DefaultRendererWorkerPoolIndexForTraits); | 226 base::Bind(&DefaultRendererWorkerPoolIndexForTraits); |
| 220 } | 227 } |
| 221 DCHECK(index_to_traits_callback); | 228 DCHECK(index_to_traits_callback); |
| 222 | 229 |
| 223 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( | 230 base::TaskScheduler::CreateAndSetDefaultTaskScheduler( |
| 224 params_vector, index_to_traits_callback); | 231 params_vector, index_to_traits_callback); |
| 225 } | 232 } |
| 226 | 233 |
| 227 } // namespace content | 234 } // namespace content |
| OLD | NEW |