diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-18 13:59:13 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-18 13:59:28 +0200 |
commit | 4d6084feccab99c0a7b3ecef26bb49c41dd50201 (patch) | |
tree | fd1195897f551eee6d5a15d07ff5733b15aa2a5c /Source/WebCore/fileapi | |
parent | ae901828d4689ab9e89113f6b6ea8042b37a9fda (diff) | |
download | qtwebkit-4d6084feccab99c0a7b3ecef26bb49c41dd50201.tar.gz |
Imported WebKit commit ff52235a78888e5cb8e286a828a8698042200e67 (http://svn.webkit.org/repository/webkit/trunk@122948)
New snapshot that should fix the rendering issues recently introduced
Diffstat (limited to 'Source/WebCore/fileapi')
-rw-r--r-- | Source/WebCore/fileapi/WebKitBlobBuilder.cpp | 33 | ||||
-rw-r--r-- | Source/WebCore/fileapi/WebKitBlobBuilder.h | 2 |
2 files changed, 27 insertions, 8 deletions
diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp index 5f7a858f4..5c54c4b6f 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.cpp +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.cpp @@ -35,6 +35,7 @@ #include "Blob.h" #include "ExceptionCode.h" #include "File.h" +#include "HistogramSupport.h" #include "LineEnding.h" #include "ScriptExecutionContext.h" #include "TextEncoding.h" @@ -47,6 +48,12 @@ namespace WebCore { +enum BlobConstructorArrayBufferOrView { + BlobConstructorArrayBuffer, + BlobConstructorArrayBufferView, + BlobConstructorArrayBufferOrViewMax, +}; + // static PassRefPtr<WebKitBlobBuilder> WebKitBlobBuilder::create(ScriptExecutionContext* context) { @@ -101,22 +108,23 @@ void WebKitBlobBuilder::append(ScriptExecutionContext* context, ArrayBuffer* arr { String consoleMessage("ArrayBuffer values are deprecated in Blob Constructor. Use ArrayBufferView instead."); context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, consoleMessage); + + HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBuffer, BlobConstructorArrayBufferOrViewMax); + if (!arrayBuffer) return; - Vector<char>& buffer = getBuffer(); - size_t oldSize = buffer.size(); - buffer.append(static_cast<const char*>(arrayBuffer->data()), arrayBuffer->byteLength()); - m_size += buffer.size() - oldSize; + + appendBytesData(arrayBuffer->data(), arrayBuffer->byteLength()); } void WebKitBlobBuilder::append(ArrayBufferView* arrayBufferView) { + HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBufferView, BlobConstructorArrayBufferOrViewMax); + if (!arrayBufferView) return; - Vector<char>& buffer = getBuffer(); - size_t oldSize = buffer.size(); - buffer.append(static_cast<const char*>(arrayBufferView->baseAddress()), arrayBufferView->byteLength()); - m_size += buffer.size() - oldSize; + + appendBytesData(arrayBufferView->baseAddress(), arrayBufferView->byteLength()); } #endif @@ -141,6 +149,15 @@ void WebKitBlobBuilder::append(Blob* blob) } } + +void WebKitBlobBuilder::appendBytesData(const void* data, size_t length) +{ + Vector<char>& buffer = getBuffer(); + size_t oldSize = buffer.size(); + buffer.append(static_cast<const char*>(data), length); + m_size += buffer.size() - oldSize; +} + PassRefPtr<Blob> WebKitBlobBuilder::getBlob(const String& contentType) { OwnPtr<BlobData> blobData = BlobData::create(); diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.h b/Source/WebCore/fileapi/WebKitBlobBuilder.h index b78c7a696..c0b5e128b 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.h +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.h @@ -64,6 +64,8 @@ public: private: WebKitBlobBuilder(); + void appendBytesData(const void*, size_t); + Vector<char>& getBuffer(); long long m_size; |