Replace shlwapi call with STL.

The only use of shlwapi is for a single method which can be easily
replaced by simple wstring calls. This change makes that swap and
removes the reference to shlwapi completely.

Bug: v8:9031
Change-Id: Ia8f2c44e8166d93e309016896b26a84bdb90d720
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1534960
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60451}
This commit is contained in:
Cliff Smolinsky 2019-03-21 14:42:37 -07:00 committed by Commit Bot
parent 7629afdb9d
commit 31d7e1d366
2 changed files with 8 additions and 13 deletions

View File

@ -3400,13 +3400,10 @@ v8_component("v8_libbase") {
libs = [
"dbghelp.lib",
"shlwapi.lib",
"winmm.lib",
"ws2_32.lib",
]
ldflags = [ "/DELAYLOAD:shlwapi.dll" ]
data_deps += [ "//build/win:runtime_libs" ]
}

View File

@ -16,11 +16,11 @@
#include <windows.h>
#include <dbghelp.h>
#include <Shlwapi.h>
#include <stddef.h>
#include <iostream>
#include <memory>
#include <string>
#include "src/base/logging.h"
#include "src/base/macros.h"
@ -49,12 +49,6 @@ long WINAPI StackDumpExceptionFilter(EXCEPTION_POINTERS* info) { // NOLINT
return EXCEPTION_CONTINUE_SEARCH;
}
void GetExePath(wchar_t* path_out) {
GetModuleFileName(nullptr, path_out, MAX_PATH);
path_out[MAX_PATH - 1] = L'\0';
PathRemoveFileSpec(path_out);
}
bool InitializeSymbols() {
if (g_initialized_symbols) return g_init_error == ERROR_SUCCESS;
g_initialized_symbols = true;
@ -87,9 +81,13 @@ bool InitializeSymbols() {
}
wchar_t exe_path[MAX_PATH];
GetExePath(exe_path);
std::wstring new_path(std::wstring(symbols_path.get()) + L";" +
std::wstring(exe_path));
GetModuleFileName(nullptr, exe_path, MAX_PATH);
std::wstring exe_path_wstring(exe_path);
// To get the path without the filename, we just need to remove the final
// slash and everything after it.
std::wstring new_path(
std::wstring(symbols_path.get()) + L";" +
exe_path_wstring.substr(0, exe_path_wstring.find_last_of(L"\\/")));
if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) {
g_init_error = GetLastError();
return false;