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

Unified Diff: net/websockets/websocket_basic_handshake_stream.cc

Issue 954393002: Revert "[WebSocket] Add NOINLINE function calls to see the stack trace." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix parts lost in the merge. Created 5 years, 10 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 | « net/websockets/websocket_basic_handshake_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7d993114034836a3f92d0f153ece8e340cb953fd..ecddd50fcfc850c88df9cd69a953773c971b1066 100644
--- a/net/websockets/websocket_basic_handshake_stream.cc
+++ b/net/websockets/websocket_basic_handshake_stream.cc
@@ -52,31 +52,6 @@ namespace {
const char kConnectionErrorStatusLine[] = "HTTP/1.1 503 Connection Error";
-// TODO(yhirano): Remove these functions once http://crbug.com/399535 is fixed.
-NOINLINE void RunCallbackWithOk(const CompletionCallback& callback,
- int result) {
- DCHECK_EQ(result, OK);
- callback.Run(OK);
-}
-
-NOINLINE void RunCallbackWithInvalidResponseCausedByRedirect(
- const CompletionCallback& callback,
- int result) {
- DCHECK_EQ(result, ERR_INVALID_RESPONSE);
- callback.Run(ERR_INVALID_RESPONSE);
-}
-
-NOINLINE void RunCallbackWithInvalidResponse(
- const CompletionCallback& callback,
- int result) {
- DCHECK_EQ(result, ERR_INVALID_RESPONSE);
- callback.Run(ERR_INVALID_RESPONSE);
-}
-
-NOINLINE void RunCallback(const CompletionCallback& callback, int result) {
- callback.Run(result);
-}
-
} // namespace
// TODO(ricea): If more extensions are added, replace this with a more general
@@ -463,8 +438,7 @@ int WebSocketBasicHandshakeStream::ReadResponseHeaders(
callback));
if (rv == ERR_IO_PENDING)
return rv;
- bool is_redirect = false;
- return ValidateResponse(rv, &is_redirect);
+ return ValidateResponse(rv);
}
int WebSocketBasicHandshakeStream::ReadResponseBody(
@@ -578,25 +552,7 @@ void WebSocketBasicHandshakeStream::SetWebSocketKeyForTesting(
void WebSocketBasicHandshakeStream::ReadResponseHeadersCallback(
const CompletionCallback& callback,
int result) {
- bool is_redirect = false;
- int rv = ValidateResponse(result, &is_redirect);
-
- // TODO(yhirano): Simplify this statement once http://crbug.com/399535 is
- // fixed.
- switch (rv) {
- case OK:
- RunCallbackWithOk(callback, rv);
- break;
- case ERR_INVALID_RESPONSE:
- if (is_redirect)
- RunCallbackWithInvalidResponseCausedByRedirect(callback, rv);
- else
- RunCallbackWithInvalidResponse(callback, rv);
- break;
- default:
- RunCallback(callback, rv);
- break;
- }
+ callback.Run(ValidateResponse(result));
}
void WebSocketBasicHandshakeStream::OnFinishOpeningHandshake() {
@@ -607,17 +563,14 @@ void WebSocketBasicHandshakeStream::OnFinishOpeningHandshake() {
http_response_info_->response_time);
}
-int WebSocketBasicHandshakeStream::ValidateResponse(int rv,
- bool* is_redirect) {
+int WebSocketBasicHandshakeStream::ValidateResponse(int rv) {
DCHECK(http_response_info_);
- *is_redirect = false;
// 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) {
const HttpResponseHeaders* headers = http_response_info_->headers.get();
const int response_code = headers->response_code();
- *is_redirect = HttpResponseHeaders::IsRedirectResponseCode(response_code);
UMA_HISTOGRAM_SPARSE_SLOWLY("Net.WebSocket.ResponseCode", response_code);
switch (response_code) {
case HTTP_SWITCHING_PROTOCOLS:
« no previous file with comments | « net/websockets/websocket_basic_handshake_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698