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

Unified Diff: test/cctest/test-libplatform-worker-thread.cc

Issue 104583003: [platform] Implement a worker pool (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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
Index: test/cctest/test-libplatform-worker-thread.cc
diff --git a/src/default-platform.cc b/test/cctest/test-libplatform-worker-thread.cc
similarity index 71%
rename from src/default-platform.cc
rename to test/cctest/test-libplatform-worker-thread.cc
index ef3c4ebd450bbc63ae99b4534a22fa5bd67a2f39..652edb67ff95ac067102c8b57d572aaf217ded72 100644
--- a/src/default-platform.cc
+++ b/test/cctest/test-libplatform-worker-thread.cc
@@ -27,30 +27,36 @@
#include "v8.h"
-#include "default-platform.h"
+#include "cctest.h"
+#include "libplatform/task-queue.h"
+#include "libplatform/worker-thread.h"
+#include "test-libplatform.h"
-namespace v8 {
-namespace internal {
+using namespace v8::internal;
-DefaultPlatform::DefaultPlatform() {}
+TEST(WorkerThread) {
+ TaskQueue queue;
+ TestTask* task1 = new TestTask(true);
+ TestTask* task2 = new TestTask(true);
+ TestTask* task3 = new TestTask(true);
+ TestTask* task4 = new TestTask(true);
-DefaultPlatform::~DefaultPlatform() {}
-
-void DefaultPlatform::CallOnBackgroundThread(Task *task,
- ExpectedRuntime expected_runtime) {
- // TODO(jochen): implement.
- task->Run();
- delete task;
-}
+ WorkerThread thread1(&queue);
+ WorkerThread thread2(&queue);
+ thread1.Start();
+ thread2.Start();
-void DefaultPlatform::CallOnForegroundThread(v8::Isolate* isolate, Task* task) {
- // TODO(jochen): implement.
- task->Run();
- delete task;
-}
+ queue.Append(task1);
+ queue.Append(task2);
+ queue.Append(task3);
+ queue.Append(task4);
+ // TaskQueue ASSERTs that it is empty in its dtor.
+ queue.Terminate();
-} } // namespace v8::internal
+ thread1.Join();
+ thread2.Join();
+}

Powered by Google App Engine
This is Rietveld 408576698