| 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 12 matching lines...) Expand all Loading... |
| 23 class ExceptionState; | 23 class ExceptionState; |
| 24 class FetchDataConsumerHandle; | 24 class FetchDataConsumerHandle; |
| 25 class ResponseInit; | 25 class ResponseInit; |
| 26 class ScriptState; | 26 class ScriptState; |
| 27 class WebServiceWorkerResponse; | 27 class WebServiceWorkerResponse; |
| 28 | 28 |
| 29 class MODULES_EXPORT Response final : public Body { | 29 class MODULES_EXPORT Response final : public Body { |
| 30 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
| 31 WTF_MAKE_NONCOPYABLE(Response); | 31 WTF_MAKE_NONCOPYABLE(Response); |
| 32 public: | 32 public: |
| 33 // These "create" function which takes a ScriptState* must be called with |
| 34 // entering an appropriate V8 context. |
| 33 // From Response.idl: | 35 // From Response.idl: |
| 34 static Response* create(ScriptState*, ExceptionState&); | 36 static Response* create(ScriptState*, ExceptionState&); |
| 35 static Response* create(ScriptState*, ScriptValue body, const Dictionary&, E
xceptionState&); | 37 static Response* create(ScriptState*, ScriptValue body, const Dictionary&, E
xceptionState&); |
| 36 | 38 |
| 37 static Response* create(ScriptState*, BodyStreamBuffer*, const String& conte
ntType, const ResponseInit&, ExceptionState&); | 39 static Response* create(ScriptState*, BodyStreamBuffer*, const String& conte
ntType, const ResponseInit&, ExceptionState&); |
| 38 static Response* create(ExecutionContext*, FetchResponseData*); | 40 static Response* create(ExecutionContext*, FetchResponseData*); |
| 39 static Response* create(ScriptState*, const WebServiceWorkerResponse&); | 41 static Response* create(ScriptState*, const WebServiceWorkerResponse&); |
| 40 | 42 |
| 41 static Response* createClone(const Response&); | 43 static Response* createClone(const Response&); |
| 42 | 44 |
| 43 static Response* error(ExecutionContext*); | 45 static Response* error(ExecutionContext*); |
| 44 static Response* redirect(ExecutionContext*, const String& url, unsigned sho
rt status, ExceptionState&); | 46 static Response* redirect(ExecutionContext*, const String& url, unsigned sho
rt status, ExceptionState&); |
| 45 | 47 |
| 46 const FetchResponseData* response() const { return m_response; } | 48 const FetchResponseData* response() const { return m_response; } |
| 47 | 49 |
| 48 // From Response.idl: | 50 // From Response.idl: |
| 49 String type() const; | 51 String type() const; |
| 50 String url() const; | 52 String url() const; |
| 51 unsigned short status() const; | 53 unsigned short status() const; |
| 52 bool ok() const; | 54 bool ok() const; |
| 53 String statusText() const; | 55 String statusText() const; |
| 54 Headers* headers() const; | 56 Headers* headers() const; |
| 55 | 57 |
| 56 // From Response.idl: | 58 // From Response.idl: |
| 59 // This function must be called with entering an appropriate V8 context. |
| 57 Response* clone(ScriptState*, ExceptionState&); | 60 Response* clone(ScriptState*, ExceptionState&); |
| 58 | 61 |
| 59 // ActiveScriptWrappable | 62 // ActiveScriptWrappable |
| 60 bool hasPendingActivity() const final; | 63 bool hasPendingActivity() const final; |
| 61 | 64 |
| 62 // Does not call response.setBlobDataHandle(). | 65 // Does not call response.setBlobDataHandle(). |
| 63 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response
*/); | 66 void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response
*/); |
| 64 | 67 |
| 65 bool hasBody() const; | 68 bool hasBody() const; |
| 66 BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); } | 69 BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 82 void installBody(); | 85 void installBody(); |
| 83 void refreshBody(ScriptState*); | 86 void refreshBody(ScriptState*); |
| 84 | 87 |
| 85 const Member<FetchResponseData> m_response; | 88 const Member<FetchResponseData> m_response; |
| 86 const Member<Headers> m_headers; | 89 const Member<Headers> m_headers; |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 } // namespace blink | 92 } // namespace blink |
| 90 | 93 |
| 91 #endif // Response_h | 94 #endif // Response_h |
| OLD | NEW |