| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 MutexLocker lock(threadSetMutex()); | 283 MutexLocker lock(threadSetMutex()); |
| 284 ASSERT(workerThreads().contains(this)); | 284 ASSERT(workerThreads().contains(this)); |
| 285 workerThreads().remove(this); | 285 workerThreads().remove(this); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void WorkerThread::start() | 288 void WorkerThread::start() |
| 289 { | 289 { |
| 290 if (m_thread) | 290 if (m_thread) |
| 291 return; | 291 return; |
| 292 | 292 |
| 293 m_thread = WebThreadSupportingGC::create("WebCore: Worker"); | 293 m_thread = createWebThreadSupportingGC(); |
| 294 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&WorkerThread::initialize,
this))); | 294 m_thread->postTask(FROM_HERE, new Task(WTF::bind(&WorkerThread::initialize,
this))); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void WorkerThread::interruptAndDispatchInspectorCommands() | 297 void WorkerThread::interruptAndDispatchInspectorCommands() |
| 298 { | 298 { |
| 299 MutexLocker locker(m_workerInspectorControllerMutex); | 299 MutexLocker locker(m_workerInspectorControllerMutex); |
| 300 if (m_workerInspectorController) | 300 if (m_workerInspectorController) |
| 301 m_workerInspectorController->interruptAndDispatchInspectorCommands(); | 301 m_workerInspectorController->interruptAndDispatchInspectorCommands(); |
| 302 } | 302 } |
| 303 | 303 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip
tCachedMetadataHandler(scriptURL, cachedMetaData.get())); | 353 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip
tCachedMetadataHandler(scriptURL, cachedMetaData.get())); |
| 354 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul
lptr, handler.get(), v8CacheOptions); | 354 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul
lptr, handler.get(), v8CacheOptions); |
| 355 m_workerGlobalScope->didEvaluateWorkerScript(); | 355 m_workerGlobalScope->didEvaluateWorkerScript(); |
| 356 m_workerReportingProxy.didEvaluateWorkerScript(success); | 356 m_workerReportingProxy.didEvaluateWorkerScript(success); |
| 357 | 357 |
| 358 postInitialize(); | 358 postInitialize(); |
| 359 | 359 |
| 360 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler,
this), kShortIdleHandlerDelayMs); | 360 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler,
this), kShortIdleHandlerDelayMs); |
| 361 } | 361 } |
| 362 | 362 |
| 363 PassOwnPtr<WebThreadSupportingGC> WorkerThread::createWebThreadSupportingGC() |
| 364 { |
| 365 return WebThreadSupportingGC::create("WebCore: Worker"); |
| 366 } |
| 367 |
| 363 void WorkerThread::cleanup() | 368 void WorkerThread::cleanup() |
| 364 { | 369 { |
| 365 // This should be called before we start the shutdown procedure. | 370 // This should be called before we start the shutdown procedure. |
| 366 workerReportingProxy().willDestroyWorkerGlobalScope(); | 371 workerReportingProxy().willDestroyWorkerGlobalScope(); |
| 367 | 372 |
| 368 // The below assignment will destroy the context, which will in turn notify
messaging proxy. | 373 // The below assignment will destroy the context, which will in turn notify
messaging proxy. |
| 369 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. | 374 // We cannot let any objects survive past thread exit, because no other thre
ad will run GC or otherwise destroy them. |
| 370 // If Oilpan is enabled, we detach of the context/global scope, with the fin
al heap cleanup below sweeping it out. | 375 // If Oilpan is enabled, we detach of the context/global scope, with the fin
al heap cleanup below sweeping it out. |
| 371 #if !ENABLE(OILPAN) | 376 #if !ENABLE(OILPAN) |
| 372 ASSERT(m_workerGlobalScope->hasOneRef()); | 377 ASSERT(m_workerGlobalScope->hasOneRef()); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 619 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 615 } | 620 } |
| 616 | 621 |
| 617 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 622 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
| 618 { | 623 { |
| 619 MutexLocker locker(m_workerInspectorControllerMutex); | 624 MutexLocker locker(m_workerInspectorControllerMutex); |
| 620 m_workerInspectorController = workerInspectorController; | 625 m_workerInspectorController = workerInspectorController; |
| 621 } | 626 } |
| 622 | 627 |
| 623 } // namespace blink | 628 } // namespace blink |
| OLD | NEW |