Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: util/win/critical_section_with_debug_info.cc

Issue 1405323003: win: Add and use GET_FUNCTION() and GET_FUNCTION_REQUIRED() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Address review feedback Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/util_test.gyp ('k') | util/win/exception_handler_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/win/critical_section_with_debug_info.cc
diff --git a/util/win/critical_section_with_debug_info.cc b/util/win/critical_section_with_debug_info.cc
index 91387ae9a46ddd353f927866e705e75016d7e06f..dc1a2dbaa235e08a2bf005571d626e4641d48fb0 100644
--- a/util/win/critical_section_with_debug_info.cc
+++ b/util/win/critical_section_with_debug_info.cc
@@ -15,6 +15,7 @@
#include "util/win/critical_section_with_debug_info.h"
#include "base/logging.h"
+#include "util/win/get_function.h"
namespace crashpad {
@@ -24,13 +25,8 @@ BOOL CrashpadInitializeCriticalSectionEx(
CRITICAL_SECTION* critical_section,
DWORD spin_count,
DWORD flags) {
- static decltype(InitializeCriticalSectionEx)* initialize_critical_section_ex =
- reinterpret_cast<decltype(InitializeCriticalSectionEx)*>(GetProcAddress(
- LoadLibrary(L"kernel32.dll"), "InitializeCriticalSectionEx"));
- if (!initialize_critical_section_ex) {
- PLOG(ERROR) << "GetProcAddress";
- return false;
- }
+ static const auto initialize_critical_section_ex =
+ GET_FUNCTION_REQUIRED(L"kernel32.dll", ::InitializeCriticalSectionEx);
bool ret =
initialize_critical_section_ex(critical_section, spin_count, flags);
if (!ret) {
« no previous file with comments | « util/util_test.gyp ('k') | util/win/exception_handler_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698