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

Unified Diff: Source/modules/websockets/WebSocket.cpp

Issue 244923002: UMA: Count the number of WebSocket.send() call for each argument type. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/websockets/WebSocket.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/WebSocket.cpp
diff --git a/Source/modules/websockets/WebSocket.cpp b/Source/modules/websockets/WebSocket.cpp
index 5e13fb24779098edc913f5be096ec7450a67ea78..1d3cbfd39b479da182ae1c6ad5a82302917feef4 100644
--- a/Source/modules/websockets/WebSocket.cpp
+++ b/Source/modules/websockets/WebSocket.cpp
@@ -51,6 +51,7 @@
#include "platform/heap/Handle.h"
#include "platform/weborigin/KnownPorts.h"
#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
#include "wtf/ArrayBuffer.h"
#include "wtf/ArrayBufferView.h"
#include "wtf/HashSet.h"
@@ -356,7 +357,7 @@ void WebSocket::connect(const String& url, const Vector<String>& protocols, Exce
m_channel->connect(m_url, protocolString);
}
-void WebSocket::handleSendResult(WebSocketChannel::SendResult result, ExceptionState& exceptionState)
+void WebSocket::handleSendResult(WebSocketChannel::SendResult result, ExceptionState& exceptionState, WebSocketSendType dataType)
{
switch (result) {
case WebSocketChannel::InvalidMessage:
@@ -366,6 +367,7 @@ void WebSocket::handleSendResult(WebSocketChannel::SendResult result, ExceptionS
logError("WebSocket send() failed.");
return;
case WebSocketChannel::SendSuccess:
+ blink::Platform::current()->histogramEnumeration("WebCore.WebSocket.SendType", dataType, WebSocketSendTypeMax);
return;
}
ASSERT_NOT_REACHED();
@@ -399,7 +401,7 @@ void WebSocket::send(const String& message, ExceptionState& exceptionState)
return;
}
ASSERT(m_channel);
- handleSendResult(m_channel->send(message), exceptionState);
+ handleSendResult(m_channel->send(message), exceptionState, WebSocketSendTypeString);
}
void WebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState)
@@ -415,7 +417,7 @@ void WebSocket::send(ArrayBuffer* binaryData, ExceptionState& exceptionState)
return;
}
ASSERT(m_channel);
- handleSendResult(m_channel->send(*binaryData, 0, binaryData->byteLength()), exceptionState);
+ handleSendResult(m_channel->send(*binaryData, 0, binaryData->byteLength()), exceptionState, WebSocketSendTypeArrayBuffer);
}
void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& exceptionState)
@@ -432,7 +434,7 @@ void WebSocket::send(ArrayBufferView* arrayBufferView, ExceptionState& exception
}
ASSERT(m_channel);
RefPtr<ArrayBuffer> arrayBuffer(arrayBufferView->buffer());
- handleSendResult(m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength()), exceptionState);
+ handleSendResult(m_channel->send(*arrayBuffer, arrayBufferView->byteOffset(), arrayBufferView->byteLength()), exceptionState, WebSocketSendTypeArrayBufferView);
}
void WebSocket::send(Blob* binaryData, ExceptionState& exceptionState)
@@ -448,7 +450,7 @@ void WebSocket::send(Blob* binaryData, ExceptionState& exceptionState)
return;
}
ASSERT(m_channel);
- handleSendResult(m_channel->send(binaryData->blobDataHandle()), exceptionState);
+ handleSendResult(m_channel->send(binaryData->blobDataHandle()), exceptionState, WebSocketSendTypeBlob);
}
void WebSocket::close(unsigned short code, const String& reason, ExceptionState& exceptionState)
« no previous file with comments | « Source/modules/websockets/WebSocket.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698