| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/base_switches.h" | 13 #include "base/base_switches.h" |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 16 #include "base/feature_list.h" |
| 16 #include "base/files/file_util.h" | 17 #include "base/files/file_util.h" |
| 17 #include "base/location.h" | 18 #include "base/location.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 20 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
| 21 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
| 22 #include "base/metrics/statistics_recorder.h" | 23 #include "base/metrics/statistics_recorder.h" |
| 23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| 24 #include "base/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
| 25 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 227 |
| 227 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); | 228 DISALLOW_COPY_AND_ASSIGN(ResourceUsageReporterImpl); |
| 228 }; | 229 }; |
| 229 | 230 |
| 230 void CreateResourceUsageReporter( | 231 void CreateResourceUsageReporter( |
| 231 base::WeakPtr<ChromeRenderProcessObserver> observer, | 232 base::WeakPtr<ChromeRenderProcessObserver> observer, |
| 232 mojo::InterfaceRequest<ResourceUsageReporter> request) { | 233 mojo::InterfaceRequest<ResourceUsageReporter> request) { |
| 233 new ResourceUsageReporterImpl(observer, std::move(request)); | 234 new ResourceUsageReporterImpl(observer, std::move(request)); |
| 234 } | 235 } |
| 235 | 236 |
| 237 const base::Feature kV8_ES2015_TailCalls_Feature { |
| 238 "V8_ES2015_TailCalls", base::FEATURE_DISABLED_BY_DEFAULT |
| 239 }; |
| 240 |
| 236 } // namespace | 241 } // namespace |
| 237 | 242 |
| 238 bool ChromeRenderProcessObserver::is_incognito_process_ = false; | 243 bool ChromeRenderProcessObserver::is_incognito_process_ = false; |
| 239 | 244 |
| 240 ChromeRenderProcessObserver::ChromeRenderProcessObserver() | 245 ChromeRenderProcessObserver::ChromeRenderProcessObserver() |
| 241 : weak_factory_(this) { | 246 : weak_factory_(this) { |
| 242 const base::CommandLine& command_line = | 247 const base::CommandLine& command_line = |
| 243 *base::CommandLine::ForCurrentProcess(); | 248 *base::CommandLine::ForCurrentProcess(); |
| 244 | 249 |
| 245 #if defined(ENABLE_AUTOFILL_DIALOG) | 250 #if defined(ENABLE_AUTOFILL_DIALOG) |
| 246 WebRuntimeFeatures::enableRequestAutocomplete(true); | 251 WebRuntimeFeatures::enableRequestAutocomplete(true); |
| 247 #endif | 252 #endif |
| 248 | 253 |
| 254 if (base::FeatureList::IsEnabled(kV8_ES2015_TailCalls_Feature)) { |
| 255 std::string flag("--harmony-tailcalls"); |
| 256 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); |
| 257 } |
| 258 |
| 249 if (command_line.HasSwitch(switches::kDisableJavaScriptHarmonyShipping)) { | 259 if (command_line.HasSwitch(switches::kDisableJavaScriptHarmonyShipping)) { |
| 250 std::string flag("--noharmony-shipping"); | 260 std::string flag("--noharmony-shipping"); |
| 251 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | 261 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); |
| 252 } | 262 } |
| 253 | 263 |
| 254 if (command_line.HasSwitch(switches::kJavaScriptHarmony)) { | 264 if (command_line.HasSwitch(switches::kJavaScriptHarmony)) { |
| 255 std::string flag("--harmony"); | 265 std::string flag("--harmony"); |
| 256 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); | 266 v8::V8::SetFlagsFromString(flag.c_str(), static_cast<int>(flag.size())); |
| 257 } | 267 } |
| 258 | 268 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ChromeRenderProcessObserver::content_setting_rules() const { | 393 ChromeRenderProcessObserver::content_setting_rules() const { |
| 384 return &content_setting_rules_; | 394 return &content_setting_rules_; |
| 385 } | 395 } |
| 386 | 396 |
| 387 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( | 397 void ChromeRenderProcessObserver::OnFieldTrialGroupFinalized( |
| 388 const std::string& trial_name, | 398 const std::string& trial_name, |
| 389 const std::string& group_name) { | 399 const std::string& group_name) { |
| 390 content::RenderThread::Get()->Send( | 400 content::RenderThread::Get()->Send( |
| 391 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); | 401 new ChromeViewHostMsg_FieldTrialActivated(trial_name)); |
| 392 } | 402 } |
| OLD | NEW |