| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Notify the main thread that it is safe to deallocate our resource
s. | 280 // Notify the main thread that it is safe to deallocate our resource
s. |
| 281 m_terminationEvent->signal(); | 281 m_terminationEvent->signal(); |
| 282 return; | 282 return; |
| 283 } | 283 } |
| 284 | 284 |
| 285 m_microtaskRunner = adoptPtr(new WorkerMicrotaskRunner(this)); | 285 m_microtaskRunner = adoptPtr(new WorkerMicrotaskRunner(this)); |
| 286 initializeBackingThread(); | 286 initializeBackingThread(); |
| 287 backingThread().addTaskObserver(m_microtaskRunner.get()); | 287 backingThread().addTaskObserver(m_microtaskRunner.get()); |
| 288 | 288 |
| 289 m_isolate = initializeIsolate(); | 289 m_isolate = initializeIsolate(); |
| 290 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) { | |
| 291 V8PerIsolateData::enableIdleTasks(m_isolate, adoptPtr(new V8IdleTask
Runner(m_webScheduler))); | |
| 292 } | |
| 293 // Optimize for memory usage instead of latency for the worker isolate. | 290 // Optimize for memory usage instead of latency for the worker isolate. |
| 294 m_isolate->IsolateInBackgroundNotification(); | 291 m_isolate->IsolateInBackgroundNotification(); |
| 295 m_workerGlobalScope = createWorkerGlobalScope(startupData); | 292 m_workerGlobalScope = createWorkerGlobalScope(startupData); |
| 296 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge
t() ? cachedMetaData->size() : 0); | 293 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge
t() ? cachedMetaData->size() : 0); |
| 297 | 294 |
| 298 didStartWorkerThread(); | 295 didStartWorkerThread(); |
| 299 | 296 |
| 300 // Notify proxy that a new WorkerGlobalScope has been created and starte
d. | 297 // Notify proxy that a new WorkerGlobalScope has been created and starte
d. |
| 301 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get(
)); | 298 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get(
)); |
| 302 | 299 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 v8::Isolate* WorkerThread::initializeIsolate() | 477 v8::Isolate* WorkerThread::initializeIsolate() |
| 481 { | 478 { |
| 482 ASSERT(isCurrentThread()); | 479 ASSERT(isCurrentThread()); |
| 483 ASSERT(!m_isolate); | 480 ASSERT(!m_isolate); |
| 484 v8::Isolate* isolate = V8PerIsolateData::initialize(); | 481 v8::Isolate* isolate = V8PerIsolateData::initialize(); |
| 485 V8Initializer::initializeWorker(isolate); | 482 V8Initializer::initializeWorker(isolate); |
| 486 | 483 |
| 487 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor
(isolate)); | 484 OwnPtr<V8IsolateInterruptor> interruptor = adoptPtr(new V8IsolateInterruptor
(isolate)); |
| 488 ThreadState::current()->addInterruptor(interruptor.release()); | 485 ThreadState::current()->addInterruptor(interruptor.release()); |
| 489 ThreadState::current()->registerTraceDOMWrappers(isolate, V8GCController::tr
aceDOMWrappers); | 486 ThreadState::current()->registerTraceDOMWrappers(isolate, V8GCController::tr
aceDOMWrappers); |
| 490 | 487 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) |
| 488 V8PerIsolateData::enableIdleTasks(isolate, adoptPtr(new V8IdleTaskRunner
(m_webScheduler))); |
| 491 return isolate; | 489 return isolate; |
| 492 } | 490 } |
| 493 | 491 |
| 494 void WorkerThread::willDestroyIsolate() | 492 void WorkerThread::willDestroyIsolate() |
| 495 { | 493 { |
| 496 ASSERT(isCurrentThread()); | 494 ASSERT(isCurrentThread()); |
| 497 ASSERT(m_isolate); | 495 ASSERT(m_isolate); |
| 498 V8PerIsolateData::willBeDestroyed(m_isolate); | 496 V8PerIsolateData::willBeDestroyed(m_isolate); |
| 499 } | 497 } |
| 500 | 498 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 550 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 553 } | 551 } |
| 554 | 552 |
| 555 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 553 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
| 556 { | 554 { |
| 557 MutexLocker locker(m_workerInspectorControllerMutex); | 555 MutexLocker locker(m_workerInspectorControllerMutex); |
| 558 m_workerInspectorController = workerInspectorController; | 556 m_workerInspectorController = workerInspectorController; |
| 559 } | 557 } |
| 560 | 558 |
| 561 } // namespace blink | 559 } // namespace blink |
| OLD | NEW |