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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 private: | 115 private: |
116 static const int kMaxNumberOfTasks = 10; | 116 static const int kMaxNumberOfTasks = 10; |
117 | 117 |
118 enum ProcessingState { kAvailable, kProcessing, kFinished, kFailed }; | 118 enum ProcessingState { kAvailable, kProcessing, kFinished, kFailed }; |
119 | 119 |
120 struct Item : public Malloced { | 120 struct Item : public Malloced { |
121 Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next) | 121 Item(MemoryChunk* chunk, typename JobTraits::PerPageData data, Item* next) |
122 : chunk(chunk), state(kAvailable), data(data), next(next) {} | 122 : chunk(chunk), state(kAvailable), data(data), next(next) {} |
123 MemoryChunk* chunk; | 123 MemoryChunk* chunk; |
124 AtomicValue<ProcessingState> state; | 124 base::AtomicValue<ProcessingState> state; |
125 typename JobTraits::PerPageData data; | 125 typename JobTraits::PerPageData data; |
126 Item* next; | 126 Item* next; |
127 }; | 127 }; |
128 | 128 |
129 class Task : public CancelableTask { | 129 class Task : public CancelableTask { |
130 public: | 130 public: |
131 Task(Heap* heap, Item* items, int num_items, int start_index, | 131 Task(Heap* heap, Item* items, int num_items, int start_index, |
132 base::Semaphore* on_finish, typename JobTraits::PerTaskData data) | 132 base::Semaphore* on_finish, typename JobTraits::PerTaskData data) |
133 : CancelableTask(heap->isolate()), | 133 : CancelableTask(heap->isolate()), |
134 heap_(heap), | 134 heap_(heap), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 int num_items_; | 179 int num_items_; |
180 int num_tasks_; | 180 int num_tasks_; |
181 base::Semaphore* pending_tasks_; | 181 base::Semaphore* pending_tasks_; |
182 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); | 182 DISALLOW_COPY_AND_ASSIGN(PageParallelJob); |
183 }; | 183 }; |
184 | 184 |
185 } // namespace internal | 185 } // namespace internal |
186 } // namespace v8 | 186 } // namespace v8 |
187 | 187 |
188 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ | 188 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ |
OLD | NEW |