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/serviceworkers/Body.h" | 6 #include "modules/serviceworkers/Body.h" |
7 | 7 |
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/V8ThrowException.h" | 10 #include "bindings/core/v8/V8ThrowException.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // FileReaderLoaderClient functions. | 160 // FileReaderLoaderClient functions. |
161 void Body::didStartLoading() { } | 161 void Body::didStartLoading() { } |
162 void Body::didReceiveData() { } | 162 void Body::didReceiveData() { } |
163 void Body::didFinishLoading() | 163 void Body::didFinishLoading() |
164 { | 164 { |
165 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) | 165 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
166 return; | 166 return; |
167 | 167 |
168 switch (m_responseType) { | 168 switch (m_responseType) { |
169 case ResponseAsArrayBuffer: | 169 case ResponseAsArrayBuffer: |
170 m_resolver->resolve(DOMArrayBuffer::create(m_loader->arrayBufferResult()
)); | 170 m_resolver->resolve(m_loader->arrayBufferResult()); |
171 break; | 171 break; |
172 case ResponseAsBlob: { | 172 case ResponseAsBlob: { |
173 ASSERT(blobDataHandle()->size() == kuint64max); | 173 ASSERT(blobDataHandle()->size() == kuint64max); |
174 OwnPtr<BlobData> blobData = BlobData::create(); | 174 OwnPtr<BlobData> blobData = BlobData::create(); |
175 RefPtr<ArrayBuffer> buffer = m_loader->arrayBufferResult(); | 175 RefPtr<DOMArrayBuffer> buffer = m_loader->arrayBufferResult(); |
176 blobData->appendArrayBuffer(buffer.get()); | 176 blobData->appendArrayBuffer(buffer->buffer()); |
177 const size_t length = blobData->length(); | 177 const size_t length = blobData->length(); |
178 m_resolver->resolve(Blob::create(BlobDataHandle::create(blobData.release
(), length))); | 178 m_resolver->resolve(Blob::create(BlobDataHandle::create(blobData.release
(), length))); |
179 break; | 179 break; |
180 } | 180 } |
181 case ResponseAsFormData: | 181 case ResponseAsFormData: |
182 ASSERT_NOT_REACHED(); | 182 ASSERT_NOT_REACHED(); |
183 break; | 183 break; |
184 case ResponseAsJSON: | 184 case ResponseAsJSON: |
185 resolveJSON(); | 185 resolveJSON(); |
186 break; | 186 break; |
(...skipping 10 matching lines...) Expand all Loading... |
197 { | 197 { |
198 ASSERT(m_resolver); | 198 ASSERT(m_resolver); |
199 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) | 199 if (!m_resolver->executionContext() || m_resolver->executionContext()->activ
eDOMObjectsAreStopped()) |
200 return; | 200 return; |
201 | 201 |
202 m_resolver->resolve(""); | 202 m_resolver->resolve(""); |
203 m_resolver.clear(); | 203 m_resolver.clear(); |
204 } | 204 } |
205 | 205 |
206 } // namespace blink | 206 } // namespace blink |
OLD | NEW |