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

Unified Diff: chrome/installer/setup/setup_util.cc

Issue 16023027: Lower the I/O priority of the installer when resonable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cpu comments Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/setup/setup_util.h ('k') | chrome/installer/setup/setup_util_unittest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/setup_util.cc
diff --git a/chrome/installer/setup/setup_util.cc b/chrome/installer/setup/setup_util.cc
index 9f112c01b44e0519e3f91b35ade471a652737139..55a4a8b1bdf8353e614e181b7603d2dc03a8af74 100644
--- a/chrome/installer/setup/setup_util.cc
+++ b/chrome/installer/setup/setup_util.cc
@@ -15,6 +15,7 @@
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/version.h"
+#include "base/win/windows_version.h"
#include "chrome/installer/util/copy_tree_work_item.h"
#include "chrome/installer/util/installation_state.h"
#include "chrome/installer/util/installer_state.h"
@@ -313,6 +314,22 @@ bool WillProductBePresentAfterSetup(
return is_affected ? !is_uninstall : is_present;
}
+bool AdjustProcessPriority() {
+ if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
+ DWORD priority_class = ::GetPriorityClass(::GetCurrentProcess());
+ if (priority_class == 0) {
+ PLOG(WARNING) << "Failed to get the process's priority class.";
+ } else if (priority_class == BELOW_NORMAL_PRIORITY_CLASS ||
+ priority_class == IDLE_PRIORITY_CLASS) {
+ BOOL result = ::SetPriorityClass(::GetCurrentProcess(),
+ PROCESS_MODE_BACKGROUND_BEGIN);
+ PLOG_IF(WARNING, !result) << "Failed to enter background mode.";
+ return !!result;
+ }
+ }
+ return false;
+}
+
ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name)
: is_enabled_(false) {
if (!::OpenProcessToken(::GetCurrentProcess(),
« no previous file with comments | « chrome/installer/setup/setup_util.h ('k') | chrome/installer/setup/setup_util_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698