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

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

Issue 1217943007: Call Client methods synchronously in FetchDataLoader if the first read is Done or error (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix unittests. Created 5 years, 5 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
« no previous file with comments | « no previous file | Source/modules/fetch/FetchDataLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // FetchDataLoader subclasses 18 // FetchDataLoader subclasses
19 // 1. take a reader of FetchDataConsumerHandle |handle|, 19 // 1. take a reader of FetchDataConsumerHandle |handle|,
20 // 2. read all data, and 20 // 2. read all data, and
21 // 3. call either didFetchDataLoaded...() on success or 21 // 3. call either didFetchDataLoaded...() on success or
22 // difFetchDataLoadFailed() otherwise 22 // difFetchDataLoadFailed() otherwise
23 // on the thread where FetchDataLoader is created. 23 // on the thread where FetchDataLoader is created.
24 // 24 //
25 // - Client's methods can be called synchronously in start(). 25 // - Client's methods can be called synchronously in start().
26 // -- Specifically, if the first call by FetchDataLoader to read()/beginRead()
27 // returns values other than Ok or ShouldWait,
28 // Client's methods must be called synchronously in start().
26 // - If FetchDataLoader::cancel() is called (or FetchDataLoader is garbage 29 // - If FetchDataLoader::cancel() is called (or FetchDataLoader is garbage
27 // collected), Client's methods are not called anymore. 30 // collected), Client's methods are not called anymore.
28 // - FetchDataLoader takes the ownership of |handle|'s reader but not |handle|. 31 // - FetchDataLoader takes the ownership of |handle|'s reader but not |handle|.
29 class MODULES_EXPORT FetchDataLoader : public GarbageCollectedFinalized<FetchDat aLoader> { 32 class MODULES_EXPORT FetchDataLoader : public GarbageCollectedFinalized<FetchDat aLoader> {
30 public: 33 public:
31 class Client : public GarbageCollectedMixin { 34 class Client : public GarbageCollectedMixin {
32 public: 35 public:
33 virtual ~Client() { } 36 virtual ~Client() { }
34 37
35 // The method corresponding to createLoaderAs... is called on success. 38 // The method corresponding to createLoaderAs... is called on success.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0; 73 virtual void start(FetchDataConsumerHandle* /* handle */, Client*) = 0;
71 74
72 virtual void cancel() = 0; 75 virtual void cancel() = 0;
73 76
74 DEFINE_INLINE_VIRTUAL_TRACE() { } 77 DEFINE_INLINE_VIRTUAL_TRACE() { }
75 }; 78 };
76 79
77 } // namespace blink 80 } // namespace blink
78 81
79 #endif // FetchDataLoader_h 82 #endif // FetchDataLoader_h
OLDNEW
« no previous file with comments | « no previous file | Source/modules/fetch/FetchDataLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698