Index: Source/modules/fetch/GlobalFetch.h |
diff --git a/Source/modules/fetch/GlobalFetch.h b/Source/modules/fetch/GlobalFetch.h |
index 53788f3d047e64e6e31a2d51cc8abd88566d2c0e..b51a9e79678c72e2b519bdf1c5e774c77d743533 100644 |
--- a/Source/modules/fetch/GlobalFetch.h |
+++ b/Source/modules/fetch/GlobalFetch.h |
@@ -13,13 +13,57 @@ namespace blink { |
class Dictionary; |
class DOMWindow; |
class ExceptionState; |
+class FetchManager; |
class ScriptState; |
class WorkerGlobalScope; |
-class GlobalFetch { |
+class GlobalFetch final : public NoBaseWillBeGarbageCollectedFinalized<GlobalFetch>, public WillBeHeapSupplement<LocalDOMWindow>, public WillBeHeapSupplement<WorkerGlobalScope> { |
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(GlobalFetch); |
public: |
+ static GlobalFetch& from(LocalDOMWindow& supplementable, ExecutionContext*); |
+ static GlobalFetch& from(WorkerGlobalScope& supplementable, ExecutionContext*); |
+ |
+ ScriptPromise fetch(ScriptState*, const RequestInfo& input, const Dictionary& init, ExceptionState&); |
+ |
+ // These count usage and should be called only from v8 bindings. |
static ScriptPromise fetch(ScriptState*, DOMWindow&, const RequestInfo&, const Dictionary&, ExceptionState&); |
static ScriptPromise fetch(ScriptState*, WorkerGlobalScope&, const RequestInfo&, const Dictionary&, ExceptionState&); |
+ |
+ DEFINE_INLINE_VIRTUAL_TRACE() |
+ { |
+ visitor->trace(m_fetchManager); |
+ visitor->trace(m_stopDetector); |
+ WillBeHeapSupplement<LocalDOMWindow>::trace(visitor); |
+ WillBeHeapSupplement<WorkerGlobalScope>::trace(visitor); |
+ } |
+ |
+private: |
+ class StopDetector final : public NoBaseWillBeGarbageCollectedFinalized<StopDetector>, public ActiveDOMObject { |
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(StopDetector); |
+ public: |
+ static PassOwnPtrWillBeRawPtr<StopDetector> create(ExecutionContext*, FetchManager*); |
+ |
+ void stop() override; |
+ |
+ DEFINE_INLINE_TRACE() |
+ { |
+ visitor->trace(m_fetchManager); |
+ ActiveDOMObject::trace(visitor); |
+ } |
+ |
+ private: |
+ StopDetector(ExecutionContext*, FetchManager*); |
+ |
+ // Having a raw pointer is safe, because |m_fetchManager| is owned by |
+ // the owner of this object. |
+ RawPtrWillBeMember<FetchManager> m_fetchManager; |
+ }; |
+ |
+ explicit GlobalFetch(ExecutionContext*); |
+ static const char* name() { return "GlobalFetch"; } |
+ |
+ OwnPtrWillBeMember<FetchManager> m_fetchManager; |
+ OwnPtrWillBeMember<StopDetector> m_stopDetector; |
}; |
} // namespace blink |