Chromium Code Reviews| 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 "chrome/renderer/chrome_render_process_observer.h" | 5 #include "chrome/renderer/chrome_render_process_observer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 void CreateResourceUsageReporter( | 232 void CreateResourceUsageReporter( |
| 233 base::WeakPtr<ChromeRenderProcessObserver> observer, | 233 base::WeakPtr<ChromeRenderProcessObserver> observer, |
| 234 mojo::InterfaceRequest<mojom::ResourceUsageReporter> request) { | 234 mojo::InterfaceRequest<mojom::ResourceUsageReporter> request) { |
| 235 new ResourceUsageReporterImpl(observer, std::move(request)); | 235 new ResourceUsageReporterImpl(observer, std::move(request)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 const base::Feature kV8_ES2015_TailCalls_Feature { | 238 const base::Feature kV8_ES2015_TailCalls_Feature { |
| 239 "V8_ES2015_TailCalls", base::FEATURE_DISABLED_BY_DEFAULT | 239 "V8_ES2015_TailCalls", base::FEATURE_DISABLED_BY_DEFAULT |
| 240 }; | 240 }; |
| 241 | 241 |
| 242 const base::Feature kV8SerializeEagerFeature{"V8_Serialize_Eager", | |
|
vogelheim
2016/04/06 12:57:43
This doesn't look right, but this is what "git cl
jochen (gone - plz use gerrit)
2016/04/06 13:00:56
can you file a bug (go/clang-format-bug)
vogelheim
2016/04/06 13:44:00
- This is intentional on clang-format's part. (b/2
| |
| 243 base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 244 | |
| 245 const base::Feature kV8SerializeAgeCodeFeature{ | |
| 246 "V8_Serialize_Age_Code", base::FEATURE_DISABLED_BY_DEFAULT}; | |
| 247 | |
| 248 void SetV8FlagIfFeature(const base::Feature& feature, const char* v8_flag) { | |
| 249 if (base::FeatureList::IsEnabled(feature)) { | |
| 250 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); | |
| 251 } | |
| 252 } | |
| 253 | |
| 254 void SetV8FlagIfHasSwitch(const char* switch_name, const char* v8_flag) { | |
| 255 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switch_name)) { | |
| 256 v8::V8::SetFlagsFromString(v8_flag, strlen(v8_flag)); | |
| 257 } | |
| 258 } | |
| 259 | |
| 242 } // namespace | 260 } // namespace |
| 243 | 261 |
| 244 bool ChromeRenderProcessObserver::is_incognito_process_ = false; | 262 bool ChromeRenderProcessObserver::is_incognito_process_ = false; |
| 245 | 263 |
| 246 ChromeRenderProcessObserver::ChromeRenderProcessObserver() | 264 ChromeRenderProcessObserver::ChromeRenderProcessObserver() |
| 247 : weak_factory_(this) { | 265 : weak_factory_(this) { |
| 248 const base::CommandLine& command_line = | 266 const base::CommandLine& command_line = |
| 249 *base::CommandLine::ForCurrentProcess(); | 267 *base::CommandLine::ForCurrentProcess(); |
| 250 | 268 |
| 251 #if defined(ENABLE_AUTOFILL_DIALOG) | 269 #if defined(ENABLE_AUTOFILL_DIALOG) |
| 252 WebRuntimeFeatures::enableRequestAutocomplete(true); | 270 WebRuntimeFeatures::enableRequestAutocomplete(true); |
| 253 #endif | 271 #endif |
| 254 | 272 |
| 255 if (base::FeatureList::IsEnabled(kV8_ES2015_TailCalls_Feature)) { | 273 SetV8FlagIfFeature(kV8_ES2015_TailCalls_Feature, "--harmony-tailcalls"); |
| 256 std::string flag("--harmony-tailcalls"); | 274 SetV8FlagIfFeature(kV8SerializeEagerFeature, "--serialize_eager"); |
| 257 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | 275 SetV8FlagIfFeature(kV8SerializeAgeCodeFeature, "--serialize_age_code"); |
| 258 } | 276 SetV8FlagIfHasSwitch(switches::kDisableJavaScriptHarmonyShipping, |
| 259 | 277 "--noharmony-shipping"); |
| 260 if (command_line.HasSwitch(switches::kDisableJavaScriptHarmonyShipping)) { | 278 SetV8FlagIfHasSwitch(switches::kJavaScriptHarmony, "--harmony"); |
| 261 std::string flag("--noharmony-shipping"); | 279 SetV8FlagIfHasSwitch(switches::kEnableWasm, "--expose-wasm"); |
| 262 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | |
| 263 } | |
| 264 | |
| 265 if (command_line.HasSwitch(switches::kJavaScriptHarmony)) { | |
| 266 std::string flag("--harmony"); | |
| 267 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | |
| 268 } | |
| 269 | |
| 270 if (command_line.HasSwitch(switches::kEnableWasm)) { | |
| 271 std::string flag("--expose-wasm"); | |
| 272 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | |
| 273 } | |
| 274 | 280 |
| 275 RenderThread* thread = RenderThread::Get(); | 281 RenderThread* thread = RenderThread::Get(); |
| 276 resource_delegate_.reset(new RendererResourceDelegate()); | 282 resource_delegate_.reset(new RendererResourceDelegate()); |
| 277 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); | 283 thread->SetResourceDispatcherDelegate(resource_delegate_.get()); |
| 278 | 284 |
| 279 thread->GetServiceRegistry()->AddService( | 285 thread->GetServiceRegistry()->AddService( |
| 280 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); | 286 base::Bind(CreateResourceUsageReporter, weak_factory_.GetWeakPtr())); |
| 281 | 287 |
| 282 // Configure modules that need access to resources. | 288 // Configure modules that need access to resources. |
| 283 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); | 289 net::NetModule::SetResourceProvider(chrome_common_net::NetResourceProvider); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 394 ChromeRenderProcessObserver::content_setting_rules() const { | 400 ChromeRenderProcessObserver::content_setting_rules() const { |
| 395 return &content_setting_rules_; | 401 return &content_setting_rules_; |
| 396 } | 402 } |
| 397 | 403 |
| 398 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( | 404 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( |
| 399 const std::string& trial_name, | 405 const std::string& trial_name, |
| 400 const std::string& group_name) { | 406 const std::string& group_name) { |
| 401 content::RenderThread::Get()->Send( | 407 content::RenderThread::Get()->Send( |
| 402 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); | 408 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
| 403 } | 409 } |
| OLD | NEW |