OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // Defined when linking against shared lib on Windows. | 6 // Defined when linking against shared lib on Windows. |
7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) | 7 #if defined(USING_V8_SHARED) && !defined(V8_SHARED) |
8 #define V8_SHARED | 8 #define V8_SHARED |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 697 |
698 { | 698 { |
699 base::LockGuard<base::Mutex> lock_guard(&workers_mutex_); | 699 base::LockGuard<base::Mutex> lock_guard(&workers_mutex_); |
700 if (!allow_new_workers_) return; | 700 if (!allow_new_workers_) return; |
701 | 701 |
702 Worker* worker = new Worker; | 702 Worker* worker = new Worker; |
703 args.This()->SetInternalField(0, External::New(isolate, worker)); | 703 args.This()->SetInternalField(0, External::New(isolate, worker)); |
704 workers_.Add(worker); | 704 workers_.Add(worker); |
705 | 705 |
706 String::Utf8Value function_string(args[0]->ToString()); | 706 String::Utf8Value function_string(args[0]->ToString()); |
| 707 if (!*function_string) { |
| 708 Throw(args.GetIsolate(), "Function.prototype.toString failed"); |
| 709 return; |
| 710 } |
707 worker->StartExecuteInThread(isolate, *function_string); | 711 worker->StartExecuteInThread(isolate, *function_string); |
708 } | 712 } |
709 } | 713 } |
710 | 714 |
711 | 715 |
712 void Shell::WorkerPostMessage(const v8::FunctionCallbackInfo<v8::Value>& args) { | 716 void Shell::WorkerPostMessage(const v8::FunctionCallbackInfo<v8::Value>& args) { |
713 Isolate* isolate = args.GetIsolate(); | 717 Isolate* isolate = args.GetIsolate(); |
714 HandleScope handle_scope(isolate); | 718 HandleScope handle_scope(isolate); |
715 Local<Context> context = isolate->GetCurrentContext(); | 719 Local<Context> context = isolate->GetCurrentContext(); |
716 | 720 |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 } | 2432 } |
2429 | 2433 |
2430 } // namespace v8 | 2434 } // namespace v8 |
2431 | 2435 |
2432 | 2436 |
2433 #ifndef GOOGLE3 | 2437 #ifndef GOOGLE3 |
2434 int main(int argc, char* argv[]) { | 2438 int main(int argc, char* argv[]) { |
2435 return v8::Shell::Main(argc, argv); | 2439 return v8::Shell::Main(argc, argv); |
2436 } | 2440 } |
2437 #endif | 2441 #endif |
OLD | NEW |