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

Unified Diff: Source/platform/heap/ThreadState.cpp

Issue 669323002: Oilpan: Clarify ownership of split-off heaps. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index 60f6eca1fd0e166c6b6cb9ebf9d25e059b081568..56b0644c6cbe32740854a77fb121541b132cb3a5 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -1147,7 +1147,7 @@ void ThreadState::performPendingSweepInParallel()
// swept on other threads.
static const int minNumberOfPagesForParallelSweep = 10;
HeapStats heapStatsVector[NumberOfNonFinalizedHeaps];
- BaseHeap* splitOffHeaps[NumberOfNonFinalizedHeaps] = { 0 };
+ OwnPtr<BaseHeap> splitOffHeaps[NumberOfNonFinalizedHeaps];
for (int i = 0; i < NumberOfNonFinalizedHeaps && pagesToSweepInParallel > 0; i++) {
BaseHeap* heap = m_heaps[FirstNonFinalizedHeap + i];
int pageCount = heap->normalPageCount();
@@ -1159,10 +1159,9 @@ void ThreadState::performPendingSweepInParallel()
// sweeper thread and the owner thread.
int pagesToSplitOff = std::min(pageCount, pagesToSweepInParallel);
pagesToSweepInParallel -= pagesToSplitOff;
- BaseHeap* splitOff = heap->split(pagesToSplitOff);
- splitOffHeaps[i] = splitOff;
+ splitOffHeaps[i] = heap->split(pagesToSplitOff);
HeapStats* stats = &heapStatsVector[i];
- m_sweeperThread->postTask(new SweepNonFinalizedHeapTask(this, splitOff, stats));
+ m_sweeperThread->postTask(new SweepNonFinalizedHeapTask(this, splitOffHeaps[i].get(), stats));
}
}
@@ -1192,8 +1191,8 @@ void ThreadState::performPendingSweepInParallel()
waitUntilSweepersDone();
for (int i = 0; i < NumberOfNonFinalizedHeaps; i++) {
m_stats.add(&heapStatsVector[i]);
- if (BaseHeap* splitOff = splitOffHeaps[i])
- m_heaps[FirstNonFinalizedHeap + i]->merge(splitOff);
+ if (splitOffHeaps[i])
+ m_heaps[FirstNonFinalizedHeap + i]->merge(splitOffHeaps[i].release());
}
for (int i = 0; i < NumberOfHeaps; i++)
« no previous file with comments | « Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698