OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file can be empty. Its purpose is to contain the relatively short lived | 5 // This file can be empty. Its purpose is to contain the relatively short lived |
6 // definitions required for experimental flags. | 6 // definitions required for experimental flags. |
7 | 7 |
8 #include "ios/chrome/browser/experimental_flags.h" | 8 #include "ios/chrome/browser/experimental_flags.h" |
9 | 9 |
10 #import <Foundation/Foundation.h> | 10 #import <Foundation/Foundation.h> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 // First check if the experimental flag is turned on. | 65 // First check if the experimental flag is turned on. |
66 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 66 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
67 if (command_line->HasSwitch(switches::kEnableIOSWKWebView)) { | 67 if (command_line->HasSwitch(switches::kEnableIOSWKWebView)) { |
68 return true; | 68 return true; |
69 } else if (command_line->HasSwitch(switches::kDisableIOSWKWebView)) { | 69 } else if (command_line->HasSwitch(switches::kDisableIOSWKWebView)) { |
70 return false; | 70 return false; |
71 } | 71 } |
72 | 72 |
73 // Check if the finch experiment is turned on. | 73 // Check if the finch experiment is turned on. |
74 return base::StartsWithASCII(group_name, "Enabled", false); | 74 return base::StartsWith(group_name, "Enabled", |
| 75 base::CompareCase::INSENSITIVE_ASCII); |
75 } | 76 } |
76 | 77 |
77 size_t MemoryWedgeSizeInMB() { | 78 size_t MemoryWedgeSizeInMB() { |
78 std::string wedge_size_string; | 79 std::string wedge_size_string; |
79 | 80 |
80 // Get the size from the Experimental setting. | 81 // Get the size from the Experimental setting. |
81 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 82 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
82 wedge_size_string = | 83 wedge_size_string = |
83 command_line->GetSwitchValueASCII(switches::kIOSMemoryWedgeSize); | 84 command_line->GetSwitchValueASCII(switches::kIOSMemoryWedgeSize); |
84 | 85 |
85 // Otherwise, get from a variation param. | 86 // Otherwise, get from a variation param. |
86 if (wedge_size_string.empty()) { | 87 if (wedge_size_string.empty()) { |
87 wedge_size_string = | 88 wedge_size_string = |
88 variations::GetVariationParamValue("MemoryWedge", "wedge_size"); | 89 variations::GetVariationParamValue("MemoryWedge", "wedge_size"); |
89 } | 90 } |
90 | 91 |
91 // Parse the value. | 92 // Parse the value. |
92 size_t wedge_size_in_mb = 0; | 93 size_t wedge_size_in_mb = 0; |
93 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb)) | 94 if (base::StringToSizeT(wedge_size_string, &wedge_size_in_mb)) |
94 return wedge_size_in_mb; | 95 return wedge_size_in_mb; |
95 return 0; | 96 return 0; |
96 } | 97 } |
97 | 98 |
98 } // namespace experimental_flags | 99 } // namespace experimental_flags |
OLD | NEW |