OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "modules/fetch/Body.h" | 5 #include "modules/fetch/Body.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
9 #include "bindings/core/v8/V8ArrayBuffer.h" | 9 #include "bindings/core/v8/V8ArrayBuffer.h" |
10 #include "bindings/core/v8/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 } else { | 195 } else { |
196 resolver->resolve(String()); | 196 resolver->resolve(String()); |
197 } | 197 } |
198 return promise; | 198 return promise; |
199 } | 199 } |
200 | 200 |
201 ScriptValue Body::body(ScriptState* scriptState) { | 201 ScriptValue Body::body(ScriptState* scriptState) { |
202 if (!bodyBuffer()) | 202 if (!bodyBuffer()) |
203 return ScriptValue::createNull(scriptState); | 203 return ScriptValue::createNull(scriptState); |
204 ScriptValue stream = bodyBuffer()->stream(); | 204 ScriptValue stream = bodyBuffer()->stream(); |
205 ASSERT(stream.getScriptState() == scriptState); | 205 DCHECK(stream.getScriptState() == scriptState); |
tkent
2017/04/08 02:29:54
Use DCHECK_EQ if it doesn't cause a build failure.
| |
206 return stream; | 206 return stream; |
207 } | 207 } |
208 | 208 |
209 bool Body::bodyUsed() { | 209 bool Body::bodyUsed() { |
210 return bodyBuffer() && bodyBuffer()->isStreamDisturbed(); | 210 return bodyBuffer() && bodyBuffer()->isStreamDisturbed(); |
211 } | 211 } |
212 | 212 |
213 bool Body::isBodyLocked() { | 213 bool Body::isBodyLocked() { |
214 return bodyBuffer() && bodyBuffer()->isStreamLocked(); | 214 return bodyBuffer() && bodyBuffer()->isStreamLocked(); |
215 } | 215 } |
(...skipping 10 matching lines...) Expand all Loading... | |
226 | 226 |
227 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) { | 227 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) { |
228 if (isBodyLocked() || bodyUsed()) | 228 if (isBodyLocked() || bodyUsed()) |
229 return ScriptPromise::reject( | 229 return ScriptPromise::reject( |
230 scriptState, V8ThrowException::createTypeError(scriptState->isolate(), | 230 scriptState, V8ThrowException::createTypeError(scriptState->isolate(), |
231 "Already read")); | 231 "Already read")); |
232 return ScriptPromise(); | 232 return ScriptPromise(); |
233 } | 233 } |
234 | 234 |
235 } // namespace blink | 235 } // namespace blink |
OLD | NEW |