Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: Source/modules/fetch/Response.h

Issue 1233573002: [Fetch API] Remove DrainingBuffer. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/fetch/Request.cpp ('k') | Source/modules/fetch/Response.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 Response_h 5 #ifndef Response_h
6 #define Response_h 6 #define Response_h
7 7
8 #include "bindings/core/v8/Dictionary.h" 8 #include "bindings/core/v8/Dictionary.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "bindings/modules/v8/UnionTypesModules.h" 10 #include "bindings/modules/v8/UnionTypesModules.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "modules/fetch/Body.h" 12 #include "modules/fetch/Body.h"
13 #include "modules/fetch/BodyStreamBuffer.h" 13 #include "modules/fetch/BodyStreamBuffer.h"
14 #include "modules/fetch/FetchResponseData.h" 14 #include "modules/fetch/FetchResponseData.h"
15 #include "modules/fetch/Headers.h" 15 #include "modules/fetch/Headers.h"
16 #include "platform/blob/BlobData.h" 16 #include "platform/blob/BlobData.h"
17 #include "platform/heap/Handle.h" 17 #include "platform/heap/Handle.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 class Blob; 21 class Blob;
22 class DrainingBodyStreamBuffer;
23 class DOMArrayBuffer; 22 class DOMArrayBuffer;
24 class ExceptionState; 23 class ExceptionState;
25 class ResponseInit; 24 class ResponseInit;
26 class WebServiceWorkerResponse; 25 class WebServiceWorkerResponse;
27 26
28 typedef BlobOrArrayBufferOrArrayBufferViewOrFormDataOrUSVString BodyInit; 27 typedef BlobOrArrayBufferOrArrayBufferViewOrFormDataOrUSVString BodyInit;
29 28
30 class MODULES_EXPORT Response final : public Body, public BodyStreamBuffer::Drai ningStreamNotificationClient { 29 class MODULES_EXPORT Response final : public Body {
31 DEFINE_WRAPPERTYPEINFO(); 30 DEFINE_WRAPPERTYPEINFO();
32 USING_GARBAGE_COLLECTED_MIXIN(Response); 31 WTF_MAKE_NONCOPYABLE(Response);
33 public: 32 public:
34 ~Response() override { } 33 ~Response() override { }
35 34
36 // From Response.idl: 35 // From Response.idl:
37 static Response* create(ExecutionContext*, ExceptionState&); 36 static Response* create(ExecutionContext*, ExceptionState&);
38 static Response* create(ExecutionContext*, const BodyInit&, const Dictionary &, ExceptionState&); 37 static Response* create(ExecutionContext*, const BodyInit&, const Dictionary &, ExceptionState&);
39 38
40 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep tionState&); 39 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep tionState&);
41 static Response* create(ExecutionContext*, FetchResponseData*); 40 static Response* create(ExecutionContext*, FetchResponseData*);
42 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); 41 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&);
(...skipping 16 matching lines...) Expand all
59 // From Response.idl: 58 // From Response.idl:
60 Response* clone(ExceptionState&); 59 Response* clone(ExceptionState&);
61 60
62 // ActiveDOMObject 61 // ActiveDOMObject
63 bool hasPendingActivity() const override; 62 bool hasPendingActivity() const override;
64 63
65 // Does not call response.setBlobDataHandle(). 64 // Does not call response.setBlobDataHandle().
66 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response */); 65 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response */);
67 66
68 bool hasBody() const; 67 bool hasBody() const;
68 BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); }
69 const BodyStreamBuffer* bodyBuffer() const override { return m_response->buf fer(); }
70 BodyStreamBuffer* internalBodyBuffer() { return m_response->internalBuffer() ; }
71 const BodyStreamBuffer* internalBodyBuffer() const { return m_response->inte rnalBuffer(); }
69 72
70 String mimeType() const override; 73 String mimeType() const override;
71 String internalMIMEType() const; 74 String internalMIMEType() const;
72 75
73 // Do not call leakBuffer() on the returned buffer because
74 // hasPendingActivity() assumes didFetchDataLoadFinishedFromDrainingStream()
75 // will be called.
76 PassOwnPtr<DrainingBodyStreamBuffer> createInternalDrainingStream();
77 void didFetchDataLoadFinishedFromDrainingStream() override;
78
79 // Only for tests (null checks and identity checks).
80 void* bufferForTest() const;
81 void* internalBufferForTest() const;
82
83 DECLARE_VIRTUAL_TRACE(); 76 DECLARE_VIRTUAL_TRACE();
84 77
85 private: 78 private:
86 explicit Response(ExecutionContext*); 79 explicit Response(ExecutionContext*);
87 Response(ExecutionContext*, FetchResponseData*); 80 Response(ExecutionContext*, FetchResponseData*);
88 Response(ExecutionContext*, FetchResponseData*, Headers*); 81 Response(ExecutionContext*, FetchResponseData*, Headers*);
89 82
90 void refreshBody();
91
92 const Member<FetchResponseData> m_response; 83 const Member<FetchResponseData> m_response;
93 const Member<Headers> m_headers; 84 const Member<Headers> m_headers;
94 bool m_isInternalDrained;
95 }; 85 };
96 86
97 } // namespace blink 87 } // namespace blink
98 88
99 #endif // Response_h 89 #endif // Response_h
OLDNEW
« no previous file with comments | « Source/modules/fetch/Request.cpp ('k') | Source/modules/fetch/Response.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698