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

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

Issue 14769008: Fix mmap region iteration while no regions are recorded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | « third_party/tcmalloc/chromium/src/memory_region_map.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/memory_region_map.cc
diff --git a/third_party/tcmalloc/chromium/src/memory_region_map.cc b/third_party/tcmalloc/chromium/src/memory_region_map.cc
index dcc73c4ac6dc0307c38b1f094f426dfdf7c434a5..a94c964ae90913ea00905dbcae5dcbc56ada8628 100644
--- a/third_party/tcmalloc/chromium/src/memory_region_map.cc
+++ b/third_party/tcmalloc/chromium/src/memory_region_map.cc
@@ -231,6 +231,8 @@ void MemoryRegionMap::Init(int max_stack_depth, bool use_buckets) {
memset(bucket_table_, 0, table_bytes);
num_buckets_ = 0;
}
+ if (regions_ == NULL) // init regions_
+ InitRegionSetLocked();
Unlock();
RAW_VLOG(10, "MemoryRegionMap Init done");
}
@@ -533,6 +535,15 @@ void MemoryRegionMap::RestoreSavedBucketsLocked() {
}
}
+inline void MemoryRegionMap::InitRegionSetLocked() {
+ RAW_VLOG(12, "Initializing region set");
+ regions_ = regions_rep.region_set();
+ recursive_insert = true;
+ new(regions_) RegionSet();
+ HandleSavedRegionsLocked(&DoInsertRegionLocked);
+ recursive_insert = false;
+}
+
inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
RAW_CHECK(LockIsHeld(), "should be held (by this thread)");
// We can be called recursively, because RegionSet constructor
@@ -552,14 +563,8 @@ inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
// then increment saved_regions_count.
saved_regions[saved_regions_count++] = region;
} else { // not a recusrive call
- if (regions_ == NULL) { // init regions_
- RAW_VLOG(12, "Initializing region set");
- regions_ = regions_rep.region_set();
- recursive_insert = true;
- new(regions_) RegionSet();
- HandleSavedRegionsLocked(&DoInsertRegionLocked);
- recursive_insert = false;
- }
+ if (regions_ == NULL) // init regions_
+ InitRegionSetLocked();
recursive_insert = true;
// Do the actual insertion work to put new regions into regions_:
DoInsertRegionLocked(region);
« no previous file with comments | « third_party/tcmalloc/chromium/src/memory_region_map.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698