| 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 FetchBodyStream_h | 5 #ifndef FetchBodyStream_h |
| 6 #define FetchBodyStream_h | 6 #define FetchBodyStream_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
| 11 #include "core/dom/ActiveDOMObject.h" | 11 #include "core/dom/ActiveDOMObject.h" |
| 12 #include "core/fileapi/FileReaderLoader.h" | 12 #include "core/fileapi/FileReaderLoader.h" |
| 13 #include "core/fileapi/FileReaderLoaderClient.h" | 13 #include "core/fileapi/FileReaderLoaderClient.h" |
| 14 #include "platform/blob/BlobData.h" | 14 #include "platform/blob/BlobData.h" |
| 15 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
| 16 #include "wtf/RefCounted.h" | |
| 17 #include "wtf/RefPtr.h" | 16 #include "wtf/RefPtr.h" |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 | 19 |
| 21 class ScriptState; | 20 class ScriptState; |
| 22 | 21 |
| 23 class FetchBodyStream FINAL | 22 class FetchBodyStream FINAL |
| 24 : public RefCountedWillBeGarbageCollectedFinalized<FetchBodyStream> | 23 : public GarbageCollectedFinalized<FetchBodyStream> |
| 25 , public ScriptWrappable | 24 , public ScriptWrappable |
| 26 , public ActiveDOMObject | 25 , public ActiveDOMObject |
| 27 , public FileReaderLoaderClient { | 26 , public FileReaderLoaderClient { |
| 28 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 29 public: | 28 public: |
| 30 enum ResponseType { | 29 enum ResponseType { |
| 31 ResponseAsArrayBuffer, | 30 ResponseAsArrayBuffer, |
| 32 ResponseAsBlob, | 31 ResponseAsBlob, |
| 33 ResponseAsFormData, | 32 ResponseAsFormData, |
| 34 ResponseAsJSON, | 33 ResponseAsJSON, |
| 35 ResponseAsText | 34 ResponseAsText |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 static PassRefPtrWillBeRawPtr<FetchBodyStream> create(ExecutionContext*, Pas
sRefPtr<BlobDataHandle>); | 37 static FetchBodyStream* create(ExecutionContext*, PassRefPtr<BlobDataHandle>
); |
| 39 | 38 |
| 40 ScriptPromise asArrayBuffer(ScriptState*); | 39 ScriptPromise asArrayBuffer(ScriptState*); |
| 41 ScriptPromise asBlob(ScriptState*); | 40 ScriptPromise asBlob(ScriptState*); |
| 42 ScriptPromise asFormData(ScriptState*); | 41 ScriptPromise asFormData(ScriptState*); |
| 43 ScriptPromise asJSON(ScriptState*); | 42 ScriptPromise asJSON(ScriptState*); |
| 44 ScriptPromise asText(ScriptState*); | 43 ScriptPromise asText(ScriptState*); |
| 45 | 44 |
| 46 // ActiveDOMObject override. | 45 // ActiveDOMObject override. |
| 47 virtual void stop() OVERRIDE; | 46 virtual void stop() OVERRIDE; |
| 48 virtual bool hasPendingActivity() const OVERRIDE; | 47 virtual bool hasPendingActivity() const OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 63 RefPtr<BlobDataHandle> m_blobDataHandle; | 62 RefPtr<BlobDataHandle> m_blobDataHandle; |
| 64 OwnPtr<FileReaderLoader> m_loader; | 63 OwnPtr<FileReaderLoader> m_loader; |
| 65 bool m_hasRead; | 64 bool m_hasRead; |
| 66 ResponseType m_responseType; | 65 ResponseType m_responseType; |
| 67 RefPtr<ScriptPromiseResolver> m_resolver; | 66 RefPtr<ScriptPromiseResolver> m_resolver; |
| 68 }; | 67 }; |
| 69 | 68 |
| 70 } // namespace blink | 69 } // namespace blink |
| 71 | 70 |
| 72 #endif // FetchBodyStream_h | 71 #endif // FetchBodyStream_h |
| OLD | NEW |