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