| 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 #ifndef FetchResponseData_h | 5 #ifndef FetchResponseData_h | 
| 6 #define FetchResponseData_h | 6 #define FetchResponseData_h | 
| 7 | 7 | 
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" | 
| 9 #include "platform/weborigin/KURL.h" | 9 #include "platform/weborigin/KURL.h" | 
| 10 #include "wtf/PassRefPtr.h" | 10 #include "wtf/PassRefPtr.h" | 
| 11 #include "wtf/text/AtomicString.h" | 11 #include "wtf/text/AtomicString.h" | 
| 12 | 12 | 
| 13 namespace blink { | 13 namespace blink { | 
| 14 | 14 | 
| 15 class BlobDataHandle; | 15 class BlobDataHandle; | 
|  | 16 class BodyStreamBuffer; | 
| 16 class FetchHeaderList; | 17 class FetchHeaderList; | 
| 17 class WebServiceWorkerResponse; | 18 class WebServiceWorkerResponse; | 
| 18 | 19 | 
| 19 class FetchResponseData final : public GarbageCollectedFinalized<FetchResponseDa
    ta> { | 20 class FetchResponseData final : public GarbageCollectedFinalized<FetchResponseDa
    ta> { | 
| 20     WTF_MAKE_NONCOPYABLE(FetchResponseData); | 21     WTF_MAKE_NONCOPYABLE(FetchResponseData); | 
| 21 public: | 22 public: | 
| 22     // "A response has an associated type which is one of basic, CORS, default, | 23     // "A response has an associated type which is one of basic, CORS, default, | 
| 23     // error, and opaque. Unless stated otherwise, it is default." | 24     // error, and opaque. Unless stated otherwise, it is default." | 
| 24     enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType }; | 25     enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType }; | 
| 25     // "A response can have an associated termination reason which is one of | 26     // "A response can have an associated termination reason which is one of | 
| 26     // end-user abort, fatal, and timeout." | 27     // end-user abort, fatal, and timeout." | 
| 27     enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT
    ermination }; | 28     enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT
    ermination }; | 
| 28 | 29 | 
| 29     static FetchResponseData* create(); | 30     static FetchResponseData* create(); | 
| 30     static FetchResponseData* createNetworkErrorResponse(); | 31     static FetchResponseData* createNetworkErrorResponse(); | 
|  | 32     static FetchResponseData* createWithBuffer(BodyStreamBuffer*); | 
| 31 | 33 | 
| 32     FetchResponseData* createBasicFilteredResponse(); | 34     FetchResponseData* createBasicFilteredResponse(); | 
| 33     FetchResponseData* createCORSFilteredResponse(); | 35     FetchResponseData* createCORSFilteredResponse(); | 
| 34     FetchResponseData* createOpaqueFilteredResponse(); | 36     FetchResponseData* createOpaqueFilteredResponse(); | 
| 35 | 37 | 
|  | 38     FetchResponseData* clone(); | 
|  | 39 | 
| 36     Type type() const { return m_type; } | 40     Type type() const { return m_type; } | 
| 37     const KURL& url() const { return m_url; } | 41     const KURL& url() const { return m_url; } | 
| 38     unsigned short status() const { return m_status; } | 42     unsigned short status() const { return m_status; } | 
| 39     AtomicString statusMessage() const { return m_statusMessage; } | 43     AtomicString statusMessage() const { return m_statusMessage; } | 
| 40     FetchHeaderList* headerList() const { return m_headerList.get(); } | 44     FetchHeaderList* headerList() const { return m_headerList.get(); } | 
| 41     PassRefPtr<BlobDataHandle> blobDataHandle() const { return m_blobDataHandle;
     } | 45     PassRefPtr<BlobDataHandle> blobDataHandle(bool /* internal */) const; | 
|  | 46     BodyStreamBuffer* buffer(bool /* internal */) const; | 
| 42 | 47 | 
| 43     void setURL(const KURL& url) { m_url = url; } | 48     void setURL(const KURL& url) { m_url = url; } | 
| 44     void setStatus(unsigned short status) { m_status = status; } | 49     void setStatus(unsigned short status) { m_status = status; } | 
| 45     void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status
    Message; } | 50     void setStatusMessage(AtomicString statusMessage) { m_statusMessage = status
    Message; } | 
| 46     void setBlobDataHandle(PassRefPtr<BlobDataHandle> blobDataHandle) { m_blobDa
    taHandle = blobDataHandle; } | 51     void setBlobDataHandle(PassRefPtr<BlobDataHandle>); | 
| 47 | 52 | 
| 48     void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&); | 53     void populateWebServiceWorkerResponse(blink::WebServiceWorkerResponse&); | 
| 49 | 54 | 
| 50     void trace(Visitor*); | 55     void trace(Visitor*); | 
| 51 | 56 | 
| 52 private: | 57 private: | 
| 53     FetchResponseData(Type, unsigned short, AtomicString); | 58     FetchResponseData(Type, unsigned short, AtomicString); | 
| 54 | 59 | 
| 55     Type m_type; | 60     Type m_type; | 
| 56     OwnPtr<TerminationReason> m_terminationReason; | 61     OwnPtr<TerminationReason> m_terminationReason; | 
| 57     KURL m_url; | 62     KURL m_url; | 
| 58     unsigned short m_status; | 63     unsigned short m_status; | 
| 59     AtomicString m_statusMessage; | 64     AtomicString m_statusMessage; | 
| 60     Member<FetchHeaderList> m_headerList; | 65     Member<FetchHeaderList> m_headerList; | 
| 61     RefPtr<BlobDataHandle> m_blobDataHandle; | 66     RefPtr<BlobDataHandle> m_blobDataHandle; | 
| 62     Member<FetchResponseData> m_internalResponse; | 67     Member<FetchResponseData> m_internalResponse; | 
|  | 68     Member<BodyStreamBuffer> m_buffer; | 
| 63 }; | 69 }; | 
| 64 | 70 | 
| 65 } // namespace blink | 71 } // namespace blink | 
| 66 | 72 | 
| 67 #endif // FetchResponseData_h | 73 #endif // FetchResponseData_h | 
| OLD | NEW | 
|---|