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