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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 if (!m_thread) | 304 if (!m_thread) |
305 return 0; | 305 return 0; |
306 return m_thread->platformThread().threadId(); | 306 return m_thread->platformThread().threadId(); |
307 } | 307 } |
308 | 308 |
309 void WorkerThread::initialize() | 309 void WorkerThread::initialize() |
310 { | 310 { |
311 KURL scriptURL = m_startupData->m_scriptURL; | 311 KURL scriptURL = m_startupData->m_scriptURL; |
312 String sourceCode = m_startupData->m_sourceCode; | 312 String sourceCode = m_startupData->m_sourceCode; |
313 WorkerThreadStartMode startMode = m_startupData->m_startMode; | 313 WorkerThreadStartMode startMode = m_startupData->m_startMode; |
| 314 OwnPtr<Vector<char>> cachedMetaData = m_startupData->m_cachedMetaData.releas
e(); |
| 315 V8CacheOptions v8CacheOptions = m_startupData->m_v8CacheOptions; |
314 | 316 |
315 { | 317 { |
316 MutexLocker lock(m_threadCreationMutex); | 318 MutexLocker lock(m_threadCreationMutex); |
317 | 319 |
318 // The worker was terminated before the thread had a chance to run. | 320 // The worker was terminated before the thread had a chance to run. |
319 if (m_terminated) { | 321 if (m_terminated) { |
320 // Notify the proxy that the WorkerGlobalScope has been disposed of. | 322 // Notify the proxy that the WorkerGlobalScope has been disposed of. |
321 // This can free this thread object, hence it must not be touched af
terwards. | 323 // This can free this thread object, hence it must not be touched af
terwards. |
322 m_workerReportingProxy.workerThreadTerminated(); | 324 m_workerReportingProxy.workerThreadTerminated(); |
323 return; | 325 return; |
(...skipping 11 matching lines...) Expand all Loading... |
335 // The corresponding call to stopRunLoop() is in ~WorkerScriptController(). | 337 // The corresponding call to stopRunLoop() is in ~WorkerScriptController(). |
336 didStartRunLoop(); | 338 didStartRunLoop(); |
337 | 339 |
338 // Notify proxy that a new WorkerGlobalScope has been created and started. | 340 // Notify proxy that a new WorkerGlobalScope has been created and started. |
339 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); | 341 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); |
340 | 342 |
341 WorkerScriptController* script = m_workerGlobalScope->script(); | 343 WorkerScriptController* script = m_workerGlobalScope->script(); |
342 if (!script->isExecutionForbidden()) | 344 if (!script->isExecutionForbidden()) |
343 script->initializeContextIfNeeded(); | 345 script->initializeContextIfNeeded(); |
344 InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), star
tMode); | 346 InspectorInstrumentation::willEvaluateWorkerScript(workerGlobalScope(), star
tMode); |
345 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL)); | 347 |
| 348 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip
tCachedMetadataHandler(scriptURL, cachedMetaData.get())); |
| 349 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul
lptr, handler.get(), v8CacheOptions); |
346 m_workerGlobalScope->didEvaluateWorkerScript(); | 350 m_workerGlobalScope->didEvaluateWorkerScript(); |
347 m_workerReportingProxy.didEvaluateWorkerScript(success); | 351 m_workerReportingProxy.didEvaluateWorkerScript(success); |
348 | 352 |
349 postInitialize(); | 353 postInitialize(); |
350 | 354 |
351 postDelayedTask(createSameThreadTask(&WorkerThread::idleHandler, this), kSho
rtIdleHandlerDelayMs); | 355 postDelayedTask(createSameThreadTask(&WorkerThread::idleHandler, this), kSho
rtIdleHandlerDelayMs); |
352 } | 356 } |
353 | 357 |
354 void WorkerThread::cleanup() | 358 void WorkerThread::cleanup() |
355 { | 359 { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 570 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
567 } | 571 } |
568 | 572 |
569 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 573 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
570 { | 574 { |
571 MutexLocker locker(m_workerInspectorControllerMutex); | 575 MutexLocker locker(m_workerInspectorControllerMutex); |
572 m_workerInspectorController = workerInspectorController; | 576 m_workerInspectorController = workerInspectorController; |
573 } | 577 } |
574 | 578 |
575 } // namespace blink | 579 } // namespace blink |
OLD | NEW |