blob: 5bffc172fb6d52f6d6935393f02205d693d8200c [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_FETCH_GLOBAL_FETCH_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_FETCH_GLOBAL_FETCH_H_
#include "third_party/blink/renderer/bindings/core/v8/script_promise.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/fetch/request.h"
namespace blink {
class LocalDOMWindow;
class ExceptionState;
class RequestInit;
class ScriptState;
class WorkerGlobalScope;
class CORE_EXPORT GlobalFetch {
STATIC_ONLY(GlobalFetch);
public:
class CORE_EXPORT ScopedFetcher : public GarbageCollectedMixin {
public:
virtual ~ScopedFetcher();
virtual ScriptPromise Fetch(ScriptState*,
const RequestInfo&,
const RequestInit*,
ExceptionState&) = 0;
// Returns the number of fetch() method calls in the associated execution
// context. This is used for metrics.
virtual uint32_t FetchCount() const = 0;
static ScopedFetcher* From(LocalDOMWindow&);
static ScopedFetcher* From(WorkerGlobalScope&);
void Trace(Visitor*) const override;
};
static ScriptPromise fetch(ScriptState*,
LocalDOMWindow&,
const RequestInfo&,
const RequestInit*,
ExceptionState&);
static ScriptPromise fetch(ScriptState*,
WorkerGlobalScope&,
const RequestInfo&,
const RequestInit*,
ExceptionState&);
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_FETCH_GLOBAL_FETCH_H_