| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_PAGE_PARALLEL_JOB_ | 5 #ifndef V8_HEAP_PAGE_PARALLEL_JOB_ |
| 6 #define V8_HEAP_PAGE_PARALLEL_JOB_ | 6 #define V8_HEAP_PAGE_PARALLEL_JOB_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/cancelable-task.h" | 9 #include "src/cancelable-task.h" |
| 10 #include "src/utils.h" | 10 #include "src/utils.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 task, v8::Platform::kShortRunningTask); | 96 task, v8::Platform::kShortRunningTask); |
| 97 } else { | 97 } else { |
| 98 main_task = task; | 98 main_task = task; |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 // Contribute on main thread. | 101 // Contribute on main thread. |
| 102 main_task->Run(); | 102 main_task->Run(); |
| 103 delete main_task; | 103 delete main_task; |
| 104 // Wait for background tasks. | 104 // Wait for background tasks. |
| 105 for (int i = 0; i < num_tasks_; i++) { | 105 for (int i = 0; i < num_tasks_; i++) { |
| 106 if (!cancelable_task_manager_->TryAbort(task_ids[i])) { | 106 if (cancelable_task_manager_->TryAbort(task_ids[i]) != |
| 107 CancelableTaskManager::kTaskAborted) { |
| 107 pending_tasks_->Wait(); | 108 pending_tasks_->Wait(); |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 if (JobTraits::NeedSequentialFinalization) { | 111 if (JobTraits::NeedSequentialFinalization) { |
| 111 Item* item = items_; | 112 Item* item = items_; |
| 112 while (item != nullptr) { | 113 while (item != nullptr) { |
| 113 bool success = (item->state.Value() == kFinished); | 114 bool success = (item->state.Value() == kFinished); |
| 114 JobTraits::FinalizePageSequentially(heap_, item->chunk, success, | 115 JobTraits::FinalizePageSequentially(heap_, item->chunk, success, |
| 115 item->data); | 116 item->data); |
| 116 item = item->next; | 117 item = item->next; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 int num_items_; | 186 int num_items_; |
| 186 int num_tasks_; | 187 int num_tasks_; |
| 187 base::Semaphore* pending_tasks_; | 188 base::Semaphore* pending_tasks_; |
| 188 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); | 189 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 } // namespace internal | 192 } // namespace internal |
| 192 } // namespace v8 | 193 } // namespace v8 |
| 193 | 194 |
| 194 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ | 195 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ |
| OLD | NEW |