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 #ifndef V8_D8_H_ | 5 #ifndef V8_D8_H_ |
6 #define V8_D8_H_ | 6 #define V8_D8_H_ |
7 | 7 |
8 #ifndef V8_SHARED | 8 #ifndef V8_SHARED |
9 #include "src/allocation.h" | 9 #include "src/allocation.h" |
10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 explicit WorkerThread(Worker* worker) | 250 explicit WorkerThread(Worker* worker) |
251 : base::Thread(base::Thread::Options("WorkerThread")), | 251 : base::Thread(base::Thread::Options("WorkerThread")), |
252 worker_(worker) {} | 252 worker_(worker) {} |
253 | 253 |
254 virtual void Run() { worker_->ExecuteInThread(); } | 254 virtual void Run() { worker_->ExecuteInThread(); } |
255 | 255 |
256 private: | 256 private: |
257 Worker* worker_; | 257 Worker* worker_; |
258 }; | 258 }; |
259 | 259 |
| 260 enum State { IDLE, RUNNING, TERMINATED }; |
| 261 |
260 void ExecuteInThread(); | 262 void ExecuteInThread(); |
261 void Cleanup(); | 263 void Cleanup(); |
262 static void PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args); | 264 static void PostMessageOut(const v8::FunctionCallbackInfo<v8::Value>& args); |
263 | 265 |
264 base::Semaphore in_semaphore_; | 266 base::Semaphore in_semaphore_; |
265 base::Semaphore out_semaphore_; | 267 base::Semaphore out_semaphore_; |
266 SerializationDataQueue in_queue_; | 268 SerializationDataQueue in_queue_; |
267 SerializationDataQueue out_queue_; | 269 SerializationDataQueue out_queue_; |
268 base::Thread* thread_; | 270 base::Thread* thread_; |
269 char* script_; | 271 char* script_; |
| 272 base::Atomic32 state_; |
270 }; | 273 }; |
271 #endif // !V8_SHARED | 274 #endif // !V8_SHARED |
272 | 275 |
273 | 276 |
274 class ShellOptions { | 277 class ShellOptions { |
275 public: | 278 public: |
276 ShellOptions() | 279 ShellOptions() |
277 : script_executed(false), | 280 : script_executed(false), |
278 last_run(true), | 281 last_run(true), |
279 send_idle_notification(false), | 282 send_idle_notification(false), |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 #ifndef V8_SHARED | 457 #ifndef V8_SHARED |
455 static Persistent<Context> utility_context_; | 458 static Persistent<Context> utility_context_; |
456 static CounterMap* counter_map_; | 459 static CounterMap* counter_map_; |
457 // We statically allocate a set of local counters to be used if we | 460 // We statically allocate a set of local counters to be used if we |
458 // don't want to store the stats in a memory-mapped file | 461 // don't want to store the stats in a memory-mapped file |
459 static CounterCollection local_counters_; | 462 static CounterCollection local_counters_; |
460 static CounterCollection* counters_; | 463 static CounterCollection* counters_; |
461 static base::OS::MemoryMappedFile* counters_file_; | 464 static base::OS::MemoryMappedFile* counters_file_; |
462 static base::Mutex context_mutex_; | 465 static base::Mutex context_mutex_; |
463 static const base::TimeTicks kInitialTicks; | 466 static const base::TimeTicks kInitialTicks; |
| 467 |
| 468 static base::Mutex workers_mutex_; |
| 469 static bool allow_new_workers_; |
464 static i::List<Worker*> workers_; | 470 static i::List<Worker*> workers_; |
465 static i::List<SharedArrayBuffer::Contents> externalized_shared_contents_; | 471 static i::List<SharedArrayBuffer::Contents> externalized_shared_contents_; |
466 | 472 |
467 static Counter* GetCounter(const char* name, bool is_histogram); | 473 static Counter* GetCounter(const char* name, bool is_histogram); |
468 static void InstallUtilityScript(Isolate* isolate); | 474 static void InstallUtilityScript(Isolate* isolate); |
469 #endif // !V8_SHARED | 475 #endif // !V8_SHARED |
470 static void Initialize(Isolate* isolate); | 476 static void Initialize(Isolate* isolate); |
471 static void InitializeDebugger(Isolate* isolate); | 477 static void InitializeDebugger(Isolate* isolate); |
472 static void RunShell(Isolate* isolate); | 478 static void RunShell(Isolate* isolate); |
473 static bool SetOptions(int argc, char* argv[]); | 479 static bool SetOptions(int argc, char* argv[]); |
474 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); | 480 static Handle<ObjectTemplate> CreateGlobalTemplate(Isolate* isolate); |
475 }; | 481 }; |
476 | 482 |
477 | 483 |
478 } // namespace v8 | 484 } // namespace v8 |
479 | 485 |
480 | 486 |
481 #endif // V8_D8_H_ | 487 #endif // V8_D8_H_ |
OLD | NEW |