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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp

Issue 2709193002: WorkerLoaderProxy: stop accessing cross-thread execution context (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp
index dd8655f571c7bfb72956c3472964114519b8b6ad..01e0c4173eede66fef0d4a0551f3cc8df3d67a5c 100644
--- a/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.cpp
@@ -4,7 +4,7 @@
#include "core/workers/WorkerLoaderProxy.h"
-#include "core/dom/ExecutionContextTask.h"
+#include "core/dom/ExecutionContext.h"
namespace blink {
@@ -26,7 +26,7 @@ void WorkerLoaderProxy::detachProvider(
void WorkerLoaderProxy::postTaskToLoader(
const WebTraceLocation& location,
- std::unique_ptr<ExecutionContextTask> task) {
+ std::unique_ptr<WTF::CrossThreadClosure> task) {
MutexLocker locker(m_lock);
DCHECK(!isMainThread());
if (!m_loaderProxyProvider)
@@ -37,11 +37,20 @@ void WorkerLoaderProxy::postTaskToLoader(
void WorkerLoaderProxy::postTaskToWorkerGlobalScope(
const WebTraceLocation& location,
std::unique_ptr<WTF::CrossThreadClosure> task) {
- MutexLocker locker(m_lock);
DCHECK(isMainThread());
+ // Note: No locking needed for the access from the main thread.
if (!m_loaderProxyProvider)
return;
m_loaderProxyProvider->postTaskToWorkerGlobalScope(location, std::move(task));
}
+ExecutionContext* WorkerLoaderProxy::getLoaderExecutionContext() {
+ DCHECK(isMainThread());
+ // Note: No locking needed for the access from the main thread.
+ if (!m_loaderProxyProvider)
+ return nullptr;
+ DCHECK(m_loaderProxyProvider->getLoaderExecutionContext()->isContextThread());
+ return m_loaderProxyProvider->getLoaderExecutionContext();
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698