| 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/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "bindings/core/v8/V8ArrayBuffer.h" | 10 #include "bindings/core/v8/V8ArrayBuffer.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 212 |
| 213 bool Body::hasPendingActivity() const | 213 bool Body::hasPendingActivity() const |
| 214 { | 214 { |
| 215 if (getExecutionContext()->activeDOMObjectsAreStopped()) | 215 if (getExecutionContext()->activeDOMObjectsAreStopped()) |
| 216 return false; | 216 return false; |
| 217 if (!bodyBuffer()) | 217 if (!bodyBuffer()) |
| 218 return false; | 218 return false; |
| 219 return bodyBuffer()->hasPendingActivity(); | 219 return bodyBuffer()->hasPendingActivity(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 Body::Body(ExecutionContext* context) : ActiveDOMObject(context), m_opaque(false
) | 222 Body::Body(ExecutionContext* context) |
| 223 : ActiveScriptWrappable(this) |
| 224 , ActiveDOMObject(context) |
| 225 , m_opaque(false) |
| 223 { | 226 { |
| 224 suspendIfNeeded(); | 227 suspendIfNeeded(); |
| 225 } | 228 } |
| 226 | 229 |
| 227 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) | 230 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) |
| 228 { | 231 { |
| 229 if (m_opaque) | 232 if (m_opaque) |
| 230 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "The body is opaque.")); | 233 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "The body is opaque.")); |
| 231 if (isBodyLocked() || bodyUsed()) | 234 if (isBodyLocked() || bodyUsed()) |
| 232 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); | 235 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr
ror(scriptState->isolate(), "Already read")); |
| 233 return ScriptPromise(); | 236 return ScriptPromise(); |
| 234 } | 237 } |
| 235 | 238 |
| 236 } // namespace blink | 239 } // namespace blink |
| OLD | NEW |