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 "modules/ModulesExport.h" | 8 #include "modules/ModulesExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "platform/weborigin/KURL.h" | 10 #include "platform/weborigin/KURL.h" |
11 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 11 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
13 #include "wtf/text/AtomicString.h" | 13 #include "wtf/text/AtomicString.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 class BodyStreamBuffer; | 17 class BodyStreamBuffer; |
18 class ExecutionContext; | |
19 class FetchHeaderList; | 18 class FetchHeaderList; |
| 19 class ScriptState; |
20 class WebServiceWorkerResponse; | 20 class WebServiceWorkerResponse; |
21 | 21 |
22 class MODULES_EXPORT FetchResponseData final : public GarbageCollectedFinalized<
FetchResponseData> { | 22 class MODULES_EXPORT FetchResponseData final : public GarbageCollectedFinalized<
FetchResponseData> { |
23 WTF_MAKE_NONCOPYABLE(FetchResponseData); | 23 WTF_MAKE_NONCOPYABLE(FetchResponseData); |
24 public: | 24 public: |
25 // "A response has an associated type which is one of basic, CORS, default, | 25 // "A response has an associated type which is one of basic, CORS, default, |
26 // error, opaque, and opaqueredirect. Unless stated otherwise, it is | 26 // error, opaque, and opaqueredirect. Unless stated otherwise, it is |
27 // default." | 27 // default." |
28 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType, OpaqueR
edirectType }; | 28 enum Type { BasicType, CORSType, DefaultType, ErrorType, OpaqueType, OpaqueR
edirectType }; |
29 // "A response can have an associated termination reason which is one of | 29 // "A response can have an associated termination reason which is one of |
30 // end-user abort, fatal, and timeout." | 30 // end-user abort, fatal, and timeout." |
31 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT
ermination }; | 31 enum TerminationReason { EndUserAbortTermination, FatalTermination, TimeoutT
ermination }; |
32 | 32 |
33 static FetchResponseData* create(); | 33 static FetchResponseData* create(); |
34 static FetchResponseData* createNetworkErrorResponse(); | 34 static FetchResponseData* createNetworkErrorResponse(); |
35 static FetchResponseData* createWithBuffer(BodyStreamBuffer*); | 35 static FetchResponseData* createWithBuffer(BodyStreamBuffer*); |
36 | 36 |
37 FetchResponseData* createBasicFilteredResponse(); | 37 FetchResponseData* createBasicFilteredResponse(); |
38 FetchResponseData* createCORSFilteredResponse(); | 38 FetchResponseData* createCORSFilteredResponse(); |
39 FetchResponseData* createOpaqueFilteredResponse(); | 39 FetchResponseData* createOpaqueFilteredResponse(); |
40 FetchResponseData* createOpaqueRedirectFilteredResponse(); | 40 FetchResponseData* createOpaqueRedirectFilteredResponse(); |
41 | 41 |
42 FetchResponseData* clone(ExecutionContext*); | 42 FetchResponseData* clone(ScriptState*); |
43 | 43 |
44 Type getType() const { return m_type; } | 44 Type getType() const { return m_type; } |
45 const KURL& url() const { return m_url; } | 45 const KURL& url() const { return m_url; } |
46 unsigned short status() const { return m_status; } | 46 unsigned short status() const { return m_status; } |
47 AtomicString statusMessage() const { return m_statusMessage; } | 47 AtomicString statusMessage() const { return m_statusMessage; } |
48 FetchHeaderList* headerList() const { return m_headerList.get(); } | 48 FetchHeaderList* headerList() const { return m_headerList.get(); } |
49 BodyStreamBuffer* buffer() const { return m_buffer; } | 49 BodyStreamBuffer* buffer() const { return m_buffer; } |
50 String mimeType() const; | 50 String mimeType() const; |
51 BodyStreamBuffer* internalBuffer() const; | 51 BodyStreamBuffer* internalBuffer() const; |
52 String internalMIMEType() const; | 52 String internalMIMEType() const; |
(...skipping 30 matching lines...) Expand all Loading... |
83 Member<FetchResponseData> m_internalResponse; | 83 Member<FetchResponseData> m_internalResponse; |
84 Member<BodyStreamBuffer> m_buffer; | 84 Member<BodyStreamBuffer> m_buffer; |
85 String m_mimeType; | 85 String m_mimeType; |
86 int64_t m_responseTime; | 86 int64_t m_responseTime; |
87 String m_cacheStorageCacheName; | 87 String m_cacheStorageCacheName; |
88 }; | 88 }; |
89 | 89 |
90 } // namespace blink | 90 } // namespace blink |
91 | 91 |
92 #endif // FetchResponseData_h | 92 #endif // FetchResponseData_h |
OLD | NEW |