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

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

Issue 2351643004: BytesConsumer::endRead can return Done (Closed)
Patch Set: fix Created 4 years, 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 BytesConsumer_h 5 #ifndef BytesConsumer_h
6 #define BytesConsumer_h 6 #define BytesConsumer_h
7 7
8 #include "modules/ModulesExport.h" 8 #include "modules/ModulesExport.h"
9 #include "platform/blob/BlobData.h" 9 #include "platform/blob/BlobData.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // endRead, because the read session implicitly ends in that case. 84 // endRead, because the read session implicitly ends in that case.
85 // 85 //
86 // |*buffer| will become invalid when this object becomes unreachable, 86 // |*buffer| will become invalid when this object becomes unreachable,
87 // even if endRead is not called. 87 // even if endRead is not called.
88 // 88 //
89 // |*buffer| will be set to null and |*available| will be set to 0 if not 89 // |*buffer| will be set to null and |*available| will be set to 0 if not
90 // readable. 90 // readable.
91 virtual Result beginRead(const char** buffer, size_t* available) WARN_UNUSED _RESULT = 0; 91 virtual Result beginRead(const char** buffer, size_t* available) WARN_UNUSED _RESULT = 0;
92 92
93 // Ends a two-phase read. 93 // Ends a two-phase read.
94 // This function can modify this BytesConsumer's state.
95 // Returns Ok when the consumer stays readable or waiting.
96 // Returns Done when it's closed.
97 // Returns Error when it's errored.
94 virtual Result endRead(size_t readSize) WARN_UNUSED_RESULT = 0; 98 virtual Result endRead(size_t readSize) WARN_UNUSED_RESULT = 0;
95 99
96 // Drains the data as a BlobDataHandle. 100 // Drains the data as a BlobDataHandle.
97 // When this function returns a non-null value, the returned blob handle 101 // When this function returns a non-null value, the returned blob handle
98 // contains bytes that would be read through beginRead and 102 // contains bytes that would be read through beginRead and
99 // endRead functions without calling this function. In such a case, this 103 // endRead functions without calling this function. In such a case, this
100 // object becomes closed. 104 // object becomes closed.
101 // When this function returns null value, this function does nothing. 105 // When this function returns null value, this function does nothing.
102 // When |policy| is DisallowBlobWithInvalidSize, this function doesn't 106 // When |policy| is DisallowBlobWithInvalidSize, this function doesn't
103 // return a non-null blob handle with unspecified size. 107 // return a non-null blob handle with unspecified size.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return PublicState::Errored; 171 return PublicState::Errored;
168 } 172 }
169 NOTREACHED(); 173 NOTREACHED();
170 return PublicState::ReadableOrWaiting; 174 return PublicState::ReadableOrWaiting;
171 } 175 }
172 }; 176 };
173 177
174 } // namespace blink 178 } // namespace blink
175 179
176 #endif // BytesConsumer_h 180 #endif // BytesConsumer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698