| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_LIBPLATFORM_TASK_QUEUE_H_ | 5 #ifndef V8_LIBPLATFORM_TASK_QUEUE_H_ |
| 6 #define V8_LIBPLATFORM_TASK_QUEUE_H_ | 6 #define V8_LIBPLATFORM_TASK_QUEUE_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "include/libplatform/libplatform-export.h" |
| 10 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
| 11 #include "src/base/platform/mutex.h" | 12 #include "src/base/platform/mutex.h" |
| 12 #include "src/base/platform/semaphore.h" | 13 #include "src/base/platform/semaphore.h" |
| 13 #include "testing/gtest/include/gtest/gtest_prod.h" | 14 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 14 | 15 |
| 15 namespace v8 { | 16 namespace v8 { |
| 16 | 17 |
| 17 class Task; | 18 class Task; |
| 18 | 19 |
| 19 namespace platform { | 20 namespace platform { |
| 20 | 21 |
| 21 class TaskQueue { | 22 class V8_PLATFORM_EXPORT TaskQueue { |
| 22 public: | 23 public: |
| 23 TaskQueue(); | 24 TaskQueue(); |
| 24 ~TaskQueue(); | 25 ~TaskQueue(); |
| 25 | 26 |
| 26 // Appends a task to the queue. The queue takes ownership of |task|. | 27 // Appends a task to the queue. The queue takes ownership of |task|. |
| 27 void Append(Task* task); | 28 void Append(Task* task); |
| 28 | 29 |
| 29 // Returns the next task to process. Blocks if no task is available. Returns | 30 // Returns the next task to process. Blocks if no task is available. Returns |
| 30 // NULL if the queue is terminated. | 31 // NULL if the queue is terminated. |
| 31 Task* GetNext(); | 32 Task* GetNext(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 bool terminated_; | 45 bool terminated_; |
| 45 | 46 |
| 46 DISALLOW_COPY_AND_ASSIGN(TaskQueue); | 47 DISALLOW_COPY_AND_ASSIGN(TaskQueue); |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 } // namespace platform | 50 } // namespace platform |
| 50 } // namespace v8 | 51 } // namespace v8 |
| 51 | 52 |
| 52 | 53 |
| 53 #endif // V8_LIBPLATFORM_TASK_QUEUE_H_ | 54 #endif // V8_LIBPLATFORM_TASK_QUEUE_H_ |
| OLD | NEW |