Chromium Code Reviews| 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..d3e139c3c125ff45a294a97c46d0d2c2a8238eb2 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,23 @@ bool WillProductBePresentAfterSetup( |
| return is_affected ? !is_uninstall : is_present; |
| } |
| +bool AdjustProcessPriority() { |
| + if (base::win::GetVersion() > base::win::VERSION_SERVER_2003) { |
|
cpu_(ooo_6.6-7.5)
2013/06/03 19:43:02
can we use VERSION_VISTA ? in general we try our b
grt (UTC plus 2)
2013/06/03 20:13:18
Done.
|
| + HANDLE current_process = ::GetCurrentProcess(); |
| + DWORD priority_class = ::GetPriorityClass(current_process); |
| + 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(current_process, |
| + PROCESS_MODE_BACKGROUND_BEGIN); |
| + PLOG_IF(WARNING, !result) << "Failed to enter background mode."; |
| + return !!result; |
|
cpu_(ooo_6.6-7.5)
2013/06/03 19:43:02
note that GetCurrentProcess just returns -1 so it
grt (UTC plus 2)
2013/06/03 20:13:18
Done.
|
| + } |
| + } |
| + return false; |
| +} |
| + |
| ScopedTokenPrivilege::ScopedTokenPrivilege(const wchar_t* privilege_name) |
| : is_enabled_(false) { |
| if (!::OpenProcessToken(::GetCurrentProcess(), |