| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/fetch/GlobalFetch.h" | 5 #include "modules/fetch/GlobalFetch.h" |
| 6 | 6 |
| 7 #include "core/frame/LocalDOMWindow.h" | 7 #include "core/frame/LocalDOMWindow.h" |
| 8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
| 9 #include "core/inspector/InspectorInstrumentation.h" | 9 #include "core/inspector/InspectorInstrumentation.h" |
| 10 #include "core/workers/WorkerGlobalScope.h" | 10 #include "core/workers/WorkerGlobalScope.h" |
| 11 #include "modules/fetch/FetchManager.h" | 11 #include "modules/fetch/FetchManager.h" |
| 12 #include "modules/fetch/Request.h" | 12 #include "modules/fetch/Request.h" |
| 13 #include "platform/Supplementable.h" | 13 #include "platform/Supplementable.h" |
| 14 #include "platform/heap/Handle.h" | 14 #include "platform/heap/Handle.h" |
| 15 #include "wtf/OwnPtr.h" | |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 template <typename T> | 20 template <typename T> |
| 22 class GlobalFetchImpl final : public GarbageCollectedFinalized<GlobalFetchImpl<T
>>, public GlobalFetch::ScopedFetcher, public Supplement<T> { | 21 class GlobalFetchImpl final : public GarbageCollectedFinalized<GlobalFetchImpl<T
>>, public GlobalFetch::ScopedFetcher, public Supplement<T> { |
| 23 USING_GARBAGE_COLLECTED_MIXIN(GlobalFetchImpl); | 22 USING_GARBAGE_COLLECTED_MIXIN(GlobalFetchImpl); |
| 24 public: | 23 public: |
| 25 static ScopedFetcher* from(T& supplementable, ExecutionContext* executionCon
text) | 24 static ScopedFetcher* from(T& supplementable, ExecutionContext* executionCon
text) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 100 } |
| 102 | 101 |
| 103 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) | 102 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, WorkerGlobalScope& wo
rker, const RequestInfo& input, const Dictionary& init, ExceptionState& exceptio
nState) |
| 104 { | 103 { |
| 105 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. | 104 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. |
| 106 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); | 105 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); |
| 107 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio
nState); | 106 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, exceptio
nState); |
| 108 } | 107 } |
| 109 | 108 |
| 110 } // namespace blink | 109 } // namespace blink |
| OLD | NEW |