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

Side by Side Diff: base/process/process_win.cc

Issue 1249683002: Remove support for AllowBelowNormalFromBrowser experiment group. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/process/process.h" 5 #include "base/process/process.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/field_trial.h"
10 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
11 #include "base/process/kill.h" 10 #include "base/process/kill.h"
12 #include "base/strings/string_util.h"
13 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
14 12
15 namespace { 13 namespace {
16 14
17 DWORD kBasicProcessAccess = 15 DWORD kBasicProcessAccess =
18 PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE; 16 PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION | SYNCHRONIZE;
19 17
20 } // namespace 18 } // namespace
21 19
22 namespace base { 20 namespace base {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 bool Process::SetProcessBackgrounded(bool value) { 170 bool Process::SetProcessBackgrounded(bool value) {
173 DCHECK(IsValid()); 171 DCHECK(IsValid());
174 // Vista and above introduce a real background mode, which not only 172 // Vista and above introduce a real background mode, which not only
175 // sets the priority class on the threads but also on the IO generated 173 // sets the priority class on the threads but also on the IO generated
176 // by it. Unfortunately it can only be set for the calling process. 174 // by it. Unfortunately it can only be set for the calling process.
177 DWORD priority; 175 DWORD priority;
178 if ((base::win::GetVersion() >= base::win::VERSION_VISTA) && (is_current())) { 176 if ((base::win::GetVersion() >= base::win::VERSION_VISTA) && (is_current())) {
179 priority = value ? PROCESS_MODE_BACKGROUND_BEGIN : 177 priority = value ? PROCESS_MODE_BACKGROUND_BEGIN :
180 PROCESS_MODE_BACKGROUND_END; 178 PROCESS_MODE_BACKGROUND_END;
181 } else { 179 } else {
182 // Experiment (http://crbug.com/458594) with using IDLE_PRIORITY_CLASS as a 180 priority = value ? IDLE_PRIORITY_CLASS : NORMAL_PRIORITY_CLASS;
183 // background priority for background renderers (this code path is
184 // technically for more than just the renderers but they're the only use
185 // case in practice and experimenting here direclty is thus easier -- plus
186 // it doesn't really hurt as above we already state our intent of using
187 // PROCESS_MODE_BACKGROUND_BEGIN if available which is essentially
188 // IDLE_PRIORITY_CLASS plus lowered IO priority). Enabled by default in the
189 // asbence of field trials to get coverage on the perf waterfall.
190 DWORD background_priority = IDLE_PRIORITY_CLASS;
191 base::FieldTrial* trial =
192 base::FieldTrialList::Find("BackgroundRendererProcesses");
193 if (trial && StartsWith(trial->group_name(), "AllowBelowNormalFromBrowser",
194 CompareCase::SENSITIVE)) {
195 background_priority = BELOW_NORMAL_PRIORITY_CLASS;
196 }
197
198 priority = value ? background_priority : NORMAL_PRIORITY_CLASS;
199 } 181 }
200 182
201 return (::SetPriorityClass(Handle(), priority) != 0); 183 return (::SetPriorityClass(Handle(), priority) != 0);
202 } 184 }
203 185
204 int Process::GetPriority() const { 186 int Process::GetPriority() const {
205 DCHECK(IsValid()); 187 DCHECK(IsValid());
206 return ::GetPriorityClass(Handle()); 188 return ::GetPriorityClass(Handle());
207 } 189 }
208 190
209 } // namespace base 191 } // namespace base
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