Chromium Code Reviews| Index: net/websockets/websocket_basic_handshake_stream.cc |
| diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc |
| index a4a634e038bb703eadd207a7eb422e79b0015caf..779b65fb49eb78218a852dc76e19aef134536b2e 100644 |
| --- a/net/websockets/websocket_basic_handshake_stream.cc |
| +++ b/net/websockets/websocket_basic_handshake_stream.cc |
| @@ -28,6 +28,7 @@ |
| #include "net/http/http_response_headers.h" |
| #include "net/http/http_status_code.h" |
| #include "net/http/http_stream_parser.h" |
| +#include "net/http/http_util.h" |
| #include "net/socket/client_socket_handle.h" |
| #include "net/websockets/websocket_basic_stream.h" |
| #include "net/websockets/websocket_deflate_predictor.h" |
| @@ -552,9 +553,18 @@ void WebSocketBasicHandshakeStream::OnFinishOpeningHandshake() { |
| int WebSocketBasicHandshakeStream::ValidateResponse(int rv) { |
| DCHECK(http_response_info_); |
| - const HttpResponseHeaders* headers = http_response_info_->headers.get(); |
| + // Most net errors happen during connection, so they are not seen by this |
| + // method. The histogram for error codes is created in |
| + // Delegate::OnResponseStarted in websocket_stream.cc instead. |
| if (rv >= 0) { |
| - switch (headers->response_code()) { |
| + const HttpResponseHeaders* headers = http_response_info_->headers.get(); |
| + const int response_code = headers->response_code(); |
| + UMA_HISTOGRAM_CUSTOM_ENUMERATION( |
|
Alexei Svitkine (slow)
2014/06/17 15:34:27
Use UMA_HISTOGRAM_SPARSE_SLOWLY() here too. It's m
Adam Rice
2014/06/18 01:23:19
Done.
|
| + "Net.WebSocket.ResponseCode", |
| + HttpUtil::MapStatusCodeForHistogram(response_code), |
| + // The third argument is only evaluated once. |
| + HttpUtil::GetStatusCodesForHistogram()); |
| + switch (response_code) { |
| case HTTP_SWITCHING_PROTOCOLS: |
| OnFinishOpeningHandshake(); |
| return ValidateUpgradeResponse(headers); |