| 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 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/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 class MODULES_EXPORT Response final : public Body { | 31 class MODULES_EXPORT Response final : public Body { |
| 32 DEFINE_WRAPPERTYPEINFO(); | 32 DEFINE_WRAPPERTYPEINFO(); |
| 33 WTF_MAKE_NONCOPYABLE(Response); | 33 WTF_MAKE_NONCOPYABLE(Response); |
| 34 public: | 34 public: |
| 35 ~Response() override { } | 35 ~Response() override { } |
| 36 | 36 |
| 37 // From Response.idl: | 37 // From Response.idl: |
| 38 static Response* create(ScriptState*, ExceptionState&); | 38 static Response* create(ScriptState*, ExceptionState&); |
| 39 static Response* create(ScriptState*, ScriptValue body, const Dictionary&, E
xceptionState&); | 39 static Response* create(ScriptState*, ScriptValue body, const Dictionary&, E
xceptionState&); |
| 40 | 40 |
| 41 static Response* create(ExecutionContext*, PassOwnPtr<FetchDataConsumerHandl
e> bodyHandle, const String& contentType, const ResponseInit&, ExceptionState&); | 41 static Response* create(ScriptState*, PassOwnPtr<FetchDataConsumerHandle> bo
dyHandle, const String& contentType, const ResponseInit&, ExceptionState&); |
| 42 static Response* create(ExecutionContext*, FetchResponseData*); | 42 static Response* create(ExecutionContext*, FetchResponseData*); |
| 43 static Response* create(ExecutionContext*, const WebServiceWorkerResponse&); | 43 static Response* create(ScriptState*, const WebServiceWorkerResponse&); |
| 44 | 44 |
| 45 static Response* createClone(const Response&); | 45 static Response* createClone(const Response&); |
| 46 | 46 |
| 47 static Response* error(ExecutionContext*); | 47 static Response* error(ExecutionContext*); |
| 48 static Response* redirect(ExecutionContext*, const String& url, unsigned sho
rt status, ExceptionState&); | 48 static Response* redirect(ExecutionContext*, const String& url, unsigned sho
rt status, ExceptionState&); |
| 49 | 49 |
| 50 const FetchResponseData* response() const { return m_response; } | 50 const FetchResponseData* response() const { return m_response; } |
| 51 | 51 |
| 52 // From Response.idl: | 52 // From Response.idl: |
| 53 String type() const; | 53 String type() const; |
| 54 String url() const; | 54 String url() const; |
| 55 unsigned short status() const; | 55 unsigned short status() const; |
| 56 bool ok() const; | 56 bool ok() const; |
| 57 String statusText() const; | 57 String statusText() const; |
| 58 Headers* headers() const; | 58 Headers* headers() const; |
| 59 | 59 |
| 60 // From Response.idl: | 60 // From Response.idl: |
| 61 Response* clone(ExceptionState&); | 61 Response* clone(ScriptState*, ExceptionState&); |
| 62 | 62 |
| 63 // ActiveScriptWrappable | 63 // ActiveScriptWrappable |
| 64 bool hasPendingActivity() const final; | 64 bool hasPendingActivity() const final; |
| 65 | 65 |
| 66 // ActiveDOMObject | |
| 67 void stop() override; | |
| 68 | |
| 69 // Does not call response.setBlobDataHandle(). | 66 // Does not call response.setBlobDataHandle(). |
| 70 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response
*/); | 67 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response
*/); |
| 71 | 68 |
| 72 bool hasBody() const; | 69 bool hasBody() const; |
| 73 BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); } | 70 BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); } |
| 74 const BodyStreamBuffer* bodyBuffer() const override { return m_response->buf
fer(); } | 71 const BodyStreamBuffer* bodyBuffer() const override { return m_response->buf
fer(); } |
| 75 BodyStreamBuffer* internalBodyBuffer() { return m_response->internalBuffer()
; } | 72 BodyStreamBuffer* internalBodyBuffer() { return m_response->internalBuffer()
; } |
| 76 const BodyStreamBuffer* internalBodyBuffer() const { return m_response->inte
rnalBuffer(); } | 73 const BodyStreamBuffer* internalBodyBuffer() const { return m_response->inte
rnalBuffer(); } |
| 77 bool bodyUsed() override; | 74 bool bodyUsed() override; |
| 78 | 75 |
| 79 String mimeType() const override; | 76 String mimeType() const override; |
| 80 String internalMIMEType() const; | 77 String internalMIMEType() const; |
| 81 | 78 |
| 82 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
| 83 | 80 |
| 84 private: | 81 private: |
| 85 explicit Response(ExecutionContext*); | 82 explicit Response(ExecutionContext*); |
| 86 Response(ExecutionContext*, FetchResponseData*); | 83 Response(ExecutionContext*, FetchResponseData*); |
| 87 Response(ExecutionContext*, FetchResponseData*, Headers*); | 84 Response(ExecutionContext*, FetchResponseData*, Headers*); |
| 88 | 85 |
| 89 const Member<FetchResponseData> m_response; | 86 const Member<FetchResponseData> m_response; |
| 90 const Member<Headers> m_headers; | 87 const Member<Headers> m_headers; |
| 91 }; | 88 }; |
| 92 | 89 |
| 93 } // namespace blink | 90 } // namespace blink |
| 94 | 91 |
| 95 #endif // Response_h | 92 #endif // Response_h |
| OLD | NEW |