Index: test/cctest/print-extension.cc |
diff --git a/src/libplatform/worker-thread.cc b/test/cctest/print-extension.cc |
similarity index 72% |
copy from src/libplatform/worker-thread.cc |
copy to test/cctest/print-extension.cc |
index cca8a9719a88d953a9d05d770e5aa6478a563e6a..9f629195bd7909c1a97760484cea37b600461b98 100644 |
--- a/src/libplatform/worker-thread.cc |
+++ b/test/cctest/print-extension.cc |
@@ -1,4 +1,4 @@ |
-// Copyright 2013 the V8 project authors. All rights reserved. |
+// Copyright 2014 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,32 +25,27 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-#include "worker-thread.h" |
- |
-// TODO(jochen): We should have our own version of checks.h. |
-#include "../checks.h" |
-#include "../../include/v8-platform.h" |
-#include "task-queue.h" |
+#include "print-extension.h" |
namespace v8 { |
namespace internal { |
-WorkerThread::WorkerThread(TaskQueue* queue) |
- : Thread("V8 WorkerThread"), queue_(queue) { |
- Start(); |
-} |
- |
- |
-WorkerThread::~WorkerThread() { |
- Join(); |
+v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate( |
+ v8::Isolate* isolate, |
+ v8::Handle<v8::String> str) { |
+ return v8::FunctionTemplate::New(isolate, PrintExtension::Print); |
} |
-void WorkerThread::Run() { |
- while (Task* task = queue_->GetNext()) { |
- task->Run(); |
- delete task; |
+void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ for (int i = 0; i < args.Length(); i++) { |
+ if (i != 0) printf(" "); |
+ v8::HandleScope scope(args.GetIsolate()); |
+ v8::String::Utf8Value str(args[i]); |
+ if (*str == NULL) return; |
+ printf("%s", *str); |
} |
+ printf("\n"); |
} |
} } // namespace v8::internal |