Changeset 122910 in webkit
- Timestamp:
- Jul 17, 2012 6:08:39 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122909 r122910 1 2012-07-17 Kinuko Yasuda <kinuko@chromium.org> 2 3 Record metrics to measure the usage of Blob([ArrayBuffer]) to eventually deprecate it 4 https://bugs.webkit.org/show_bug.cgi?id=90534 5 6 Reviewed by Jian Li. 7 8 We are removing ArrayBuffer support in Blob constructor (in favor of 9 ArrayBufferView) but before doing that we should record its use relative to ArrayBufferView. 10 http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob 11 12 No new tests as this has no functional changes. 13 14 * fileapi/WebKitBlobBuilder.cpp: 15 (WebCore::WebKitBlobBuilder::append): 16 1 17 2012-07-17 Joshua Bell <jsbell@chromium.org> 2 18 -
trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp
r119956 r122910 36 36 #include "ExceptionCode.h" 37 37 #include "File.h" 38 #include "HistogramSupport.h" 38 39 #include "LineEnding.h" 39 40 #include "ScriptExecutionContext.h" … … 47 48 48 49 namespace WebCore { 50 51 enum BlobConstructorArrayBufferOrView { 52 BlobConstructorArrayBuffer, 53 BlobConstructorArrayBufferView, 54 BlobConstructorArrayBufferOrViewMax, 55 }; 49 56 50 57 // static … … 102 109 String consoleMessage("ArrayBuffer values are deprecated in Blob Constructor. Use ArrayBufferView instead."); 103 110 context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, consoleMessage); 111 112 HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBuffer, BlobConstructorArrayBufferOrViewMax); 113 104 114 if (!arrayBuffer) 105 115 return; 106 Vector<char>& buffer = getBuffer(); 107 size_t oldSize = buffer.size(); 108 buffer.append(static_cast<const char*>(arrayBuffer->data()), arrayBuffer->byteLength()); 109 m_size += buffer.size() - oldSize; 116 117 appendBytesData(arrayBuffer->data(), arrayBuffer->byteLength()); 110 118 } 111 119 112 120 void WebKitBlobBuilder::append(ArrayBufferView* arrayBufferView) 113 121 { 122 HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBufferView, BlobConstructorArrayBufferOrViewMax); 123 114 124 if (!arrayBufferView) 115 125 return; 116 Vector<char>& buffer = getBuffer(); 117 size_t oldSize = buffer.size(); 118 buffer.append(static_cast<const char*>(arrayBufferView->baseAddress()), arrayBufferView->byteLength()); 119 m_size += buffer.size() - oldSize; 126 127 appendBytesData(arrayBufferView->baseAddress(), arrayBufferView->byteLength()); 120 128 } 121 129 #endif … … 142 150 } 143 151 152 153 void WebKitBlobBuilder::appendBytesData(const void* data, size_t length) 154 { 155 Vector<char>& buffer = getBuffer(); 156 size_t oldSize = buffer.size(); 157 buffer.append(static_cast<const char*>(data), length); 158 m_size += buffer.size() - oldSize; 159 } 160 144 161 PassRefPtr<Blob> WebKitBlobBuilder::getBlob(const String& contentType) 145 162 { -
trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h
r119956 r122910 65 65 WebKitBlobBuilder(); 66 66 67 void appendBytesData(const void*, size_t); 68 67 69 Vector<char>& getBuffer(); 68 70
Note: See TracChangeset
for help on using the changeset viewer.