Changeset 122910 in webkit


Ignore:
Timestamp:
Jul 17, 2012 6:08:39 PM (12 years ago)
Author:
kinuko@chromium.org
Message:

Record metrics to measure the usage of Blob([ArrayBuffer]) to eventually deprecate it
https://bugs.webkit.org/show_bug.cgi?id=90534

Reviewed by Jian Li.

We are removing ArrayBuffer support in Blob constructor (in favor of
ArrayBufferView) but before doing that we should record its use relative to ArrayBufferView.
http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob

No new tests as this has no functional changes.

  • fileapi/WebKitBlobBuilder.cpp:

(WebCore::WebKitBlobBuilder::append):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122909 r122910  
     12012-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
    1172012-07-17  Joshua Bell  <jsbell@chromium.org>
    218
  • trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp

    r119956 r122910  
    3636#include "ExceptionCode.h"
    3737#include "File.h"
     38#include "HistogramSupport.h"
    3839#include "LineEnding.h"
    3940#include "ScriptExecutionContext.h"
     
    4748
    4849namespace WebCore {
     50
     51enum BlobConstructorArrayBufferOrView {
     52    BlobConstructorArrayBuffer,
     53    BlobConstructorArrayBufferView,
     54    BlobConstructorArrayBufferOrViewMax,
     55};
    4956
    5057// static
     
    102109    String consoleMessage("ArrayBuffer values are deprecated in Blob Constructor. Use ArrayBufferView instead.");
    103110    context->addConsoleMessage(JSMessageSource, LogMessageType, WarningMessageLevel, consoleMessage);
     111
     112    HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBuffer, BlobConstructorArrayBufferOrViewMax);
     113
    104114    if (!arrayBuffer)
    105115        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());
    110118}
    111119
    112120void WebKitBlobBuilder::append(ArrayBufferView* arrayBufferView)
    113121{
     122    HistogramSupport::histogramEnumeration("WebCore.Blob.constructor.ArrayBufferOrView", BlobConstructorArrayBufferView, BlobConstructorArrayBufferOrViewMax);
     123
    114124    if (!arrayBufferView)
    115125        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());
    120128}
    121129#endif
     
    142150}
    143151
     152
     153void 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
    144161PassRefPtr<Blob> WebKitBlobBuilder::getBlob(const String& contentType)
    145162{
  • trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h

    r119956 r122910  
    6565    WebKitBlobBuilder();
    6666
     67    void appendBytesData(const void*, size_t);
     68
    6769    Vector<char>& getBuffer();
    6870
Note: See TracChangeset for help on using the changeset viewer.