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

Unified Diff: src/heap/page-parallel-job.h

Issue 1806283002: Allocate semaphore of page parallel job on heap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/page-parallel-job.h
diff --git a/src/heap/page-parallel-job.h b/src/heap/page-parallel-job.h
index 1b1b60c4fc99b008a64b152ebaaf1a968c20ee26..720e288fc8ed2ba940cdff4905c58e2c04dc61d9 100644
--- a/src/heap/page-parallel-job.h
+++ b/src/heap/page-parallel-job.h
@@ -38,7 +38,8 @@ class PageParallelJob {
cancelable_task_manager_(cancelable_task_manager),
items_(nullptr),
num_items_(0),
- pending_tasks_(0) {}
+ num_tasks_(0),
+ pending_tasks_(new base::Semaphore(0)) {}
~PageParallelJob() {
Item* item = items_;
@@ -47,6 +48,7 @@ class PageParallelJob {
delete item;
item = next;
}
+ delete pending_tasks_;
}
void AddPage(MemoryChunk* chunk, typename JobTraits::PerPageData data) {
@@ -81,7 +83,7 @@ class PageParallelJob {
start_index -= num_items_;
}
Task* task = new Task(heap_, items_, num_items_, start_index,
- &pending_tasks_, per_task_data_callback(i));
+ pending_tasks_, per_task_data_callback(i));
task_ids[i] = task->id();
if (i > 0) {
V8::GetCurrentPlatform()->CallOnBackgroundThread(
@@ -96,7 +98,7 @@ class PageParallelJob {
// Wait for background tasks.
for (int i = 0; i < num_tasks_; i++) {
if (!cancelable_task_manager_->TryAbort(task_ids[i])) {
- pending_tasks_.Wait();
+ pending_tasks_->Wait();
}
}
if (JobTraits::NeedSequentialFinalization) {
@@ -176,7 +178,7 @@ class PageParallelJob {
Item* items_;
int num_items_;
int num_tasks_;
- base::Semaphore pending_tasks_;
+ base::Semaphore* pending_tasks_;
DISALLOW_COPY_AND_ASSIGN(PageParallelJob);
};
« no previous file with comments | « src/heap/mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698