Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerThread.cpp

Issue 2005433002: [Origin Trials] Install origin trial bindings on V8 context conditionally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@track-ef-install
Patch Set: Fix multiple definition of signature; addressing nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 334
334 // Optimize for memory usage instead of latency for the worker isolate. 335 // Optimize for memory usage instead of latency for the worker isolate.
335 isolate()->IsolateInBackgroundNotification(); 336 isolate()->IsolateInBackgroundNotification();
336 m_workerGlobalScope = createWorkerGlobalScope(std::move(startupData)); 337 m_workerGlobalScope = createWorkerGlobalScope(std::move(startupData));
337 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0); 338 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0);
338 339
339 // Notify proxy that a new WorkerGlobalScope has been created and starte d. 340 // Notify proxy that a new WorkerGlobalScope has been created and starte d.
340 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get( )); 341 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get( ));
341 342
342 WorkerOrWorkletScriptController* scriptController = m_workerGlobalScope- >scriptController(); 343 WorkerOrWorkletScriptController* scriptController = m_workerGlobalScope- >scriptController();
343 if (!scriptController->isExecutionForbidden()) 344 if (!scriptController->isExecutionForbidden()) {
344 scriptController->initializeContextIfNeeded(); 345 scriptController->initializeContextIfNeeded();
346
347 // If Origin Trials have been registered before the V8 context was r eady,
348 // then inject them into the context now
349 ExecutionContext* executionContext = m_workerGlobalScope->getExecuti onContext();
350 if (executionContext) {
351 OriginTrialContext* originTrialContext = OriginTrialContext::fro m(executionContext);
352 if (originTrialContext)
353 originTrialContext->initializePendingFeatures();
354 }
355 }
345 } 356 }
346 357
347 if (startMode == PauseWorkerGlobalScopeOnStart) 358 if (startMode == PauseWorkerGlobalScopeOnStart)
348 startRunningDebuggerTasksOnPause(); 359 startRunningDebuggerTasksOnPause();
349 360
350 if (m_workerGlobalScope->scriptController()->isContextInitialized()) { 361 if (m_workerGlobalScope->scriptController()->isContextInitialized()) {
351 m_workerReportingProxy.didInitializeWorkerContext(); 362 m_workerReportingProxy.didInitializeWorkerContext();
352 v8::HandleScope handleScope(isolate()); 363 v8::HandleScope handleScope(isolate());
353 Platform::current()->workerContextCreated(m_workerGlobalScope->scriptCon troller()->context()); 364 Platform::current()->workerContextCreated(m_workerGlobalScope->scriptCon troller()->context());
354 } 365 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 465
455 void WorkerThread::runDebuggerTaskDontWaitOnWorkerThread() 466 void WorkerThread::runDebuggerTaskDontWaitOnWorkerThread()
456 { 467 {
457 DCHECK(isCurrentThread()); 468 DCHECK(isCurrentThread());
458 std::unique_ptr<CrossThreadClosure> task = m_inspectorTaskRunner->takeNextTa sk(InspectorTaskRunner::DontWaitForTask); 469 std::unique_ptr<CrossThreadClosure> task = m_inspectorTaskRunner->takeNextTa sk(InspectorTaskRunner::DontWaitForTask);
459 if (task) 470 if (task)
460 (*task)(); 471 (*task)();
461 } 472 }
462 473
463 } // namespace blink 474 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/v8/WebCoreTestSupport.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698