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

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

Issue 373023002: Un-deprecate XMLHttpRequest.send(ArrayBuffer) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | 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 /* 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "core/xml/XMLHttpRequestProgressEvent.h" 47 #include "core/xml/XMLHttpRequestProgressEvent.h"
48 #include "core/xml/XMLHttpRequestUpload.h" 48 #include "core/xml/XMLHttpRequestUpload.h"
49 #include "platform/Logging.h" 49 #include "platform/Logging.h"
50 #include "platform/RuntimeEnabledFeatures.h" 50 #include "platform/RuntimeEnabledFeatures.h"
51 #include "platform/SharedBuffer.h" 51 #include "platform/SharedBuffer.h"
52 #include "platform/blob/BlobData.h" 52 #include "platform/blob/BlobData.h"
53 #include "platform/network/HTTPParsers.h" 53 #include "platform/network/HTTPParsers.h"
54 #include "platform/network/ParsedContentType.h" 54 #include "platform/network/ParsedContentType.h"
55 #include "platform/network/ResourceError.h" 55 #include "platform/network/ResourceError.h"
56 #include "platform/network/ResourceRequest.h" 56 #include "platform/network/ResourceRequest.h"
57 #include "public/platform/Platform.h" 57 #include "public/platform/Platform.h"
tyoshino (SeeGerritForStatus) 2014/07/08 11:54:48 remove
pwnall-personal 2014/07/08 21:07:53 Done. Thank you for catching that!
58 #include "public/platform/WebURLRequest.h" 58 #include "public/platform/WebURLRequest.h"
59 #include "wtf/ArrayBuffer.h" 59 #include "wtf/ArrayBuffer.h"
60 #include "wtf/ArrayBufferView.h" 60 #include "wtf/ArrayBufferView.h"
61 #include "wtf/Assertions.h" 61 #include "wtf/Assertions.h"
62 #include "wtf/RefCountedLeakCounter.h" 62 #include "wtf/RefCountedLeakCounter.h"
63 #include "wtf/StdLibExtras.h" 63 #include "wtf/StdLibExtras.h"
64 #include "wtf/text/CString.h" 64 #include "wtf/text/CString.h"
65 65
66 namespace WebCore { 66 namespace WebCore {
67 67
68 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, xmlHttpRequestCounter, ("XM LHttpRequest")); 68 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, xmlHttpRequestCounter, ("XM LHttpRequest"));
69 69
70 // Histogram enum to see when we can deprecate xhr.send(ArrayBuffer).
71 enum XMLHttpRequestSendArrayBufferOrView {
72 XMLHttpRequestSendArrayBuffer,
73 XMLHttpRequestSendArrayBufferView,
74 XMLHttpRequestSendArrayBufferOrViewMax,
75 };
76
77 struct XMLHttpRequestStaticData { 70 struct XMLHttpRequestStaticData {
78 WTF_MAKE_NONCOPYABLE(XMLHttpRequestStaticData); WTF_MAKE_FAST_ALLOCATED; 71 WTF_MAKE_NONCOPYABLE(XMLHttpRequestStaticData); WTF_MAKE_FAST_ALLOCATED;
79 public: 72 public:
80 XMLHttpRequestStaticData(); 73 XMLHttpRequestStaticData();
81 String m_proxyHeaderPrefix; 74 String m_proxyHeaderPrefix;
82 String m_secHeaderPrefix; 75 String m_secHeaderPrefix;
83 HashSet<String, CaseFoldingHash> m_forbiddenRequestHeaders; 76 HashSet<String, CaseFoldingHash> m_forbiddenRequestHeaders;
84 }; 77 };
85 78
86 XMLHttpRequestStaticData::XMLHttpRequestStaticData() 79 XMLHttpRequestStaticData::XMLHttpRequestStaticData()
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 } 754 }
762 } 755 }
763 756
764 createRequest(httpBody.release(), exceptionState); 757 createRequest(httpBody.release(), exceptionState);
765 } 758 }
766 759
767 void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& exceptionState) 760 void XMLHttpRequest::send(ArrayBuffer* body, ExceptionState& exceptionState)
768 { 761 {
769 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body); 762 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBuffer %p", this, body);
770 763
771 String consoleMessage("ArrayBuffer is deprecated in XMLHttpRequest.send(). U se ArrayBufferView instead.");
772 executionContext()->addConsoleMessage(JSMessageSource, WarningMessageLevel, consoleMessage);
773
774 blink::Platform::current()->histogramEnumeration("WebCore.XHR.send.ArrayBuff erOrView", XMLHttpRequestSendArrayBuffer, XMLHttpRequestSendArrayBufferOrViewMax );
775
776 sendBytesData(body->data(), body->byteLength(), exceptionState); 764 sendBytesData(body->data(), body->byteLength(), exceptionState);
777 } 765 }
778 766
779 void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& exceptionState) 767 void XMLHttpRequest::send(ArrayBufferView* body, ExceptionState& exceptionState)
780 { 768 {
781 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBufferView %p", this, body); 769 WTF_LOG(Network, "XMLHttpRequest %p send() ArrayBufferView %p", this, body);
782 770
783 blink::Platform::current()->histogramEnumeration("WebCore.XHR.send.ArrayBuff erOrView", XMLHttpRequestSendArrayBufferView, XMLHttpRequestSendArrayBufferOrVie wMax);
784
785 sendBytesData(body->baseAddress(), body->byteLength(), exceptionState); 771 sendBytesData(body->baseAddress(), body->byteLength(), exceptionState);
786 } 772 }
787 773
788 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta te& exceptionState) 774 void XMLHttpRequest::sendBytesData(const void* data, size_t length, ExceptionSta te& exceptionState)
789 { 775 {
790 if (!initSend(exceptionState)) 776 if (!initSend(exceptionState))
791 return; 777 return;
792 778
793 RefPtr<FormData> httpBody; 779 RefPtr<FormData> httpBody;
794 780
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 { 1449 {
1464 visitor->trace(m_responseBlob); 1450 visitor->trace(m_responseBlob);
1465 visitor->trace(m_responseStream); 1451 visitor->trace(m_responseStream);
1466 visitor->trace(m_responseDocument); 1452 visitor->trace(m_responseDocument);
1467 visitor->trace(m_progressEventThrottle); 1453 visitor->trace(m_progressEventThrottle);
1468 visitor->trace(m_upload); 1454 visitor->trace(m_upload);
1469 XMLHttpRequestEventTarget::trace(visitor); 1455 XMLHttpRequestEventTarget::trace(visitor);
1470 } 1456 }
1471 1457
1472 } // namespace WebCore 1458 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698