Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: ios/chrome/browser/experimental_flags.mm

Issue 1410973008: Added an experiment for an LRU snapshot cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 void SetWKWebViewTrialEligibility(bool eligible) { 48 void SetWKWebViewTrialEligibility(bool eligible) {
49 // It's critical that the enabled state be consistently reported throughout 49 // It's critical that the enabled state be consistently reported throughout
50 // the life of the app, so ensure that this has not already been set. 50 // the life of the app, so ensure that this has not already been set.
51 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET); 51 DCHECK(g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET);
52 52
53 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE 53 g_wkwebview_trial_eligibility = eligible ? WKWebViewEligibility::ELIGIBLE
54 : WKWebViewEligibility::INELIGIBLE; 54 : WKWebViewEligibility::INELIGIBLE;
55 } 55 }
56 56
57 bool IsLRUSnapshotCacheEnabled() {
58 return true;
59
60 // Check if the experimental flag is forced on or off.
61 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
62 if (command_line->HasSwitch(switches::kEnableLRUSnapshotCache)) {
63 return true;
64 } else if (command_line->HasSwitch(switches::kDisableLRUSnapshotCache)) {
65 return false;
66 }
67
68 // Check if the finch experiment is turned on.
69 std::string group_name =
70 base::FieldTrialList::FindFullName("IOSLRUSnapshotCache");
71 return base::StartsWith(group_name, "Enabled",
72 base::CompareCase::INSENSITIVE_ASCII);
73 }
74
57 bool IsWKWebViewEnabled() { 75 bool IsWKWebViewEnabled() {
58 // If g_wkwebview_trial_eligibility hasn't been set, default it to 76 // If g_wkwebview_trial_eligibility hasn't been set, default it to
59 // ineligibile. This ensures future calls to try to set it will DCHECK. 77 // ineligibile. This ensures future calls to try to set it will DCHECK.
60 if (g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET) { 78 if (g_wkwebview_trial_eligibility == WKWebViewEligibility::UNSET) {
61 g_wkwebview_trial_eligibility = WKWebViewEligibility::INELIGIBLE; 79 g_wkwebview_trial_eligibility = WKWebViewEligibility::INELIGIBLE;
62 } 80 }
63 81
64 // If WKWebView isn't supported, don't activate the experiment at all. This 82 // If WKWebView isn't supported, don't activate the experiment at all. This
65 // avoids someone being slotted into the WKWebView bucket (and thus reporting 83 // avoids someone being slotted into the WKWebView bucket (and thus reporting
66 // as WKWebView), but actually running UIWebView. 84 // as WKWebView), but actually running UIWebView.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 122
105 bool IsViewCopyPasswordsEnabled() { 123 bool IsViewCopyPasswordsEnabled() {
106 NSString* viewCopyPasswordFlag = [[NSUserDefaults standardUserDefaults] 124 NSString* viewCopyPasswordFlag = [[NSUserDefaults standardUserDefaults]
107 objectForKey:kEnableViewCopyPasswords]; 125 objectForKey:kEnableViewCopyPasswords];
108 if ([viewCopyPasswordFlag isEqualToString:@"Enabled"]) 126 if ([viewCopyPasswordFlag isEqualToString:@"Enabled"])
109 return true; 127 return true;
110 return false; 128 return false;
111 } 129 }
112 130
113 } // namespace experimental_flags 131 } // namespace experimental_flags
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698