Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/FetchDataLoader.h

Issue 2229313002: Make FetchDataLoader accept BytesConsumer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-c++-rs
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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 "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "wtf/Forward.h" 14 #include "wtf/Forward.h"
15 15
16 namespace blink { 16 namespace blink {
17 17
18 class BytesConsumer;
19
18 // FetchDataLoader subclasses 20 // FetchDataLoader subclasses
19 // 1. take a reader of FetchDataConsumerHandle |handle|, 21 // 1. take a BytesConsumer,
20 // 2. read all data, and 22 // 2. read all data, and
21 // 3. call either didFetchDataLoaded...() on success or 23 // 3. call either didFetchDataLoaded...() on success or
22 // difFetchDataLoadFailed() otherwise 24 // difFetchDataLoadFailed() otherwise
23 // on the thread where FetchDataLoader is created. 25 // on the thread where FetchDataLoader is created.
24 // 26 //
25 // - Client's methods can be called synchronously in start(). 27 // - Client's methods can be called synchronously in start().
26 // - If FetchDataLoader::cancel() is called (or FetchDataLoader is garbage 28 // - If FetchDataLoader::cancel() is called, Client's methods will not be
27 // collected), Client's methods are not called anymore. 29 // called anymore.
28 // - FetchDataLoader takes the ownership of |handle|'s reader but not |handle|.
29 class MODULES_EXPORT FetchDataLoader : public GarbageCollectedFinalized<FetchDat aLoader> { 30 class MODULES_EXPORT FetchDataLoader : public GarbageCollectedFinalized<FetchDat aLoader> {
30 public: 31 public:
31 class MODULES_EXPORT Client : public GarbageCollectedMixin { 32 class MODULES_EXPORT Client : public GarbageCollectedMixin {
32 public: 33 public:
33 virtual ~Client() { } 34 virtual ~Client() { }
34 35
35 // The method corresponding to createLoaderAs... is called on success. 36 // The method corresponding to createLoaderAs... is called on success.
36 virtual void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>) 37 virtual void didFetchDataLoadedBlobHandle(PassRefPtr<BlobDataHandle>)
37 { 38 {
38 ASSERT_NOT_REACHED(); 39 ASSERT_NOT_REACHED();
(...skipping 18 matching lines...) Expand all
57 DEFINE_INLINE_VIRTUAL_TRACE() { } 58 DEFINE_INLINE_VIRTUAL_TRACE() { }
58 }; 59 };
59 60
60 static FetchDataLoader* createLoaderAsBlobHandle(const String& mimeType); 61 static FetchDataLoader* createLoaderAsBlobHandle(const String& mimeType);
61 static FetchDataLoader* createLoaderAsArrayBuffer(); 62 static FetchDataLoader* createLoaderAsArrayBuffer();
62 static FetchDataLoader* createLoaderAsString(); 63 static FetchDataLoader* createLoaderAsString();
63 static FetchDataLoader* createLoaderAsStream(Stream* outStream); 64 static FetchDataLoader* createLoaderAsStream(Stream* outStream);
64 65
65 virtual ~FetchDataLoader() { } 66 virtual ~FetchDataLoader() { }
66 67
67 // start() should be called only once on the created thread. 68 // |consumer| must not have a client when called.
68 // start() do not take the ownership of |handle|. 69 virtual void start(BytesConsumer* /* consumer */, Client*) = 0;
69 // |handle| must not be locked when called.
70 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0;
71 70
72 virtual void cancel() = 0; 71 virtual void cancel() = 0;
73 72
74 DEFINE_INLINE_VIRTUAL_TRACE() { } 73 DEFINE_INLINE_VIRTUAL_TRACE() { }
75 }; 74 };
76 75
77 } // namespace blink 76 } // namespace blink
78 77
79 #endif // FetchDataLoader_h 78 #endif // FetchDataLoader_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/fetch/BytesConsumer.h ('k') | third_party/WebKit/Source/modules/fetch/FetchDataLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698