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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 // If we errored out or got no data, we still return a blob, just an emp ty one. 292 // If we errored out or got no data, we still return a blob, just an emp ty one.
293 size_t size = 0; 293 size_t size = 0;
294 if (m_binaryResponseBuilder) { 294 if (m_binaryResponseBuilder) {
295 RefPtr<RawData> rawData = RawData::create(); 295 RefPtr<RawData> rawData = RawData::create();
296 size = m_binaryResponseBuilder->size(); 296 size = m_binaryResponseBuilder->size();
297 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size ); 297 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size );
298 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile); 298 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile);
299 blobData->setContentType(responseMIMEType()); // responseMIMEType de faults to text/xml which may be incorrect. 299 blobData->setContentType(responseMIMEType()); // responseMIMEType de faults to text/xml which may be incorrect.
300 m_binaryResponseBuilder.clear(); 300 m_binaryResponseBuilder.clear();
301 } 301 }
302 m_responseBlob = Blob::create(blobData.release(), size); 302 m_responseBlob = Blob::create(BlobDataHandle::create(blobData.release(), size));
303 } 303 }
304 304
305 return m_responseBlob.get(); 305 return m_responseBlob.get();
306 } 306 }
307 307
308 ArrayBuffer* XMLHttpRequest::responseArrayBuffer() 308 ArrayBuffer* XMLHttpRequest::responseArrayBuffer()
309 { 309 {
310 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); 310 ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer);
311 311
312 if (m_error || m_state != DONE) 312 if (m_error || m_state != DONE)
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // From FileAPI spec, whenever media type cannot be determined, empty string must be returned. 654 // From FileAPI spec, whenever media type cannot be determined, empty string must be returned.
655 setRequestHeaderInternal("Content-Type", ""); 655 setRequestHeaderInternal("Content-Type", "");
656 } 656 }
657 } 657 }
658 658
659 // FIXME: add support for uploading bundles. 659 // FIXME: add support for uploading bundles.
660 m_requestEntityBody = FormData::create(); 660 m_requestEntityBody = FormData::create();
661 if (body->isFile()) 661 if (body->isFile())
662 m_requestEntityBody->appendFile(toFile(body)->path()); 662 m_requestEntityBody->appendFile(toFile(body)->path());
663 else 663 else
664 m_requestEntityBody->appendBlob(body->url()); 664 m_requestEntityBody->appendBlob(body->uuid(), body->blobDataHandle() );
665 } 665 }
666 666
667 createRequest(es); 667 createRequest(es);
668 } 668 }
669 669
670 void XMLHttpRequest::send(DOMFormData* body, ExceptionState& es) 670 void XMLHttpRequest::send(DOMFormData* body, ExceptionState& es)
671 { 671 {
672 if (!initSend(es)) 672 if (!initSend(es))
673 return; 673 return;
674 674
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 { 1314 {
1315 return eventNames().interfaceForXMLHttpRequest; 1315 return eventNames().interfaceForXMLHttpRequest;
1316 } 1316 }
1317 1317
1318 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const 1318 ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const
1319 { 1319 {
1320 return ActiveDOMObject::scriptExecutionContext(); 1320 return ActiveDOMObject::scriptExecutionContext();
1321 } 1321 }
1322 1322
1323 } // namespace WebCore 1323 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698