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

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

Issue 2804843005: Implement the infrastructure of creating WorkerFetchContext in worker global scope. (Closed)
Patch Set: s/WebScheduler.h/web_scheduler.h/ Created 3 years, 8 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/WorkerGlobalScope.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
index 7a9c20fdfa9b50e810a40536ab7024e9fd979d9b..a4ee138eff77f7102a53cd46587bbe0e57ed0cf6 100644
--- a/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp
@@ -40,6 +40,7 @@
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/ConsoleMessageStorage.h"
#include "core/inspector/WorkerThreadDebugger.h"
+#include "core/loader/WorkerFetchContext.h"
#include "core/loader/WorkerThreadableLoader.h"
#include "core/probe/CoreProbes.h"
#include "core/workers/WorkerClients.h"
@@ -51,6 +52,7 @@
#include "core/workers/WorkerThread.h"
#include "platform/CrossThreadFunctional.h"
#include "platform/InstanceCounters.h"
+#include "platform/RuntimeEnabledFeatures.h"
#include "platform/loader/fetch/MemoryCache.h"
#include "platform/network/ContentSecurityPolicyParsers.h"
#include "platform/scheduler/child/web_scheduler.h"
@@ -300,6 +302,14 @@ ExecutionContext* WorkerGlobalScope::GetExecutionContext() const {
return const_cast<WorkerGlobalScope*>(this);
}
+WorkerFetchContext* WorkerGlobalScope::GetFetchContext() {
+ DCHECK(RuntimeEnabledFeatures::offMainThreadFetchEnabled());
+ if (fetch_context_)
+ return fetch_context_;
+ fetch_context_ = WorkerFetchContext::Create(*this);
+ return fetch_context_;
+}
+
WorkerGlobalScope::WorkerGlobalScope(
const KURL& url,
const String& user_agent,
@@ -375,6 +385,7 @@ DEFINE_TRACE(WorkerGlobalScope) {
visitor->Trace(timers_);
visitor->Trace(event_listeners_);
visitor->Trace(pending_error_events_);
+ visitor->Trace(fetch_context_);
ExecutionContext::Trace(visitor);
EventTargetWithInlineData::Trace(visitor);
SecurityContext::Trace(visitor);

Powered by Google App Engine
This is Rietveld 408576698