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

Unified Diff: src/libplatform/task-queue.cc

Issue 2270703002: Add test for posting a single task to the worker pool (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: different approach Created 4 years, 4 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/libplatform/task-queue.h ('k') | test/unittests/libplatform/worker-thread-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/libplatform/task-queue.h ('k') | test/unittests/libplatform/worker-thread-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698