Commit 6c74ee0c authored by Cliff Smolinsky's avatar Cliff Smolinsky Committed by Commit Bot

Add PinUser32() to wWinMain for Content_Shell.exe

Calls to pin or load user32.dll cannot happen on the main thread loop
because they are blocking calls. The test code always executes on the
main thread loop, so if the test code hits anything that requires
user32 then it will crash (with dchecks on). To avoid this, we simply
call PinUser32() in wWinMain before we get to the main thread loop.
This same thing is done in browser_tests_main.cc.

Bug: 962559
Change-Id: I82b4e7a41117db77e2ff3a01314cb9e82c7b1b8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617911Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#661391}
parent 0b33c07a
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "content/shell/app/shell_main_delegate.h" #include "content/shell/app/shell_main_delegate.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/win/win_util.h"
#include "content/public/app/sandbox_helper_win.h" #include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h" #include "sandbox/win/src/sandbox_types.h"
#endif #endif
...@@ -19,6 +20,9 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) { ...@@ -19,6 +20,9 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
int main() { int main() {
HINSTANCE instance = GetModuleHandle(NULL); HINSTANCE instance = GetModuleHandle(NULL);
#endif #endif
// Load and pin user32.dll to avoid having to load it once tests start while
// on the main thread loop where blocking calls are disallowed.
base::win::PinUser32();
sandbox::SandboxInterfaceInfo sandbox_info = {0}; sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info); content::InitializeSandboxInfo(&sandbox_info);
content::ShellMainDelegate delegate; content::ShellMainDelegate delegate;
......
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