Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Side by Side Diff: Source/modules/fetch/Body.cpp

Issue 1068783005: {Request, Response}.blob() should release its lock when resolved. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@request-body-setting
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 case ResponseAsBlob: 362 case ResponseAsBlob:
363 if (blobHandle->size() != kuint64max) { 363 if (blobHandle->size() != kuint64max) {
364 // If the size of |blobHandle| is set correctly, creates Blob from 364 // If the size of |blobHandle| is set correctly, creates Blob from
365 // it. 365 // it.
366 if (blobHandle->type() != mimeType()) { 366 if (blobHandle->type() != mimeType()) {
367 // A new BlobDataHandle is created to override the Blob's type. 367 // A new BlobDataHandle is created to override the Blob's type.
368 m_resolver->resolve(Blob::create(BlobDataHandle::create(blobHand le->uuid(), mimeType(), blobHandle->size()))); 368 m_resolver->resolve(Blob::create(BlobDataHandle::create(blobHand le->uuid(), mimeType(), blobHandle->size())));
369 } else { 369 } else {
370 m_resolver->resolve(Blob::create(blobHandle)); 370 m_resolver->resolve(Blob::create(blobHandle));
371 } 371 }
372 m_stream->close();
372 m_resolver.clear(); 373 m_resolver.clear();
373 return; 374 return;
374 } 375 }
375 // If the size is not set, read as ArrayBuffer and create a new blob to 376 // If the size is not set, read as ArrayBuffer and create a new blob to
376 // get the size. 377 // get the size.
377 // FIXME: This workaround is not good for performance. 378 // FIXME: This workaround is not good for performance.
378 // When we will stop using Blob as a base system of Body to support 379 // When we will stop using Blob as a base system of Body to support
379 // stream, this problem should be solved. 380 // stream, this problem should be solved.
380 readType = FileReaderLoader::ReadAsArrayBuffer; 381 readType = FileReaderLoader::ReadAsArrayBuffer;
381 break; 382 break;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except ion) 588 void Body::didBlobHandleReceiveError(PassRefPtrWillBeRawPtr<DOMException> except ion)
588 { 589 {
589 if (!m_resolver) 590 if (!m_resolver)
590 return; 591 return;
591 m_streamSource->error(); 592 m_streamSource->error();
592 m_resolver->reject(exception); 593 m_resolver->reject(exception);
593 m_resolver.clear(); 594 m_resolver.clear();
594 } 595 }
595 596
596 } // namespace blink 597 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/fetch/script-tests/response.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698