Commit a1c6900a authored by Brian Sheedy's avatar Brian Sheedy Committed by Commit Bot

Support more Windows thread priorities

Adds support for base::win::GetVersion() returning either 5 or 6 on
Windows 10, which are valid return values but currently unhandled, which
has been causing flaky test failures.

Bug: 1007013
Change-Id: I40217ff610cb9071c2504352e8a99b234f3c1fa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1954216
Commit-Queue: François Doray <fdoray@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722579}
parent c5f9af0c
......@@ -37,6 +37,10 @@ constexpr int kWin7BackgroundThreadModePriority = 4;
// set to normal on Windows 7.
constexpr int kWin7NormalPriority = 3;
// These values are sometimes returned by ::GetThreadPriority() on Windows 10.
constexpr int kWin10NormalPriority1 = 5;
constexpr int kWin10NormalPriority2 = 6;
// The information on how to set the thread name comes from
// a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx
const DWORD kVCThreadNameException = 0x406D1388;
......@@ -450,6 +454,12 @@ ThreadPriority PlatformThread::GetCurrentThreadPriority() {
FALLTHROUGH;
case THREAD_PRIORITY_NORMAL:
return ThreadPriority::NORMAL;
case kWin10NormalPriority1:
FALLTHROUGH;
case kWin10NormalPriority2:
DCHECK_GE(win::GetVersion(), win::Version::WIN10);
DCHECK_LT(win::GetVersion(), win::Version::WIN_LAST);
return ThreadPriority::NORMAL;
case THREAD_PRIORITY_ABOVE_NORMAL:
case THREAD_PRIORITY_HIGHEST:
return ThreadPriority::DISPLAY;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment