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