mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1205942 (part 4) - Remove GetWinVersion(). r=jld.
Like the last patch, the motivation is to remove a GetVersionEx() call which triggers deprecation warnings. Because Windows XP SP2 is the earliest Windows version we support, two of the existing uses of GetWinVersion() could be removed, because they were checking for XP or earlier. One other Vista check could be replaced with mozilla::IsVistaOrLater(). --HG-- extra : rebase_source : 48f032fe92c3897a91866c7ff786a635479c0389
This commit is contained in:
parent
bf211c7df2
commit
e21cd5505a
@ -150,17 +150,11 @@ void MessagePumpForUI::PumpOutPendingPaintMessages() {
|
||||
// to get the job done. Actual common max is 4 peeks, but we'll be a little
|
||||
// safe here.
|
||||
const int kMaxPeekCount = 20;
|
||||
bool win2k = win_util::GetWinVersion() <= win_util::WINVERSION_2000;
|
||||
int peek_count;
|
||||
for (peek_count = 0; peek_count < kMaxPeekCount; ++peek_count) {
|
||||
MSG msg;
|
||||
if (win2k) {
|
||||
if (!PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_REMOVE))
|
||||
break;
|
||||
} else {
|
||||
if (!PeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_PAINT))
|
||||
break;
|
||||
}
|
||||
if (!PeekMessage(&msg, NULL, 0, 0, PM_REMOVE | PM_QS_PAINT))
|
||||
break;
|
||||
ProcessMessageHelper(msg);
|
||||
if (state_->should_quit) // Handle WM_QUIT.
|
||||
break;
|
||||
|
@ -70,7 +70,7 @@ void PlatformThread::SetName(const char* name) {
|
||||
bool PlatformThread::Create(size_t stack_size, Delegate* delegate,
|
||||
PlatformThreadHandle* thread_handle) {
|
||||
unsigned int flags = 0;
|
||||
if (stack_size > 0 && win_util::GetWinVersion() >= win_util::WINVERSION_XP) {
|
||||
if (stack_size > 0) {
|
||||
flags = STACK_SIZE_PARAM_IS_A_RESERVATION;
|
||||
} else {
|
||||
stack_size = 0;
|
||||
|
@ -19,6 +19,8 @@
|
||||
#include <algorithm>
|
||||
#include "prenv.h"
|
||||
|
||||
#include "mozilla/WindowsVersion.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// System pagesize. This value remains constant on x86/64 architectures.
|
||||
@ -294,7 +296,7 @@ bool LaunchApp(const std::wstring& cmdline,
|
||||
|
||||
LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList = NULL;
|
||||
// Don't even bother trying pre-Vista...
|
||||
if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) {
|
||||
if (mozilla::IsVistaOrLater()) {
|
||||
// setup our handle array first - if we end up with no handles that can
|
||||
// be inherited we can avoid trying to do the ThreadAttributeList dance...
|
||||
HANDLE handlesToInherit[2];
|
||||
|
@ -15,45 +15,6 @@
|
||||
|
||||
namespace win_util {
|
||||
|
||||
WinVersion GetWinVersion() {
|
||||
static bool checked_version = false;
|
||||
static WinVersion win_version = WINVERSION_PRE_2000;
|
||||
if (!checked_version) {
|
||||
OSVERSIONINFOEX version_info;
|
||||
version_info.dwOSVersionInfoSize = sizeof version_info;
|
||||
GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info));
|
||||
if (version_info.dwMajorVersion == 5) {
|
||||
switch (version_info.dwMinorVersion) {
|
||||
case 0:
|
||||
win_version = WINVERSION_2000;
|
||||
break;
|
||||
case 1:
|
||||
win_version = WINVERSION_XP;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
win_version = WINVERSION_SERVER_2003;
|
||||
break;
|
||||
}
|
||||
} else if (version_info.dwMajorVersion == 6) {
|
||||
if (version_info.wProductType != VER_NT_WORKSTATION) {
|
||||
// 2008 is 6.0, and 2008 R2 is 6.1.
|
||||
win_version = WINVERSION_2008;
|
||||
} else {
|
||||
if (version_info.dwMinorVersion == 0) {
|
||||
win_version = WINVERSION_VISTA;
|
||||
} else {
|
||||
win_version = WINVERSION_WIN7;
|
||||
}
|
||||
}
|
||||
} else if (version_info.dwMajorVersion > 6) {
|
||||
win_version = WINVERSION_WIN7;
|
||||
}
|
||||
checked_version = true;
|
||||
}
|
||||
return win_version;
|
||||
}
|
||||
|
||||
bool IsShiftPressed() {
|
||||
return (::GetKeyState(VK_SHIFT) & 0x80) == 0x80;
|
||||
}
|
||||
|
@ -14,22 +14,6 @@
|
||||
|
||||
namespace win_util {
|
||||
|
||||
// NOTE: Keep these in order so callers can do things like
|
||||
// "if (GetWinVersion() > WINVERSION_2000) ...". It's OK to change the values,
|
||||
// though.
|
||||
enum WinVersion {
|
||||
WINVERSION_PRE_2000 = 0, // Not supported
|
||||
WINVERSION_2000 = 1,
|
||||
WINVERSION_XP = 2,
|
||||
WINVERSION_SERVER_2003 = 3,
|
||||
WINVERSION_VISTA = 4,
|
||||
WINVERSION_2008 = 5,
|
||||
WINVERSION_WIN7 = 6
|
||||
};
|
||||
|
||||
// Returns the running version of Windows.
|
||||
WinVersion GetWinVersion();
|
||||
|
||||
// Returns true if the shift key is currently pressed.
|
||||
bool IsShiftPressed();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user