Bug 1683373: Add hasUserCET flag to cpu.extensions in Telemetry Environment. r=dmajor

Depends on D100124

Differential Revision: https://phabricator.services.mozilla.com/D100156
This commit is contained in:
Bob Owen 2020-12-19 19:48:29 +00:00
Родитель 6638e1db57
Коммит 19d42b3c5b
2 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -1843,6 +1843,7 @@ EnvironmentCache.prototype = {
"hasARMv6",
"hasARMv7",
"hasNEON",
"hasUserCET",
];
// Enumerate the available CPU extensions.

Просмотреть файл

@ -29,6 +29,7 @@
# include <wscapi.h>
# endif // __MINGW32__
# include "base/scoped_handle_win.h"
# include "mozilla/DynamicallyLinkedFunctionPtr.h"
# include "nsAppDirectoryServiceDefs.h"
# include "nsDirectoryServiceDefs.h"
# include "nsDirectoryServiceUtils.h"
@ -854,6 +855,13 @@ nsresult CollectProcessInfo(ProcessInfo& info) {
return NS_OK;
}
#if defined(XP_WIN) && (_WIN32_WINNT < 0x0A00)
WINBASEAPI
BOOL WINAPI IsUserCetAvailableInEnvironment(_In_ DWORD UserCetEnvironment);
# define USER_CET_ENVIRONMENT_WIN32_PROCESS 0x00000000
#endif
nsresult nsSystemInfo::Init() {
// check that it is called from the main thread on all platforms.
MOZ_ASSERT(NS_IsMainThread());
@ -950,6 +958,18 @@ nsresult nsSystemInfo::Init() {
}
}
# endif // __MINGW32__
mozilla::DynamicallyLinkedFunctionPtr<decltype(
&IsUserCetAvailableInEnvironment)>
isUserCetAvailable(L"api-ms-win-core-sysinfo-l1-2-6.dll",
"IsUserCetAvailableInEnvironment");
bool hasUserCET = isUserCetAvailable &&
isUserCetAvailable(USER_CET_ENVIRONMENT_WIN32_PROCESS);
rv = SetPropertyAsBool(u"hasUserCET"_ns, hasUserCET);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
#endif
#if defined(XP_MACOSX)