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

Side by Side Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 2196133002: Revert of Pass per-frame task runners to Workers (when possible) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: crud Created 4 years, 4 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/web/WebSharedWorkerImpl.h ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 21 matching lines...) Expand all
32 32
33 #include "core/dom/CrossThreadTask.h" 33 #include "core/dom/CrossThreadTask.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/events/MessageEvent.h" 35 #include "core/events/MessageEvent.h"
36 #include "core/html/HTMLFormElement.h" 36 #include "core/html/HTMLFormElement.h"
37 #include "core/inspector/ConsoleMessage.h" 37 #include "core/inspector/ConsoleMessage.h"
38 #include "core/inspector/InspectorInstrumentation.h" 38 #include "core/inspector/InspectorInstrumentation.h"
39 #include "core/loader/FrameLoadRequest.h" 39 #include "core/loader/FrameLoadRequest.h"
40 #include "core/loader/FrameLoader.h" 40 #include "core/loader/FrameLoader.h"
41 #include "core/page/Page.h" 41 #include "core/page/Page.h"
42 #include "core/workers/ParentFrameTaskRunners.h"
43 #include "core/workers/SharedWorkerGlobalScope.h" 42 #include "core/workers/SharedWorkerGlobalScope.h"
44 #include "core/workers/SharedWorkerThread.h" 43 #include "core/workers/SharedWorkerThread.h"
45 #include "core/workers/WorkerClients.h" 44 #include "core/workers/WorkerClients.h"
46 #include "core/workers/WorkerGlobalScope.h" 45 #include "core/workers/WorkerGlobalScope.h"
47 #include "core/workers/WorkerInspectorProxy.h" 46 #include "core/workers/WorkerInspectorProxy.h"
48 #include "core/workers/WorkerLoaderProxy.h" 47 #include "core/workers/WorkerLoaderProxy.h"
49 #include "core/workers/WorkerScriptLoader.h" 48 #include "core/workers/WorkerScriptLoader.h"
50 #include "core/workers/WorkerThreadStartupData.h" 49 #include "core/workers/WorkerThreadStartupData.h"
51 #include "platform/CrossThreadFunctional.h" 50 #include "platform/CrossThreadFunctional.h"
52 #include "platform/RuntimeEnabledFeatures.h" 51 #include "platform/RuntimeEnabledFeatures.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 { 264 {
266 m_client->workerContextDestroyed(); 265 m_client->workerContextDestroyed();
267 // The lifetime of this proxy is controlled by the worker context. 266 // The lifetime of this proxy is controlled by the worker context.
268 delete this; 267 delete this;
269 } 268 }
270 269
271 // WorkerLoaderProxyProvider --------------------------------------------------- -------- 270 // WorkerLoaderProxyProvider --------------------------------------------------- --------
272 271
273 void WebSharedWorkerImpl::postTaskToLoader(const WebTraceLocation& location, std ::unique_ptr<ExecutionContextTask> task) 272 void WebSharedWorkerImpl::postTaskToLoader(const WebTraceLocation& location, std ::unique_ptr<ExecutionContextTask> task)
274 { 273 {
275 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and
276 // consider using m_mainThreadTaskRunners->getLoadingTaskRunner() instead.
277 m_mainFrame->frame()->document()->postTask(location, std::move(task)); 274 m_mainFrame->frame()->document()->postTask(location, std::move(task));
278 } 275 }
279 276
280 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(const WebTraceLocation& lo cation, std::unique_ptr<ExecutionContextTask> task) 277 bool WebSharedWorkerImpl::postTaskToWorkerGlobalScope(const WebTraceLocation& lo cation, std::unique_ptr<ExecutionContextTask> task)
281 { 278 {
282 m_workerThread->postTask(location, std::move(task)); 279 m_workerThread->postTask(location, std::move(task));
283 return true; 280 return true;
284 } 281 }
285 282
286 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) 283 void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 m_mainScriptLoader->script(), 344 m_mainScriptLoader->script(),
348 nullptr, 345 nullptr,
349 startMode, 346 startMode,
350 contentSecurityPolicy ? contentSecurityPolicy->headers().get() : nullptr , 347 contentSecurityPolicy ? contentSecurityPolicy->headers().get() : nullptr ,
351 m_mainScriptLoader->referrerPolicy(), 348 m_mainScriptLoader->referrerPolicy(),
352 starterOrigin, 349 starterOrigin,
353 workerClients, 350 workerClients,
354 m_mainScriptLoader->responseAddressSpace(), 351 m_mainScriptLoader->responseAddressSpace(),
355 m_mainScriptLoader->originTrialTokens(), 352 m_mainScriptLoader->originTrialTokens(),
356 std::move(workerSettings)); 353 std::move(workerSettings));
357
358 // We have a dummy document here for loading but it doesn't really represent
359 // the document/frame of associated document(s) for this worker. Here we
360 // populate the task runners with null document not to confuse the frame
361 // scheduler (which will end up using the thread's default task runner).
362 m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr);
363
364 m_loaderProxy = WorkerLoaderProxy::create(this); 354 m_loaderProxy = WorkerLoaderProxy::create(this);
365 m_workerThread = SharedWorkerThread::create(m_name, m_loaderProxy, *this); 355 m_workerThread = SharedWorkerThread::create(m_name, m_loaderProxy, *this);
366 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri ptLoader->identifier(), m_mainScriptLoader->script()); 356 InspectorInstrumentation::scriptImported(m_loadingDocument.get(), m_mainScri ptLoader->identifier(), m_mainScriptLoader->script());
367 m_mainScriptLoader.clear(); 357 m_mainScriptLoader.clear();
368 358
369 workerThread()->start(std::move(startupData)); 359 workerThread()->start(std::move(startupData));
370 m_workerInspectorProxy->workerThreadCreated(toDocument(m_loadingDocument.get ()), workerThread(), m_url); 360 m_workerInspectorProxy->workerThreadCreated(toDocument(m_loadingDocument.get ()), workerThread(), m_url);
371 m_client->workerScriptLoaded(); 361 m_client->workerScriptLoaded();
372 } 362 }
373 363
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (devtoolsAgent) 401 if (devtoolsAgent)
412 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes sage); 402 devtoolsAgent->dispatchOnInspectorBackend(sessionId, callId, method, mes sage);
413 } 403 }
414 404
415 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client) 405 WebSharedWorker* WebSharedWorker::create(WebSharedWorkerClient* client)
416 { 406 {
417 return new WebSharedWorkerImpl(client); 407 return new WebSharedWorkerImpl(client);
418 } 408 }
419 409
420 } // namespace blink 410 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698