mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-31 06:05:44 +00:00
36db9eff13
--HG-- extra : transplant_source : o%29%0E%5D%90%11%FA%1ExO%26%7E%9D_%F2%E7%0B%FE%21%B2
60 lines
1.5 KiB
C++
60 lines
1.5 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef mozilla_dom_FetchDriver_h
|
|
#define mozilla_dom_FetchDriver_h
|
|
|
|
#include "nsIStreamListener.h"
|
|
#include "nsRefPtr.h"
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
|
|
class InternalRequest;
|
|
class InternalResponse;
|
|
|
|
class FetchDriverObserver
|
|
{
|
|
public:
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FetchDriverObserver);
|
|
virtual void OnResponseAvailable(InternalResponse* aResponse) = 0;
|
|
|
|
protected:
|
|
virtual ~FetchDriverObserver()
|
|
{ };
|
|
};
|
|
|
|
class FetchDriver MOZ_FINAL
|
|
{
|
|
NS_INLINE_DECL_REFCOUNTING(FetchDriver)
|
|
public:
|
|
explicit FetchDriver(InternalRequest* aRequest);
|
|
NS_IMETHOD Fetch(FetchDriverObserver* aObserver);
|
|
|
|
private:
|
|
nsRefPtr<InternalRequest> mRequest;
|
|
nsRefPtr<FetchDriverObserver> mObserver;
|
|
uint32_t mFetchRecursionCount;
|
|
|
|
FetchDriver() MOZ_DELETE;
|
|
FetchDriver(const FetchDriver&) MOZ_DELETE;
|
|
FetchDriver& operator=(const FetchDriver&) MOZ_DELETE;
|
|
~FetchDriver();
|
|
|
|
nsresult Fetch(bool aCORSFlag);
|
|
nsresult ContinueFetch(bool aCORSFlag);
|
|
nsresult BasicFetch();
|
|
nsresult FailWithNetworkError();
|
|
nsresult BeginResponse(InternalResponse* aResponse);
|
|
nsresult SucceedWithResponse();
|
|
};
|
|
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
#endif // mozilla_dom_FetchDriver_h
|