| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 FetchDataLoader_h | 5 #ifndef FetchDataLoader_h |
| 6 #define FetchDataLoader_h | 6 #define FetchDataLoader_h |
| 7 | 7 |
| 8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
| 9 #include "core/streams/Stream.h" |
| 9 #include "modules/fetch/FetchDataConsumerHandle.h" | 10 #include "modules/fetch/FetchDataConsumerHandle.h" |
| 10 #include "platform/blob/BlobData.h" | 11 #include "platform/blob/BlobData.h" |
| 11 #include "platform/heap/Handle.h" | 12 #include "platform/heap/Handle.h" |
| 12 #include "wtf/Forward.h" | 13 #include "wtf/Forward.h" |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 // FetchDataLoader subclasses | 17 // FetchDataLoader subclasses |
| 17 // 1. take a reader of FetchDataConsumerHandle |handle|, | 18 // 1. take a reader of FetchDataConsumerHandle |handle|, |
| 18 // 2. read all data, and | 19 // 2. read all data, and |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 ASSERT_NOT_REACHED(); | 37 ASSERT_NOT_REACHED(); |
| 37 } | 38 } |
| 38 virtual void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer>) | 39 virtual void didFetchDataLoadedArrayBuffer(PassRefPtr<DOMArrayBuffer>) |
| 39 { | 40 { |
| 40 ASSERT_NOT_REACHED(); | 41 ASSERT_NOT_REACHED(); |
| 41 } | 42 } |
| 42 virtual void didFetchDataLoadedString(const String&) | 43 virtual void didFetchDataLoadedString(const String&) |
| 43 { | 44 { |
| 44 ASSERT_NOT_REACHED(); | 45 ASSERT_NOT_REACHED(); |
| 45 } | 46 } |
| 47 // This is called after all data are read from |handle| and written |
| 48 // to |outStream|, and |outStream| is closed or aborted. |
| 49 virtual void didFetchDataLoadedStream() |
| 50 { |
| 51 ASSERT_NOT_REACHED(); |
| 52 } |
| 46 | 53 |
| 47 virtual void didFetchDataLoadFailed() = 0; | 54 virtual void didFetchDataLoadFailed() = 0; |
| 48 | 55 |
| 49 DEFINE_INLINE_VIRTUAL_TRACE() { } | 56 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 50 }; | 57 }; |
| 51 | 58 |
| 52 static FetchDataLoader* createLoaderAsBlobHandle(const String& mimeType); | 59 static FetchDataLoader* createLoaderAsBlobHandle(const String& mimeType); |
| 53 static FetchDataLoader* createLoaderAsArrayBuffer(); | 60 static FetchDataLoader* createLoaderAsArrayBuffer(); |
| 54 static FetchDataLoader* createLoaderAsString(); | 61 static FetchDataLoader* createLoaderAsString(); |
| 62 static FetchDataLoader* createLoaderAsStream(Stream* outStream); |
| 55 | 63 |
| 56 virtual ~FetchDataLoader() { } | 64 virtual ~FetchDataLoader() { } |
| 57 | 65 |
| 58 // start() should be called only once on the created thread. | 66 // start() should be called only once on the created thread. |
| 59 // start() do not take the ownership of |handle|. | 67 // start() do not take the ownership of |handle|. |
| 60 // |handle| must not be locked when called. | 68 // |handle| must not be locked when called. |
| 61 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0; | 69 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0; |
| 62 | 70 |
| 63 virtual void cancel() = 0; | 71 virtual void cancel() = 0; |
| 64 | 72 |
| 65 DEFINE_INLINE_VIRTUAL_TRACE() { } | 73 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 } // namespace blink | 76 } // namespace blink |
| 69 | 77 |
| 70 #endif // FetchDataLoader_h | 78 #endif // FetchDataLoader_h |
| OLD | NEW |