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

Side by Side Diff: WebCore/xml/XMLHttpRequest.cpp

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 8 years, 1 month 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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // If we errored out or got no data, we still return a blob, just an emp ty one. 299 // If we errored out or got no data, we still return a blob, just an emp ty one.
300 size_t size = 0; 300 size_t size = 0;
301 if (m_binaryResponseBuilder) { 301 if (m_binaryResponseBuilder) {
302 RefPtr<RawData> rawData = RawData::create(); 302 RefPtr<RawData> rawData = RawData::create();
303 size = m_binaryResponseBuilder->size(); 303 size = m_binaryResponseBuilder->size();
304 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size ); 304 rawData->mutableData()->append(m_binaryResponseBuilder->data(), size );
305 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile); 305 blobData->appendData(rawData, 0, BlobDataItem::toEndOfFile);
306 blobData->setContentType(responseMIMEType()); // responseMIMEType de faults to text/xml which may be incorrect. 306 blobData->setContentType(responseMIMEType()); // responseMIMEType de faults to text/xml which may be incorrect.
307 m_binaryResponseBuilder.clear(); 307 m_binaryResponseBuilder.clear();
308 } 308 }
309 m_responseBlob = Blob::create(blobData.release(), size); 309 m_responseBlob = Blob::create(BlobDataHandle::create(blobData.release(), size));
310 } 310 }
311 311
312 return m_responseBlob.get(); 312 return m_responseBlob.get();
313 } 313 }
314 314
315 ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec) 315 ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionCode& ec)
316 { 316 {
317 if (m_responseTypeCode != ResponseTypeArrayBuffer) { 317 if (m_responseTypeCode != ResponseTypeArrayBuffer) {
318 ec = INVALID_STATE_ERR; 318 ec = INVALID_STATE_ERR;
319 return 0; 319 return 0;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 return; 642 return;
643 643
644 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily( )) { 644 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolIsInHTTPFamily( )) {
645 // FIXME: Should we set a Content-Type if one is not set. 645 // FIXME: Should we set a Content-Type if one is not set.
646 // FIXME: add support for uploading bundles. 646 // FIXME: add support for uploading bundles.
647 m_requestEntityBody = FormData::create(); 647 m_requestEntityBody = FormData::create();
648 if (body->isFile()) 648 if (body->isFile())
649 m_requestEntityBody->appendFile(toFile(body)->path()); 649 m_requestEntityBody->appendFile(toFile(body)->path());
650 #if ENABLE(BLOB) 650 #if ENABLE(BLOB)
651 else 651 else
652 m_requestEntityBody->appendBlob(body->url()); 652 ; //m_requestEntityBody->appendBlob(body->url()); // TODO: BlobData Handles
653 #endif 653 #endif
654 } 654 }
655 655
656 createRequest(ec); 656 createRequest(ec);
657 } 657 }
658 658
659 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) 659 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec)
660 { 660 {
661 if (!initSend(ec)) 661 if (!initSend(ec))
662 return; 662 return;
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 { 1291 {
1292 return &m_eventTargetData; 1292 return &m_eventTargetData;
1293 } 1293 }
1294 1294
1295 EventTargetData* XMLHttpRequest::ensureEventTargetData() 1295 EventTargetData* XMLHttpRequest::ensureEventTargetData()
1296 { 1296 {
1297 return &m_eventTargetData; 1297 return &m_eventTargetData;
1298 } 1298 }
1299 1299
1300 } // namespace WebCore 1300 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698