Index: src/libplatform/task-queue.cc |
diff --git a/src/libplatform/task-queue.cc b/src/libplatform/task-queue.cc |
index 0a630ed3c394aff140f75e8ec10b660b6538ccd1..ada13d9fe947301a2bff2d202916eb2aee1efb10 100644 |
--- a/src/libplatform/task-queue.cc |
+++ b/src/libplatform/task-queue.cc |
@@ -5,6 +5,8 @@ |
#include "src/libplatform/task-queue.h" |
#include "src/base/logging.h" |
+#include "src/base/platform/platform.h" |
+#include "src/base/platform/time.h" |
namespace v8 { |
namespace platform { |
@@ -53,5 +55,15 @@ void TaskQueue::Terminate() { |
process_queue_semaphore_.Signal(); |
} |
+void TaskQueue::BlockUntilQueueEmptyForTesting() { |
+ for (;;) { |
+ { |
+ base::LockGuard<base::Mutex> guard(&lock_); |
+ if (task_queue_.empty()) return; |
+ } |
+ base::OS::Sleep(base::TimeDelta::FromMilliseconds(5)); |
+ } |
+} |
+ |
} // namespace platform |
} // namespace v8 |