| Index: Source/modules/fetch/GlobalFetch.cpp
|
| diff --git a/Source/modules/fetch/GlobalFetch.cpp b/Source/modules/fetch/GlobalFetch.cpp
|
| index 5a720252922d8c82274a52be3f9d056625a20e23..4e9f9530fd66782aaace923fbf743dd680f06034 100644
|
| --- a/Source/modules/fetch/GlobalFetch.cpp
|
| +++ b/Source/modules/fetch/GlobalFetch.cpp
|
| @@ -19,16 +19,25 @@ namespace blink {
|
|
|
| namespace {
|
|
|
| -template <typename T>
|
| -class GlobalFetchImpl final : public NoBaseWillBeGarbageCollectedFinalized<GlobalFetchImpl<T>>, public WillBeHeapSupplement<T> {
|
| +class GlobalFetchImpl final : public NoBaseWillBeGarbageCollectedFinalized<GlobalFetchImpl>, public WillBeHeapSupplement<LocalDOMWindow>, public WillBeHeapSupplement<WorkerGlobalScope> {
|
| WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(GlobalFetchImpl);
|
| public:
|
| - static GlobalFetchImpl& from(T& supplementable, ExecutionContext* executionContext)
|
| + static GlobalFetchImpl& from(LocalDOMWindow& supplementable, ExecutionContext* executionContext)
|
| {
|
| - GlobalFetchImpl* supplement = static_cast<GlobalFetchImpl*>(WillBeHeapSupplement<T>::from(supplementable, name()));
|
| + GlobalFetchImpl* supplement = static_cast<GlobalFetchImpl*>(WillBeHeapSupplement<LocalDOMWindow>::from(supplementable, name()));
|
| if (!supplement) {
|
| supplement = new GlobalFetchImpl(executionContext);
|
| - WillBeHeapSupplement<T>::provideTo(supplementable, name(), adoptPtrWillBeNoop(supplement));
|
| + WillBeHeapSupplement<LocalDOMWindow>::provideTo(supplementable, name(), adoptPtrWillBeNoop(supplement));
|
| + }
|
| + return *supplement;
|
| + }
|
| +
|
| + static GlobalFetchImpl& from(WorkerGlobalScope& supplementable, ExecutionContext* executionContext)
|
| + {
|
| + GlobalFetchImpl* supplement = static_cast<GlobalFetchImpl*>(WillBeHeapSupplement<WorkerGlobalScope>::from(supplementable, name()));
|
| + if (!supplement) {
|
| + supplement = new GlobalFetchImpl(executionContext);
|
| + WillBeHeapSupplement<WorkerGlobalScope>::provideTo(supplementable, name(), adoptPtrWillBeNoop(supplement));
|
| }
|
| return *supplement;
|
| }
|
| @@ -53,7 +62,8 @@ public:
|
| {
|
| visitor->trace(m_fetchManager);
|
| visitor->trace(m_stopDetector);
|
| - WillBeHeapSupplement<T>::trace(visitor);
|
| + WillBeHeapSupplement<LocalDOMWindow>::trace(visitor);
|
| + WillBeHeapSupplement<WorkerGlobalScope>::trace(visitor);
|
| }
|
|
|
| private:
|
| @@ -102,14 +112,14 @@ private:
|
| ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, DOMWindow& window, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptionState)
|
| {
|
| UseCounter::count(window.executionContext(), UseCounter::Fetch);
|
| - return GlobalFetchImpl<LocalDOMWindow>::from(toLocalDOMWindow(window), window.executionContext()).fetch(scriptState, input, init, exceptionState);
|
| + return GlobalFetchImpl::from(toLocalDOMWindow(window), window.executionContext()).fetch(scriptState, input, init, exceptionState);
|
| }
|
|
|
| ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& worker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptionState)
|
| {
|
| // Note that UseCounter doesn't work with SharedWorker or ServiceWorker.
|
| UseCounter::count(worker.executionContext(), UseCounter::Fetch);
|
| - return GlobalFetchImpl<WorkerGlobalScope>::from(worker, worker.executionContext()).fetch(scriptState, input, init, exceptionState);
|
| + return GlobalFetchImpl::from(worker, worker.executionContext()).fetch(scriptState, input, init, exceptionState);
|
| }
|
|
|
| } // namespace blink
|
|
|