Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/fetch/Body.h" | 6 #include "modules/fetch/Body.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // gone (which means that the V8::TerminateExecution() signal has been sent | 117 // gone (which means that the V8::TerminateExecution() signal has been sent |
| 118 // to this worker thread). | 118 // to this worker thread). |
| 119 if (!scriptState->executionContext()) | 119 if (!scriptState->executionContext()) |
| 120 return ScriptPromise(); | 120 return ScriptPromise(); |
| 121 | 121 |
| 122 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; | 122 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; |
| 123 ScriptPromise promise = resolver->promise(); | 123 ScriptPromise promise = resolver->promise(); |
| 124 if (bodyBuffer()) { | 124 if (bodyBuffer()) { |
| 125 bodyBuffer()->startLoading(scriptState->executionContext(), FetchDataLoa der::createLoaderAsArrayBuffer(), new BodyArrayBufferConsumer(resolver)); | 125 bodyBuffer()->startLoading(scriptState->executionContext(), FetchDataLoa der::createLoaderAsArrayBuffer(), new BodyArrayBufferConsumer(resolver)); |
| 126 } else { | 126 } else { |
| 127 resolver->resolve(DOMArrayBuffer::create(0u, 1)); | 127 resolver->resolve(DOMArrayBuffer::deprecatedCreateOrCrash(0u, 1)); |
|
haraken
2015/10/29 18:58:37
0u => nullptr
| |
| 128 } | 128 } |
| 129 return promise; | 129 return promise; |
| 130 } | 130 } |
| 131 | 131 |
| 132 ScriptPromise Body::blob(ScriptState* scriptState) | 132 ScriptPromise Body::blob(ScriptState* scriptState) |
| 133 { | 133 { |
| 134 if (m_opaque) | 134 if (m_opaque) |
| 135 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "The body is opaque.")); | 135 return ScriptPromise::reject(scriptState, V8ThrowException::createTypeEr ror(scriptState->isolate(), "The body is opaque.")); |
| 136 | 136 |
| 137 if (bodyUsed()) | 137 if (bodyUsed()) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 | 220 |
| 221 Body::Body(ExecutionContext* context) | 221 Body::Body(ExecutionContext* context) |
| 222 : ActiveDOMObject(context) | 222 : ActiveDOMObject(context) |
| 223 , m_bodyPassed(false) | 223 , m_bodyPassed(false) |
| 224 , m_opaque(false) | 224 , m_opaque(false) |
| 225 { | 225 { |
| 226 suspendIfNeeded(); | 226 suspendIfNeeded(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |