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

Unified Diff: Source/modules/fetch/GlobalFetch.h

Issue 1065093006: FetchAPI: Make GlobalFetch available from other components Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | Source/modules/fetch/GlobalFetch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | Source/modules/fetch/GlobalFetch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698