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

Unified Diff: third_party/tcmalloc/chromium/src/memory_region_map.cc

Issue 7050034: Merge google-perftools r109 (the current contents of third_party/tcmalloc/vendor) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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: third_party/tcmalloc/chromium/src/memory_region_map.cc
===================================================================
--- third_party/tcmalloc/chromium/src/memory_region_map.cc (revision 88335)
+++ third_party/tcmalloc/chromium/src/memory_region_map.cc (working copy)
@@ -111,13 +111,13 @@
#ifdef HAVE_PTHREAD
#include <pthread.h> // for pthread_t, pthread_self()
#endif
+#include <stddef.h>
#include <algorithm>
#include <set>
#include "memory_region_map.h"
-#include "base/linux_syscall_support.h"
#include "base/logging.h"
#include "base/low_level_alloc.h"
#include "malloc_hook-inl.h"
@@ -195,15 +195,11 @@
RAW_VLOG(10, "MemoryRegionMap Init increment done");
return;
}
- // Set our hooks and make sure no other hooks existed:
- if (MallocHook::SetMmapHook(MmapHook) != NULL ||
- MallocHook::SetMremapHook(MremapHook) != NULL ||
- MallocHook::SetSbrkHook(SbrkHook) != NULL ||
- MallocHook::SetMunmapHook(MunmapHook) != NULL) {
- RAW_LOG(FATAL, "Had other mmap/mremap/munmap/sbrk MallocHook-s set. "
- "Make sure only one of MemoryRegionMap and the other "
- "client is active.");
- }
+ // Set our hooks and make sure they were installed:
+ RAW_CHECK(MallocHook::AddMmapHook(&MmapHook), "");
+ RAW_CHECK(MallocHook::AddMremapHook(&MremapHook), "");
+ RAW_CHECK(MallocHook::AddSbrkHook(&SbrkHook), "");
+ RAW_CHECK(MallocHook::AddMunmapHook(&MunmapHook), "");
// We need to set recursive_insert since the NewArena call itself
// will already do some allocations with mmap which our hooks will catch
// recursive_insert allows us to buffer info about these mmap calls.
@@ -230,11 +226,10 @@
RAW_VLOG(10, "MemoryRegionMap Shutdown decrement done");
return true;
}
- CheckMallocHooks(); // we assume no other hooks
- MallocHook::SetMmapHook(NULL);
- MallocHook::SetMremapHook(NULL);
- MallocHook::SetSbrkHook(NULL);
- MallocHook::SetMunmapHook(NULL);
+ RAW_CHECK(MallocHook::RemoveMmapHook(&MmapHook), "");
+ RAW_CHECK(MallocHook::RemoveMremapHook(&MremapHook), "");
+ RAW_CHECK(MallocHook::RemoveSbrkHook(&SbrkHook), "");
+ RAW_CHECK(MallocHook::RemoveMunmapHook(&MunmapHook), "");
if (regions_) regions_->~RegionSet();
regions_ = NULL;
bool deleted_arena = LowLevelAlloc::DeleteArena(arena_);
@@ -248,15 +243,6 @@
return deleted_arena;
}
-void MemoryRegionMap::CheckMallocHooks() {
- if (MallocHook::GetMmapHook() != MmapHook ||
- MallocHook::GetMunmapHook() != MunmapHook ||
- MallocHook::GetMremapHook() != MremapHook ||
- MallocHook::GetSbrkHook() != SbrkHook) {
- RAW_LOG(FATAL, "Our mmap/mremap/munmap/sbrk MallocHook-s got changed.");
- }
-}
-
// Invariants (once libpthread_initialized is true):
// * While lock_ is not held, recursion_count_ is 0 (and
// lock_owner_tid_ is the previous owner, but we don't rely on
« no previous file with comments | « third_party/tcmalloc/chromium/src/memory_region_map.h ('k') | third_party/tcmalloc/chromium/src/packed-cache-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698