| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 { | 270 { |
| 271 MutexLocker lock(m_threadStateMutex); | 271 MutexLocker lock(m_threadStateMutex); |
| 272 if (m_shutdown) | 272 if (m_shutdown) |
| 273 return; | 273 return; |
| 274 m_shutdown = true; | 274 m_shutdown = true; |
| 275 } | 275 } |
| 276 | 276 |
| 277 // This should be called before we start the shutdown procedure. | 277 // This should be called before we start the shutdown procedure. |
| 278 workerReportingProxy().willDestroyWorkerGlobalScope(); | 278 workerReportingProxy().willDestroyWorkerGlobalScope(); |
| 279 | 279 |
| 280 willShutdown(); |
| 280 workerGlobalScope()->dispose(); | 281 workerGlobalScope()->dispose(); |
| 281 | 282 |
| 282 backingThread().removeTaskObserver(m_microtaskRunner.get()); | 283 backingThread().removeTaskObserver(m_microtaskRunner.get()); |
| 283 postTask(FROM_HERE, createSameThreadTask(&WorkerThread::performShutdownTask,
this)); | 284 postTask(FROM_HERE, createSameThreadTask(&WorkerThread::performShutdownTask,
this)); |
| 284 } | 285 } |
| 285 | 286 |
| 286 void WorkerThread::performShutdownTask() | 287 void WorkerThread::performShutdownTask() |
| 287 { | 288 { |
| 288 // The below assignment will destroy the context, which will in turn notify
messaging proxy. | 289 // The below assignment will destroy the context, which will in turn notify
messaging proxy. |
| 289 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. | 290 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 v8::Isolate* isolate = V8PerIsolateData::initialize(); | 450 v8::Isolate* isolate = V8PerIsolateData::initialize(); |
| 450 V8Initializer::initializeWorker(isolate); | 451 V8Initializer::initializeWorker(isolate); |
| 451 | 452 |
| 452 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor
(isolate)); | 453 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor
(isolate)); |
| 453 ThreadState::current()->addInterruptor(interruptor.release()); | 454 ThreadState::current()->addInterruptor(interruptor.release()); |
| 454 ThreadState::current()->registerTraceDOMWrappers(isolate, V8GCController::tr
aceDOMWrappers); | 455 ThreadState::current()->registerTraceDOMWrappers(isolate, V8GCController::tr
aceDOMWrappers); |
| 455 | 456 |
| 456 return isolate; | 457 return isolate; |
| 457 } | 458 } |
| 458 | 459 |
| 460 void WorkerThread::willShutdown() |
| 461 { |
| 462 ASSERT(isCurrentThread()); |
| 463 ASSERT(m_isolate); |
| 464 ASSERT(m_workerGlobalScope->script()); |
| 465 } |
| 466 |
| 459 void WorkerThread::willDestroyIsolate() | 467 void WorkerThread::willDestroyIsolate() |
| 460 { | 468 { |
| 461 ASSERT(isCurrentThread()); | 469 ASSERT(isCurrentThread()); |
| 462 ASSERT(m_isolate); | 470 ASSERT(m_isolate); |
| 463 V8PerIsolateData::willBeDestroyed(m_isolate); | 471 V8PerIsolateData::willBeDestroyed(m_isolate); |
| 464 } | 472 } |
| 465 | 473 |
| 466 void WorkerThread::destroyIsolate() | 474 void WorkerThread::destroyIsolate() |
| 467 { | 475 { |
| 468 ASSERT(isCurrentThread()); | 476 ASSERT(isCurrentThread()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 525 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 518 } | 526 } |
| 519 | 527 |
| 520 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 528 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
| 521 { | 529 { |
| 522 MutexLocker locker(m_workerInspectorControllerMutex); | 530 MutexLocker locker(m_workerInspectorControllerMutex); |
| 523 m_workerInspectorController = workerInspectorController; | 531 m_workerInspectorController = workerInspectorController; |
| 524 } | 532 } |
| 525 | 533 |
| 526 } // namespace blink | 534 } // namespace blink |
| OLD | NEW |