Index: sandbox/src/win_utils.cc |
=================================================================== |
--- sandbox/src/win_utils.cc (revision 25655) |
+++ sandbox/src/win_utils.cc (working copy) |
@@ -197,42 +197,12 @@ |
}; // namespace sandbox |
-// The information is cached in a map. The map has to be global, so it's memory |
-// is leaked, and it's ok. |
+// TODO(cpu): Revert this change to use a map to speed up the function once |
+// this has been deployed in the dev channel for a week. See bug 11789. |
void ResolveNTFunctionPtr(const char* name, void* ptr) { |
- static std::map<std::string, FARPROC>* function_map = NULL; |
- if (!function_map) |
- function_map = new std::map<std::string, FARPROC>; |
- |
static HMODULE ntdll = ::GetModuleHandle(sandbox::kNtdllName); |
Nicolas Sylvain
2009/09/09 03:31:00
This is going to fail the same way it was failing
|
FARPROC* function_ptr = reinterpret_cast<FARPROC*>(ptr); |
- *function_ptr = (*function_map)[name]; |
- if (*function_ptr) |
- return; |
- |
*function_ptr = ::GetProcAddress(ntdll, name); |
- (*function_map)[name] = *function_ptr; |
- DCHECK(*function_ptr) << "Failed to resolve NTDLL function"; |
- |
- if (!*function_ptr) { |
- // If we return NULL, we are going to crash. Unfortunately, this happens. |
- // See bug 11789. |
- // Maybe our module handle is not valid anymore? |
- HMODULE ntdll2 = ::GetModuleHandle(sandbox::kNtdllName); |
- *function_ptr = ::GetProcAddress(ntdll2, name); |
- (*function_map)[name] = *function_ptr; |
- |
- // TODO(nsylvain): Remove this check after we are done troubleshooting. |
- CHECK(ntdll2) << "Fatal error: NTLL module is NULL"; |
- CHECK(*function_ptr) << "Fatal error: Failed to resolve NTDLL function"; |
- |
- // If we are here, it means that getting the new module handle worked. This |
- // is not really expected. We want to receive some reports from users, so |
- // we will crash anyway. |
- // TODO(nsylvain): Remove this check after we are done troubleshooting. |
- CHECK(ntdll) << "Fatal Error: NTDLL module was NULL."; |
- CHECK(ntdll == ntdll2) << "Fatal Error: NTDLL module has been moved."; |
- CHECK(false) << "Fatal Error: GetProcAddress Inconsistency"; |
- } |
+ CHECK(*function_ptr) << "Failed to resolve NTDLL function"; |
} |