| 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 "core/streams/Stream.h" |
| 10 #include "modules/ModulesExport.h" |
| 10 #include "modules/fetch/FetchDataConsumerHandle.h" | 11 #include "modules/fetch/FetchDataConsumerHandle.h" |
| 11 #include "platform/blob/BlobData.h" | 12 #include "platform/blob/BlobData.h" |
| 12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 13 #include "wtf/Forward.h" | 14 #include "wtf/Forward.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 // FetchDataLoader subclasses | 18 // FetchDataLoader subclasses |
| 18 // 1. take a reader of FetchDataConsumerHandle |handle|, | 19 // 1. take a reader of FetchDataConsumerHandle |handle|, |
| 19 // 2. read all data, and | 20 // 2. read all data, and |
| 20 // 3. call either didFetchDataLoaded...() on success or | 21 // 3. call either didFetchDataLoaded...() on success or |
| 21 // difFetchDataLoadFailed() otherwise | 22 // difFetchDataLoadFailed() otherwise |
| 22 // on the thread where FetchDataLoader is created. | 23 // on the thread where FetchDataLoader is created. |
| 23 // | 24 // |
| 24 // - Client's methods can be called synchronously in start(). | 25 // - Client's methods can be called synchronously in start(). |
| 25 // - If FetchDataLoader::cancel() is called (or FetchDataLoader is garbage | 26 // - If FetchDataLoader::cancel() is called (or FetchDataLoader is garbage |
| 26 // collected), Client's methods are not called anymore. | 27 // collected), Client's methods are not called anymore. |
| 27 // - FetchDataLoader takes the ownership of |handle|'s reader but not |handle|. | 28 // - FetchDataLoader takes the ownership of |handle|'s reader but not |handle|. |
| 28 class FetchDataLoader : public GarbageCollectedFinalized<FetchDataLoader> { | 29 class MODULES_EXPORT FetchDataLoader : public GarbageCollectedFinalized<FetchDat
aLoader> { |
| 29 public: | 30 public: |
| 30 class Client : public GarbageCollectedMixin { | 31 class Client : public GarbageCollectedMixin { |
| 31 public: | 32 public: |
| 32 virtual ~Client() { } | 33 virtual ~Client() { } |
| 33 | 34 |
| 34 // The method corresponding to createLoaderAs... is called on success. | 35 // The method corresponding to createLoaderAs... is called on success. |
| 35 virtual void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) | 36 virtual void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) |
| 36 { | 37 { |
| 37 ASSERT_NOT_REACHED(); | 38 ASSERT_NOT_REACHED(); |
| 38 } | 39 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 69 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0; | 70 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0; |
| 70 | 71 |
| 71 virtual void cancel() = 0; | 72 virtual void cancel() = 0; |
| 72 | 73 |
| 73 DEFINE_INLINE_VIRTUAL_TRACE() { } | 74 DEFINE_INLINE_VIRTUAL_TRACE() { } |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 } // namespace blink | 77 } // namespace blink |
| 77 | 78 |
| 78 #endif // FetchDataLoader_h | 79 #endif // FetchDataLoader_h |
| OLD | NEW |