| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #endif | 43 #endif |
| 44 } | 44 } |
| 45 | 45 |
| 46 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 47 | 47 |
| 48 void DisableWin32kRendererLockdown() { | 48 void DisableWin32kRendererLockdown() { |
| 49 g_win32k_renderer_lockdown_disabled = true; | 49 g_win32k_renderer_lockdown_disabled = true; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool IsWin32kRendererLockdownEnabled() { | 52 bool IsWin32kRendererLockdownEnabled() { |
| 53 const std::string group_name = | |
| 54 base::FieldTrialList::FindFullName("Win32kLockdown"); | |
| 55 if (g_win32k_renderer_lockdown_disabled) | 53 if (g_win32k_renderer_lockdown_disabled) |
| 56 return false; | 54 return false; |
| 57 if (base::win::GetVersion() < base::win::VERSION_WIN8) | 55 if (base::win::GetVersion() < base::win::VERSION_WIN8) |
| 58 return false; | 56 return false; |
| 59 if (!gfx::win::ShouldUseDirectWrite()) | 57 if (!gfx::win::ShouldUseDirectWrite()) |
| 60 return false; | 58 return false; |
| 61 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 59 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 62 if (cmd_line->HasSwitch(switches::kEnableWin32kRendererLockDown)) | |
| 63 return true; | |
| 64 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) | 60 if (cmd_line->HasSwitch(switches::kDisableWin32kRendererLockDown)) |
| 65 return false; | 61 return false; |
| 66 // Default. | 62 return true; |
| 67 return group_name != "Disabled"; | |
| 68 } | 63 } |
| 69 #endif | 64 #endif |
| 70 | 65 |
| 71 V8CacheOptions GetV8CacheOptions() { | 66 V8CacheOptions GetV8CacheOptions() { |
| 72 const base::CommandLine& command_line = | 67 const base::CommandLine& command_line = |
| 73 *base::CommandLine::ForCurrentProcess(); | 68 *base::CommandLine::ForCurrentProcess(); |
| 74 std::string v8_cache_options = | 69 std::string v8_cache_options = |
| 75 command_line.GetSwitchValueASCII(switches::kV8CacheOptions); | 70 command_line.GetSwitchValueASCII(switches::kV8CacheOptions); |
| 76 if (v8_cache_options.empty()) | 71 if (v8_cache_options.empty()) |
| 77 v8_cache_options = base::FieldTrialList::FindFullName("V8CacheOptions"); | 72 v8_cache_options = base::FieldTrialList::FindFullName("V8CacheOptions"); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 96 } else if (v8_cache_options == "recent") { | 91 } else if (v8_cache_options == "recent") { |
| 97 return V8_CACHE_OPTIONS_RECENT; | 92 return V8_CACHE_OPTIONS_RECENT; |
| 98 } else if (v8_cache_options == "recent-small") { | 93 } else if (v8_cache_options == "recent-small") { |
| 99 return V8_CACHE_OPTIONS_RECENT_SMALL; | 94 return V8_CACHE_OPTIONS_RECENT_SMALL; |
| 100 } else { | 95 } else { |
| 101 return V8_CACHE_OPTIONS_DEFAULT; | 96 return V8_CACHE_OPTIONS_DEFAULT; |
| 102 } | 97 } |
| 103 } | 98 } |
| 104 | 99 |
| 105 } // namespace content | 100 } // namespace content |
| OLD | NEW |