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