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

Side by Side Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 2530323002: Replace boolean return value SharedBuffer::getAsBytes with DCHECK (Closed)
Patch Set: done Created 4 years 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 | « no previous file | third_party/WebKit/Source/platform/SharedBuffer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() { 379 DOMArrayBuffer* XMLHttpRequest::responseArrayBuffer() {
380 DCHECK_EQ(m_responseTypeCode, ResponseTypeArrayBuffer); 380 DCHECK_EQ(m_responseTypeCode, ResponseTypeArrayBuffer);
381 381
382 if (m_error || m_state != kDone) 382 if (m_error || m_state != kDone)
383 return nullptr; 383 return nullptr;
384 384
385 if (!m_responseArrayBuffer) { 385 if (!m_responseArrayBuffer) {
386 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) { 386 if (m_binaryResponseBuilder && m_binaryResponseBuilder->size()) {
387 DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitialized( 387 DOMArrayBuffer* buffer = DOMArrayBuffer::createUninitialized(
388 m_binaryResponseBuilder->size(), 1); 388 m_binaryResponseBuilder->size(), 1);
389 if (!m_binaryResponseBuilder->getAsBytes( 389 m_binaryResponseBuilder->getAsBytes(
390 buffer->data(), static_cast<size_t>(buffer->byteLength()))) { 390 buffer->data(), static_cast<size_t>(buffer->byteLength()));
391 // m_binaryResponseBuilder failed to allocate an ArrayBuffer.
392 // We need to crash the renderer since there's no way defined in
393 // the spec to tell this to the user.
394 CRASH();
395 }
396 m_responseArrayBuffer = buffer; 391 m_responseArrayBuffer = buffer;
397 m_binaryResponseBuilder.clear(); 392 m_binaryResponseBuilder.clear();
398 } else { 393 } else {
399 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0); 394 m_responseArrayBuffer = DOMArrayBuffer::create(nullptr, 0);
400 } 395 }
401 } 396 }
402 397
403 return m_responseArrayBuffer.get(); 398 return m_responseArrayBuffer.get();
404 } 399 }
405 400
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 visitor->traceWrappers(m_responseDocument); 1846 visitor->traceWrappers(m_responseDocument);
1852 visitor->traceWrappers(m_responseArrayBuffer); 1847 visitor->traceWrappers(m_responseArrayBuffer);
1853 XMLHttpRequestEventTarget::traceWrappers(visitor); 1848 XMLHttpRequestEventTarget::traceWrappers(visitor);
1854 } 1849 }
1855 1850
1856 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) { 1851 std::ostream& operator<<(std::ostream& ostream, const XMLHttpRequest* xhr) {
1857 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr); 1852 return ostream << "XMLHttpRequest " << static_cast<const void*>(xhr);
1858 } 1853 }
1859 1854
1860 } // namespace blink 1855 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/SharedBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698