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

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

Issue 555443002: [Fetch API] Put body members directly on Response/Request (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: incorporated yhirano's comment Created 6 years, 3 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
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 "modules/serviceworkers/FetchBodyStream.h" 10 #include "modules/serviceworkers/Body.h"
11 #include "modules/serviceworkers/FetchResponseData.h" 11 #include "modules/serviceworkers/FetchResponseData.h"
12 #include "modules/serviceworkers/Headers.h" 12 #include "modules/serviceworkers/Headers.h"
13 #include "platform/blob/BlobData.h" 13 #include "platform/blob/BlobData.h"
14 #include "platform/heap/Handle.h" 14 #include "platform/heap/Handle.h"
15 #include "wtf/Forward.h" 15 #include "wtf/Forward.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 class Blob; 19 class Blob;
20 class ExceptionState; 20 class ExceptionState;
21 class ResponseInit; 21 class ResponseInit;
22 class WebServiceWorkerResponse; 22 class WebServiceWorkerResponse;
23 23
24 class Response FINAL : public GarbageCollected<Response>, public ScriptWrappable { 24 class Response FINAL : public Body {
25 DEFINE_WRAPPERTYPEINFO(); 25 DEFINE_WRAPPERTYPEINFO();
26 public: 26 public:
27 static Response* create(Blob*, const Dictionary&, ExceptionState&); 27 virtual ~Response() { }
28 static Response* create(const String&, const Dictionary&, ExceptionState&); 28 static Response* create(ExecutionContext*, Blob*, const Dictionary&, Excepti onState&);
29 static Response* create(const ArrayBuffer*, const Dictionary&, ExceptionStat e&); 29 static Response* create(ExecutionContext*, const String&, const Dictionary&, ExceptionState&);
30 static Response* create(const ArrayBufferView*, const Dictionary&, Exception State&); 30 static Response* create(ExecutionContext*, const ArrayBuffer*, const Diction ary&, ExceptionState&);
31 static Response* create(Blob*, const ResponseInit&, ExceptionState&); 31 static Response* create(ExecutionContext*, const ArrayBufferView*, const Dic tionary&, ExceptionState&);
32 static Response* create(FetchResponseData*); 32 static Response* create(ExecutionContext*, Blob*, const ResponseInit&, Excep tionState&);
33 static Response* create(const WebServiceWorkerResponse&); 33 static Response* create(ExecutionContext*, FetchResponseData*);
34 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&);
34 35
35 String type() const; 36 String type() const;
36 String url() const; 37 String url() const;
37 unsigned short status() const; 38 unsigned short status() const;
38 String statusText() const; 39 String statusText() const;
39 Headers* headers() const; 40 Headers* headers() const;
40 41
41 FetchBodyStream* body(ExecutionContext*);
42
43 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&); 42 void populateWebServiceWorkerResponse(WebServiceWorkerResponse&);
44 43
45 void trace(Visitor*); 44 virtual void trace(Visitor*) OVERRIDE;
46 45
47 private: 46 private:
48 Response(); 47 explicit Response(ExecutionContext*);
49 explicit Response(FetchResponseData*); 48 Response(ExecutionContext*, FetchResponseData*);
50 explicit Response(const WebServiceWorkerResponse&); 49 Response(ExecutionContext*, const WebServiceWorkerResponse&);
50
51 virtual PassRefPtr<BlobDataHandle> blobDataHandle() OVERRIDE;
51 52
52 Member<FetchResponseData> m_response; 53 Member<FetchResponseData> m_response;
53 Member<Headers> m_headers; 54 Member<Headers> m_headers;
54 Member<FetchBodyStream> m_fetchBodyStream;
55 }; 55 };
56 56
57 } // namespace blink 57 } // namespace blink
58 58
59 #endif // Response_h 59 #endif // Response_h
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RequestTest.cpp ('k') | Source/modules/serviceworkers/Response.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698