| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef FetchBlobDataConsumerHandle_h | |
| 6 #define FetchBlobDataConsumerHandle_h | |
| 7 | |
| 8 #include "core/fetch/ResourceLoaderOptions.h" | |
| 9 #include "core/loader/ThreadableLoader.h" | |
| 10 #include "modules/ModulesExport.h" | |
| 11 #include "modules/fetch/FetchDataConsumerHandle.h" | |
| 12 #include "platform/blob/BlobData.h" | |
| 13 #include "platform/heap/Handle.h" | |
| 14 #include "wtf/PassRefPtr.h" | |
| 15 #include "wtf/RefPtr.h" | |
| 16 #include <memory> | |
| 17 | |
| 18 namespace blink { | |
| 19 | |
| 20 class ExecutionContext; | |
| 21 // A FetchBlobDataConsumerHandle is created from a blob handle and it will | |
| 22 // return a valid handle from drainAsBlobDataHandle as much as possible. | |
| 23 class MODULES_EXPORT FetchBlobDataConsumerHandle final : public FetchDataConsume
rHandle { | |
| 24 WTF_MAKE_NONCOPYABLE(FetchBlobDataConsumerHandle); | |
| 25 public: | |
| 26 class MODULES_EXPORT LoaderFactory : public GarbageCollectedFinalized<Loader
Factory> { | |
| 27 public: | |
| 28 virtual ThreadableLoader* create(ExecutionContext&, ThreadableLoaderClie
nt*, const ThreadableLoaderOptions&, const ResourceLoaderOptions&) = 0; | |
| 29 virtual ~LoaderFactory() { } | |
| 30 DEFINE_INLINE_VIRTUAL_TRACE() { } | |
| 31 }; | |
| 32 | |
| 33 static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, Pa
ssRefPtr<BlobDataHandle>); | |
| 34 | |
| 35 // For testing. | |
| 36 static std::unique_ptr<FetchDataConsumerHandle> create(ExecutionContext*, Pa
ssRefPtr<BlobDataHandle>, LoaderFactory*); | |
| 37 | |
| 38 ~FetchBlobDataConsumerHandle(); | |
| 39 | |
| 40 private: | |
| 41 FetchBlobDataConsumerHandle(ExecutionContext*, PassRefPtr<BlobDataHandle>, L
oaderFactory*); | |
| 42 std::unique_ptr<Reader> obtainFetchDataReader(Client*) override; | |
| 43 | |
| 44 const char* debugName() const override { return "FetchBlobDataConsumerHandle
"; } | |
| 45 | |
| 46 class ReaderContext; | |
| 47 RefPtr<ReaderContext> m_readerContext; | |
| 48 }; | |
| 49 | |
| 50 } // namespace blink | |
| 51 | |
| 52 #endif // FetchBlobDataConsumerHandle_h | |
| OLD | NEW |