mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 16:00:45 +00:00
Changes to make support WinUWP target
TEST=no new tests added for this change, existing tests should work. Bug: 43762 Change-Id: I1cc4c18526c0eef62c441567e8a7e55dd3dd8b0d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167041 Commit-Queue: Siva Annamalai <asiva@google.com> Reviewed-by: Siva Annamalai <asiva@google.com>
This commit is contained in:
parent
25c73c0e56
commit
50a2216b31
|
@ -83,6 +83,11 @@ config("dart_os_config") {
|
|||
defines += [ "TARGET_OS_MACOS" ]
|
||||
} else if (target_os == "win") {
|
||||
defines += [ "TARGET_OS_WINDOWS" ]
|
||||
} else if (target_os == "winuwp") {
|
||||
defines += [
|
||||
"TARGET_OS_WINDOWS",
|
||||
"TARGET_OS_WINDOWS_UWP",
|
||||
]
|
||||
} else {
|
||||
print("Unknown target_os: $target_os")
|
||||
assert(false)
|
||||
|
|
|
@ -210,12 +210,14 @@ template("build_gen_snapshot") {
|
|||
if (is_win) {
|
||||
libs = [
|
||||
"iphlpapi.lib",
|
||||
"psapi.lib",
|
||||
"ws2_32.lib",
|
||||
"Rpcrt4.lib",
|
||||
"shlwapi.lib",
|
||||
"winmm.lib",
|
||||
]
|
||||
if (target_os != "winuwp") {
|
||||
libs += [ "psapi.lib" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -932,19 +932,31 @@ intptr_t Process::CurrentProcessId() {
|
|||
}
|
||||
|
||||
int64_t Process::CurrentRSS() {
|
||||
// Although the documentation at
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-getprocessmemoryinfo
|
||||
// claims that GetProcessMemoryInfo is UWP compatible, it is actually not
|
||||
// hence this function cannot work when compiled in UWP mode.
|
||||
#ifdef TARGET_OS_WINDOWS_UWP
|
||||
return -1;
|
||||
#else
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
||||
return -1;
|
||||
}
|
||||
return pmc.WorkingSetSize;
|
||||
#endif
|
||||
}
|
||||
|
||||
int64_t Process::MaxRSS() {
|
||||
#ifdef TARGET_OS_WINDOWS_UWP
|
||||
return -1;
|
||||
#else
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
if (!GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) {
|
||||
return -1;
|
||||
}
|
||||
return pmc.PeakWorkingSetSize;
|
||||
#endif
|
||||
}
|
||||
|
||||
static SignalInfo* signal_handlers = NULL;
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#include "bin/secure_socket_utils.h"
|
||||
#include "platform/syslog.h"
|
||||
|
||||
#ifndef TARGET_OS_WINDOWS_UWP
|
||||
#pragma comment(lib, "crypt32.lib")
|
||||
#endif
|
||||
|
||||
namespace dart {
|
||||
namespace bin {
|
||||
|
@ -42,6 +44,11 @@ static void PrintSSLErr(const char* str) {
|
|||
|
||||
// Add certificates from Windows trusted root store.
|
||||
static bool AddCertificatesFromRootStore(X509_STORE* store) {
|
||||
// The UWP platform doesn't support CertEnumCertificatesInStore hence
|
||||
// this function cannot work when compiled in UWP mode.
|
||||
#ifdef TARGET_OS_WINDOWS_UWP
|
||||
return false;
|
||||
#else
|
||||
// Open root system store.
|
||||
// Note that only current user certificates are accessible using this method,
|
||||
// not the local machine store.
|
||||
|
@ -98,6 +105,7 @@ static bool AddCertificatesFromRootStore(X509_STORE* store) {
|
|||
return false;
|
||||
}
|
||||
return true;
|
||||
#endif // ifdef TARGET_OS_WINDOWS_UWP
|
||||
}
|
||||
|
||||
void SSLCertContext::TrustBuiltinRoots() {
|
||||
|
|
|
@ -49,8 +49,10 @@ config("libdart_vm_config") {
|
|||
libs = [
|
||||
"advapi32.lib",
|
||||
"shell32.lib",
|
||||
"dbghelp.lib",
|
||||
]
|
||||
if (target_os != "winuwp") {
|
||||
libs += [ "dbghelp.lib" ]
|
||||
}
|
||||
} else {
|
||||
libs = [ "dl" ]
|
||||
if (!is_android) {
|
||||
|
|
|
@ -23,6 +23,10 @@ void NativeSymbolResolver::Init() {
|
|||
lock_ = new Mutex();
|
||||
}
|
||||
running_ = true;
|
||||
|
||||
// Symbol resolution API's used in this file are not supported
|
||||
// when compiled in UWP.
|
||||
#ifndef TARGET_OS_WINDOWS_UWP
|
||||
SymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS);
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
if (!SymInitialize(hProcess, NULL, TRUE)) {
|
||||
|
@ -32,6 +36,7 @@ void NativeSymbolResolver::Init() {
|
|||
error);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NativeSymbolResolver::Cleanup() {
|
||||
|
@ -40,6 +45,7 @@ void NativeSymbolResolver::Cleanup() {
|
|||
return;
|
||||
}
|
||||
running_ = false;
|
||||
#ifndef TARGET_OS_WINDOWS_UWP
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
if (!SymCleanup(hProcess)) {
|
||||
DWORD error = GetLastError();
|
||||
|
@ -47,9 +53,13 @@ void NativeSymbolResolver::Cleanup() {
|
|||
")\n",
|
||||
error);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
char* NativeSymbolResolver::LookupSymbolName(uword pc, uword* start) {
|
||||
#ifdef TARGET_OS_WINDOWS_UWP
|
||||
return NULL;
|
||||
#else
|
||||
static const intptr_t kMaxNameLength = 2048;
|
||||
static const intptr_t kSymbolInfoSize = sizeof(SYMBOL_INFO); // NOLINT.
|
||||
static char buffer[kSymbolInfoSize + kMaxNameLength];
|
||||
|
@ -76,6 +86,7 @@ char* NativeSymbolResolver::LookupSymbolName(uword pc, uword* start) {
|
|||
*start = pc - displacement;
|
||||
}
|
||||
return Utils::StrDup(pSymbol->Name);
|
||||
#endif // ifdef TARGET_OS_WINDOWS_UWP
|
||||
}
|
||||
|
||||
void NativeSymbolResolver::FreeSymbolName(char* name) {
|
||||
|
|
Loading…
Reference in a new issue