| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 bool Body::hasPendingActivity() const { | 219 bool Body::hasPendingActivity() const { |
| 220 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed()) | 220 if (!getExecutionContext() || getExecutionContext()->isContextDestroyed()) |
| 221 return false; | 221 return false; |
| 222 if (!bodyBuffer()) | 222 if (!bodyBuffer()) |
| 223 return false; | 223 return false; |
| 224 return bodyBuffer()->hasPendingActivity(); | 224 return bodyBuffer()->hasPendingActivity(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 Body::Body(ExecutionContext* context) | 227 Body::Body(ExecutionContext* context) : ContextLifecycleObserver(context) {} |
| 228 : ActiveScriptWrappable(this), ContextLifecycleObserver(context) {} | |
| 229 | 228 |
| 230 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) { | 229 ScriptPromise Body::rejectInvalidConsumption(ScriptState* scriptState) { |
| 231 if (isBodyLocked() || bodyUsed()) | 230 if (isBodyLocked() || bodyUsed()) |
| 232 return ScriptPromise::reject( | 231 return ScriptPromise::reject( |
| 233 scriptState, V8ThrowException::createTypeError(scriptState->isolate(), | 232 scriptState, V8ThrowException::createTypeError(scriptState->isolate(), |
| 234 "Already read")); | 233 "Already read")); |
| 235 return ScriptPromise(); | 234 return ScriptPromise(); |
| 236 } | 235 } |
| 237 | 236 |
| 238 } // namespace blink | 237 } // namespace blink |
| OLD | NEW |