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 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 #include "core/workers/WorkerThread.h" | 27 #include "core/workers/WorkerThread.h" |
28 | 28 |
29 #include "bindings/core/v8/Microtask.h" | 29 #include "bindings/core/v8/Microtask.h" |
30 #include "bindings/core/v8/ScriptSourceCode.h" | 30 #include "bindings/core/v8/ScriptSourceCode.h" |
31 #include "bindings/core/v8/V8GCController.h" | 31 #include "bindings/core/v8/V8GCController.h" |
32 #include "bindings/core/v8/V8IdleTaskRunner.h" | 32 #include "bindings/core/v8/V8IdleTaskRunner.h" |
33 #include "core/inspector/InspectorInstrumentation.h" | 33 #include "core/inspector/InspectorInstrumentation.h" |
34 #include "core/inspector/InspectorTaskRunner.h" | 34 #include "core/inspector/InspectorTaskRunner.h" |
35 #include "core/inspector/WorkerThreadDebugger.h" | 35 #include "core/inspector/WorkerThreadDebugger.h" |
36 #include "core/origin_trials/OriginTrialContext.h" | |
36 #include "core/workers/WorkerBackingThread.h" | 37 #include "core/workers/WorkerBackingThread.h" |
37 #include "core/workers/WorkerClients.h" | 38 #include "core/workers/WorkerClients.h" |
38 #include "core/workers/WorkerReportingProxy.h" | 39 #include "core/workers/WorkerReportingProxy.h" |
39 #include "core/workers/WorkerThreadStartupData.h" | 40 #include "core/workers/WorkerThreadStartupData.h" |
40 #include "platform/ThreadSafeFunctional.h" | 41 #include "platform/ThreadSafeFunctional.h" |
41 #include "platform/WaitableEvent.h" | 42 #include "platform/WaitableEvent.h" |
42 #include "platform/WebThreadSupportingGC.h" | 43 #include "platform/WebThreadSupportingGC.h" |
43 #include "platform/heap/SafePoint.h" | 44 #include "platform/heap/SafePoint.h" |
44 #include "platform/heap/ThreadState.h" | 45 #include "platform/heap/ThreadState.h" |
45 #include "platform/weborigin/KURL.h" | 46 #include "platform/weborigin/KURL.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 | 339 |
339 // Optimize for memory usage instead of latency for the worker isolate. | 340 // Optimize for memory usage instead of latency for the worker isolate. |
340 isolate()->IsolateInBackgroundNotification(); | 341 isolate()->IsolateInBackgroundNotification(); |
341 m_workerGlobalScope = createWorkerGlobalScope(std::move(startupData)); | 342 m_workerGlobalScope = createWorkerGlobalScope(std::move(startupData)); |
342 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0); | 343 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0); |
343 | 344 |
344 // Notify proxy that a new WorkerGlobalScope has been created and starte d. | 345 // Notify proxy that a new WorkerGlobalScope has been created and starte d. |
345 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get( )); | 346 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get( )); |
346 | 347 |
347 WorkerOrWorkletScriptController* scriptController = m_workerGlobalScope- >scriptController(); | 348 WorkerOrWorkletScriptController* scriptController = m_workerGlobalScope- >scriptController(); |
348 if (!scriptController->isExecutionForbidden()) | 349 if (!scriptController->isExecutionForbidden()) { |
349 scriptController->initializeContextIfNeeded(); | 350 scriptController->initializeContextIfNeeded(); |
351 | |
352 // If Origin Trials have been registered before the V8 context was r eady, | |
haraken
2016/05/27 00:01:42
I'm just curious but how can we enable origin-tria
iclelland
2016/05/27 03:19:43
Yes, all resources can now be sent with an HTTP he
| |
353 // then inject them into the context now | |
354 ExecutionContext* executionContext = m_workerGlobalScope->getExecuti onContext(); | |
355 if (executionContext) { | |
356 OriginTrialContext* originTrialContext = OriginTrialContext::fro m(executionContext); | |
357 if (originTrialContext) | |
358 originTrialContext->initializePendingTrials(); | |
359 } | |
360 } | |
350 } | 361 } |
351 | 362 |
352 if (startMode == PauseWorkerGlobalScopeOnStart) | 363 if (startMode == PauseWorkerGlobalScopeOnStart) |
353 startRunningDebuggerTasksOnPause(); | 364 startRunningDebuggerTasksOnPause(); |
354 | 365 |
355 if (m_workerGlobalScope->scriptController()->isContextInitialized()) { | 366 if (m_workerGlobalScope->scriptController()->isContextInitialized()) { |
356 m_workerReportingProxy.didInitializeWorkerContext(); | 367 m_workerReportingProxy.didInitializeWorkerContext(); |
357 v8::HandleScope handleScope(isolate()); | 368 v8::HandleScope handleScope(isolate()); |
358 Platform::current()->workerContextCreated(m_workerGlobalScope->scriptCon troller()->context()); | 369 Platform::current()->workerContextCreated(m_workerGlobalScope->scriptCon troller()->context()); |
359 } | 370 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
457 | 468 |
458 void WorkerThread::runDebuggerTaskDontWaitOnWorkerThread() | 469 void WorkerThread::runDebuggerTaskDontWaitOnWorkerThread() |
459 { | 470 { |
460 DCHECK(isCurrentThread()); | 471 DCHECK(isCurrentThread()); |
461 std::unique_ptr<CrossThreadClosure> task = m_inspectorTaskRunner->takeNextTa sk(InspectorTaskRunner::DontWaitForTask); | 472 std::unique_ptr<CrossThreadClosure> task = m_inspectorTaskRunner->takeNextTa sk(InspectorTaskRunner::DontWaitForTask); |
462 if (task) | 473 if (task) |
463 (*task)(); | 474 (*task)(); |
464 } | 475 } |
465 | 476 |
466 } // namespace blink | 477 } // namespace blink |
OLD | NEW |