| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/common/content_switches_internal.h" | 5 #include "content/common/content_switches_internal.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 return V8_CACHE_OPTIONS_NONE; | 60 return V8_CACHE_OPTIONS_NONE; |
| 61 } else if (v8_cache_options == "parse") { | 61 } else if (v8_cache_options == "parse") { |
| 62 return V8_CACHE_OPTIONS_PARSE; | 62 return V8_CACHE_OPTIONS_PARSE; |
| 63 } else if (v8_cache_options == "code") { | 63 } else if (v8_cache_options == "code") { |
| 64 return V8_CACHE_OPTIONS_CODE; | 64 return V8_CACHE_OPTIONS_CODE; |
| 65 } else { | 65 } else { |
| 66 return V8_CACHE_OPTIONS_DEFAULT; | 66 return V8_CACHE_OPTIONS_DEFAULT; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 V8CacheStrategiesForCacheStorage GetV8CacheStrategiesForCacheStorage() { |
| 71 const base::CommandLine& command_line = |
| 72 *base::CommandLine::ForCurrentProcess(); |
| 73 std::string v8_cache_strategies = command_line.GetSwitchValueASCII( |
| 74 switches::kV8CacheStrategiesForCacheStorage); |
| 75 if (v8_cache_strategies.empty()) |
| 76 v8_cache_strategies = |
| 77 base::FieldTrialList::FindFullName("V8CacheStrategiesForCacheStorage"); |
| 78 if (v8_cache_strategies == "none") { |
| 79 return V8_CACHE_STRATEGIES_FOR_CACHE_STORAGE_NONE; |
| 80 } else if (v8_cache_strategies == "normal") { |
| 81 return V8_CACHE_STRATEGIES_FOR_CACHE_STORAGE_NORMAL; |
| 82 } else if (v8_cache_strategies == "aggressive") { |
| 83 return V8_CACHE_STRATEGIES_FOR_CACHE_STORAGE_AGGRESSIVE; |
| 84 } else { |
| 85 return V8_CACHE_STRATEGIES_FOR_CACHE_STORAGE_DEFAULT; |
| 86 } |
| 87 } |
| 88 |
| 70 bool IsUseZoomForDSFEnabled() { | 89 bool IsUseZoomForDSFEnabled() { |
| 71 static bool use_zoom_for_dsf_enabled_by_default = | 90 static bool use_zoom_for_dsf_enabled_by_default = |
| 72 IsUseZoomForDSFEnabledByDefault(); | 91 IsUseZoomForDSFEnabledByDefault(); |
| 73 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 92 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 74 bool enabled = | 93 bool enabled = |
| 75 (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || | 94 (command_line->HasSwitch(switches::kEnableUseZoomForDSF) || |
| 76 use_zoom_for_dsf_enabled_by_default) && | 95 use_zoom_for_dsf_enabled_by_default) && |
| 77 command_line->GetSwitchValueASCII( | 96 command_line->GetSwitchValueASCII( |
| 78 switches::kEnableUseZoomForDSF) != "false"; | 97 switches::kEnableUseZoomForDSF) != "false"; |
| 79 | 98 |
| 80 return enabled; | 99 return enabled; |
| 81 } | 100 } |
| 82 | 101 |
| 83 } // namespace content | 102 } // namespace content |
| OLD | NEW |