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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 765 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 776
777 if (!initSend(exceptionState)) 777 if (!initSend(exceptionState))
778 return; 778 return;
779 779
780 RefPtr<EncodedFormData> httpBody; 780 RefPtr<EncodedFormData> httpBody;
781 781
782 if (areMethodAndURLValidForSend()) { 782 if (areMethodAndURLValidForSend()) {
783 httpBody = body->encodeMultiPartFormData(); 783 httpBody = body->encodeMultiPartFormData();
784 784
785 if (getRequestHeader(HTTPNames::Content_Type).isEmpty()) { 785 if (getRequestHeader(HTTPNames::Content_Type).isEmpty()) {
786 AtomicString contentType = AtomicString("multipart/form-data; bounda ry=", AtomicString::ConstructFromLiteral) + httpBody->boundary().data(); 786 AtomicString contentType = AtomicString("multipart/form-data; bounda ry=") + httpBody->boundary().data();
787 setRequestHeaderInternal(HTTPNames::Content_Type, contentType); 787 setRequestHeaderInternal(HTTPNames::Content_Type, contentType);
788 } 788 }
789 } 789 }
790 790
791 createRequest(httpBody.release(), exceptionState); 791 createRequest(httpBody.release(), exceptionState);
792 } 792 }
793 793
794 void XMLHttpRequest::send(DOMArrayBuffer* body, ExceptionState& exceptionState) 794 void XMLHttpRequest::send(DOMArrayBuffer* body, ExceptionState& exceptionState)
795 { 795 {
796 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body); 796 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 } 1281 }
1282 1282
1283 AtomicString XMLHttpRequest::finalResponseMIMETypeWithFallback() const 1283 AtomicString XMLHttpRequest::finalResponseMIMETypeWithFallback() const
1284 { 1284 {
1285 AtomicString finalType = finalResponseMIMEType(); 1285 AtomicString finalType = finalResponseMIMEType();
1286 if (!finalType.isEmpty()) 1286 if (!finalType.isEmpty())
1287 return finalType; 1287 return finalType;
1288 1288
1289 // FIXME: This fallback is not specified in the final MIME type algorithm 1289 // FIXME: This fallback is not specified in the final MIME type algorithm
1290 // of the XHR spec. Move this to more appropriate place. 1290 // of the XHR spec. Move this to more appropriate place.
1291 return AtomicString("text/xml", AtomicString::ConstructFromLiteral); 1291 return AtomicString("text/xml");
1292 } 1292 }
1293 1293
1294 bool XMLHttpRequest::responseIsXML() const 1294 bool XMLHttpRequest::responseIsXML() const
1295 { 1295 {
1296 return DOMImplementation::isXMLMIMEType(finalResponseMIMETypeWithFallback()) ; 1296 return DOMImplementation::isXMLMIMEType(finalResponseMIMETypeWithFallback()) ;
1297 } 1297 }
1298 1298
1299 bool XMLHttpRequest::responseIsHTML() const 1299 bool XMLHttpRequest::responseIsHTML() const
1300 { 1300 {
1301 return equalIgnoringCase(finalResponseMIMEType(), "text/html"); 1301 return equalIgnoringCase(finalResponseMIMEType(), "text/html");
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 visitor->trace(m_responseDocumentParser); 1703 visitor->trace(m_responseDocumentParser);
1704 visitor->trace(m_progressEventThrottle); 1704 visitor->trace(m_progressEventThrottle);
1705 visitor->trace(m_upload); 1705 visitor->trace(m_upload);
1706 visitor->trace(m_blobLoader); 1706 visitor->trace(m_blobLoader);
1707 XMLHttpRequestEventTarget::trace(visitor); 1707 XMLHttpRequestEventTarget::trace(visitor);
1708 DocumentParserClient::trace(visitor); 1708 DocumentParserClient::trace(visitor);
1709 ActiveDOMObject::trace(visitor); 1709 ActiveDOMObject::trace(visitor);
1710 } 1710 }
1711 1711
1712 } // namespace blink 1712 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698