Lines Matching refs:Worker
173 Worker* GetWorkerFromInternalField(Isolate* isolate, Local<Object> object) {
175 Throw(isolate, "this is not a Worker");
179 Worker* worker =
180 static_cast<Worker*>(object->GetAlignedPointerFromInternalField(0));
181 if (worker == NULL) {
182 Throw(isolate, "Worker is defunct because main thread is terminating");
186 return worker;
354 i::List<Worker*> Shell::workers_;
1064 Throw(args.GetIsolate(), "Worker must be constructed with new");
1076 // creating a new Worker (because the main thread is terminating) we can
1082 Worker* worker = new Worker;
1083 args.Holder()->SetAlignedPointerInInternalField(0, worker);
1084 workers_.Add(worker);
1088 Throw(args.GetIsolate(), "Can't get worker script");
1091 worker->StartExecuteInThread(*script);
1106 Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
1107 if (!worker) {
1139 worker->PostMessage(data);
1149 Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
1150 if (!worker) {
1154 SerializationData* data = worker->GetMessage();
1169 Worker* worker = GetWorkerFromInternalField(isolate, args.Holder());
1170 if (!worker) {
1174 worker->Terminate();
1493 String::NewFromUtf8(isolate, "Worker", NewStringType::kNormal)
1513 String::NewFromUtf8(isolate, "Worker", NewStringType::kNormal)
2127 Worker::Worker()
2135 Worker::~Worker() {
2145 void Worker::StartExecuteInThread(const char* script) {
2153 void Worker::PostMessage(SerializationData* data) {
2159 SerializationData* Worker::GetMessage() {
2162 // If the worker is no longer running, and there are no messages in the
2171 void Worker::Terminate() {
2173 // Post NULL to wake the Worker thread message loop, and tell it to stop
2179 void Worker::WaitForThread() {
2185 void Worker::ExecuteInThread() {
2260 void Worker::PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args) {
2271 // TODO(binji): Allow transferring from worker to main thread?
2280 Worker* worker = static_cast<Worker*>(this_value->Value());
2281 worker->out_queue_.Enqueue(data);
2282 worker->out_semaphore_.Signal();
2705 // Make a copy of workers_, because we don't want to call Worker::Terminate
2706 // while holding the workers_mutex_ lock. Otherwise, if a worker is about to
2707 // create a new Worker, it would deadlock.
2708 i::List<Worker*> workers_copy;
2717 Worker* worker = workers_copy[i];
2718 worker->WaitForThread();
2719 delete worker;
2722 // Now that all workers are terminated, we can re-enable Worker creation.