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> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
9 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
10 | 12 |
11 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
12 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
13 #include "ui/gfx/win/direct_write.h" | 15 #include "ui/gfx/win/direct_write.h" |
14 #endif | 16 #endif |
15 | 17 |
16 namespace content { | 18 namespace content { |
(...skipping 28 matching lines...) Expand all Loading... |
45 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 47 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
46 if (cmd_line->HasSwitch(switches::kEnableWin32kRendererLockDown)) | 48 if (cmd_line->HasSwitch(switches::kEnableWin32kRendererLockDown)) |
47 return true; | 49 return true; |
48 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) | 50 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) |
49 return false; | 51 return false; |
50 // Default. | 52 // Default. |
51 return group_name == "Enabled"; | 53 return group_name == "Enabled"; |
52 } | 54 } |
53 #endif | 55 #endif |
54 | 56 |
| 57 V8CacheOptions GetV8CacheOptions() { |
| 58 const base::CommandLine& command_line = |
| 59 *base::CommandLine::ForCurrentProcess(); |
| 60 std::string v8_cache_options = |
| 61 command_line.GetSwitchValueASCII(switches::kV8CacheOptions); |
| 62 if (v8_cache_options.empty()) |
| 63 v8_cache_options = base::FieldTrialList::FindFullName("V8CacheOptions"); |
| 64 if (v8_cache_options == "parse") { |
| 65 return V8_CACHE_OPTIONS_PARSE; |
| 66 } else if (v8_cache_options == "code") { |
| 67 return V8_CACHE_OPTIONS_CODE; |
| 68 } else if (v8_cache_options == "code-compressed") { |
| 69 return V8_CACHE_OPTIONS_CODE_COMPRESSED; |
| 70 } else if (v8_cache_options == "none") { |
| 71 return V8_CACHE_OPTIONS_NONE; |
| 72 } else if (v8_cache_options == "parse-memory") { |
| 73 return V8_CACHE_OPTIONS_PARSE_MEMORY; |
| 74 } else if (v8_cache_options == "heuristics") { |
| 75 return V8_CACHE_OPTIONS_HEURISTICS; |
| 76 } else if (v8_cache_options == "heuristics-mobile") { |
| 77 return V8_CACHE_OPTIONS_HEURISTICS_MOBILE; |
| 78 } else if (v8_cache_options == "heuristics-default") { |
| 79 return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT; |
| 80 } else if (v8_cache_options == "heuristics-default-mobile") { |
| 81 return V8_CACHE_OPTIONS_HEURISTICS_DEFAULT_MOBILE; |
| 82 } else if (v8_cache_options == "recent") { |
| 83 return V8_CACHE_OPTIONS_RECENT; |
| 84 } else if (v8_cache_options == "recent-small") { |
| 85 return V8_CACHE_OPTIONS_RECENT_SMALL; |
| 86 } else { |
| 87 return V8_CACHE_OPTIONS_DEFAULT; |
| 88 } |
| 89 } |
| 90 |
55 } // namespace content | 91 } // namespace content |
OLD | NEW |