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

Unified Diff: base/process/memory_unittest.cc

Issue 1825823002: Cleanup: LFH only needs to be enabled on XP/2003 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 9 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
Index: base/process/memory_unittest.cc
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc
index c4728c52371263dd6f731998761959c08407eda7..9e5de0c95452ed5c29f21003ea51b46a99536363 100644
--- a/base/process/memory_unittest.cc
+++ b/base/process/memory_unittest.cc
@@ -67,49 +67,6 @@ TEST(ProcessMemoryTest, GetModuleFromAddress) {
base::GetModuleFromAddress(reinterpret_cast<DWORD*>(kernel32) + 1);
EXPECT_EQ(kernel32, kernel32_from_address);
}
-
-TEST(ProcessMemoryTest, EnableLFH) {
- ASSERT_TRUE(base::EnableLowFragmentationHeap());
- if (IsDebuggerPresent()) {
- // Under these conditions, LFH can't be enabled. There's no point to test
- // anything.
- const char* no_debug_env = getenv("_NO_DEBUG_HEAP");
- if (!no_debug_env || strcmp(no_debug_env, "1"))
- return;
- }
- HMODULE kernel32 = GetModuleHandle(L"kernel32.dll");
- ASSERT_TRUE(kernel32 != NULL);
- HeapQueryFn heap_query = reinterpret_cast<HeapQueryFn>(GetProcAddress(
- kernel32,
- "HeapQueryInformation"));
-
- // On Windows 2000, the function is not exported. This is not a reason to
- // fail but we won't be able to retrieves information about the heap, so we
- // should stop here.
- if (heap_query == NULL)
- return;
-
- HANDLE heaps[1024] = { 0 };
- unsigned number_heaps = GetProcessHeaps(1024, heaps);
- EXPECT_GT(number_heaps, 0u);
- for (unsigned i = 0; i < number_heaps; ++i) {
- ULONG flag = 0;
- SIZE_T length;
- ASSERT_NE(0, heap_query(heaps[i],
- HeapCompatibilityInformation,
- &flag,
- sizeof(flag),
- &length));
- // If flag is 0, the heap is a standard heap that does not support
- // look-asides. If flag is 1, the heap supports look-asides. If flag is 2,
- // the heap is a low-fragmentation heap (LFH). Note that look-asides are not
- // supported on the LFH.
-
- // We don't have any documented way of querying the HEAP_NO_SERIALIZE flag.
- EXPECT_LE(flag, 2u);
- EXPECT_NE(flag, 1u);
- }
-}
#endif // defined(OS_WIN)
#if defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698