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

Side by Side Diff: content/browser/memory/memory_state_updater.cc

Issue 2717953004: Rename memory coordinator's variation parameters part 1 (Closed)
Patch Set: Created 3 years, 9 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/browser/memory/memory_state_updater.h" 5 #include "content/browser/memory/memory_state_updater.h"
6 6
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "components/variations/variations_associated_data.h" 9 #include "components/variations/variations_associated_data.h"
10 #include "content/browser/memory/memory_monitor.h" 10 #include "content/browser/memory/memory_monitor.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 new_renderers_back_to_throttled_ = kDefaultNewRenderersBackToThrottled; 140 new_renderers_back_to_throttled_ = kDefaultNewRenderersBackToThrottled;
141 minimum_transition_period_ = 141 minimum_transition_period_ =
142 base::TimeDelta::FromSeconds(kDefaultMinimumTransitionPeriodSeconds); 142 base::TimeDelta::FromSeconds(kDefaultMinimumTransitionPeriodSeconds);
143 monitoring_interval_ = 143 monitoring_interval_ =
144 base::TimeDelta::FromSeconds(kDefaultMonitoringIntervalSeconds); 144 base::TimeDelta::FromSeconds(kDefaultMonitoringIntervalSeconds);
145 145
146 // Override default parameters with variations. 146 // Override default parameters with variations.
147 static constexpr char kMemoryCoordinatorV0Trial[] = "MemoryCoordinatorV0"; 147 static constexpr char kMemoryCoordinatorV0Trial[] = "MemoryCoordinatorV0";
148 std::map<std::string, std::string> params; 148 std::map<std::string, std::string> params;
149 variations::GetVariationParams(kMemoryCoordinatorV0Trial, &params); 149 variations::GetVariationParams(kMemoryCoordinatorV0Trial, &params);
150 // TODO(bashi): Renaming (throttled -> warning, suspended -> critical) is
151 // ongoing. Get variation parameters from both until server-side change
152 // is done. crbug.com/696844
150 SetIntVariationParameter(params, "expected_renderer_size", 153 SetIntVariationParameter(params, "expected_renderer_size",
151 &expected_renderer_size_); 154 &expected_renderer_size_);
152 SetIntVariationParameter(params, "new_renderers_until_throttled", 155 SetIntVariationParameter(params, "new_renderers_until_throttled",
153 &new_renderers_until_throttled_); 156 &new_renderers_until_throttled_);
157 SetIntVariationParameter(params, "new_renderers_until_warning",
158 &new_renderers_until_throttled_);
154 SetIntVariationParameter(params, "new_renderers_until_suspended", 159 SetIntVariationParameter(params, "new_renderers_until_suspended",
155 &new_renderers_until_suspended_); 160 &new_renderers_until_suspended_);
161 SetIntVariationParameter(params, "new_renderers_until_critical",
162 &new_renderers_until_suspended_);
156 SetIntVariationParameter(params, "new_renderers_back_to_normal", 163 SetIntVariationParameter(params, "new_renderers_back_to_normal",
157 &new_renderers_back_to_normal_); 164 &new_renderers_back_to_normal_);
158 SetIntVariationParameter(params, "new_renderers_back_to_throttled", 165 SetIntVariationParameter(params, "new_renderers_back_to_throttled",
159 &new_renderers_back_to_throttled_); 166 &new_renderers_back_to_throttled_);
167 SetIntVariationParameter(params, "new_renderers_back_to_warning",
168 &new_renderers_back_to_throttled_);
160 SetSecondsVariationParameter(params, "minimum_transition_period", 169 SetSecondsVariationParameter(params, "minimum_transition_period",
161 &minimum_transition_period_); 170 &minimum_transition_period_);
162 SetSecondsVariationParameter(params, "monitoring_interval", 171 SetSecondsVariationParameter(params, "monitoring_interval",
163 &monitoring_interval_); 172 &monitoring_interval_);
164 } 173 }
165 174
166 bool MemoryStateUpdater::ValidateParameters() { 175 bool MemoryStateUpdater::ValidateParameters() {
167 return (new_renderers_until_throttled_ > new_renderers_until_suspended_) && 176 return (new_renderers_until_throttled_ > new_renderers_until_suspended_) &&
168 (new_renderers_back_to_normal_ > new_renderers_back_to_throttled_) && 177 (new_renderers_back_to_normal_ > new_renderers_back_to_throttled_) &&
169 (new_renderers_back_to_normal_ > new_renderers_until_throttled_) && 178 (new_renderers_back_to_normal_ > new_renderers_until_throttled_) &&
170 (new_renderers_back_to_throttled_ > new_renderers_until_suspended_); 179 (new_renderers_back_to_throttled_ > new_renderers_until_suspended_);
171 } 180 }
172 181
173 } // namespace content 182 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698