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

Unified Diff: content/browser/renderer_host/websocket_host.cc

Issue 1009303002: Revert of Per-renderer WebSocket throttling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « content/browser/renderer_host/websocket_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/websocket_host.cc
diff --git a/content/browser/renderer_host/websocket_host.cc b/content/browser/renderer_host/websocket_host.cc
index ddbb6e0982caa0b0dd482b74b0d4b14d137cd53f..a3a805eefc924bc7956f38208817179678fdc5a3 100644
--- a/content/browser/renderer_host/websocket_host.cc
+++ b/content/browser/renderer_host/websocket_host.cc
@@ -312,15 +312,10 @@
WebSocketHost::WebSocketHost(int routing_id,
WebSocketDispatcherHost* dispatcher,
- net::URLRequestContext* url_request_context,
- base::TimeDelta delay)
+ net::URLRequestContext* url_request_context)
: dispatcher_(dispatcher),
url_request_context_(url_request_context),
- routing_id_(routing_id),
- delay_(delay),
- pending_flow_control_quota_(0),
- handshake_succeeded_(false),
- weak_ptr_factory_(this) {
+ routing_id_(routing_id) {
DVLOG(1) << "WebSocketHost: created routing_id=" << routing_id;
}
@@ -354,44 +349,11 @@
<< origin.string() << "\"";
DCHECK(!channel_);
- if (delay_ > base::TimeDelta()) {
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&WebSocketHost::AddChannel,
- weak_ptr_factory_.GetWeakPtr(),
- socket_url,
- requested_protocols,
- origin,
- render_frame_id),
- delay_);
- } else {
- AddChannel(socket_url, requested_protocols, origin, render_frame_id);
- }
-}
-
-void WebSocketHost::AddChannel(
- const GURL& socket_url,
- const std::vector<std::string>& requested_protocols,
- const url::Origin& origin,
- int render_frame_id) {
- DVLOG(3) << "WebSocketHost::AddChannel"
- << " routing_id=" << routing_id_ << " socket_url=\"" << socket_url
- << "\" requested_protocols=\""
- << JoinString(requested_protocols, ", ") << "\" origin=\""
- << origin.string() << "\"";
-
- DCHECK(!channel_);
-
scoped_ptr<net::WebSocketEventInterface> event_interface(
new WebSocketEventHandler(dispatcher_, routing_id_, render_frame_id));
channel_.reset(
new net::WebSocketChannel(event_interface.Pass(), url_request_context_));
channel_->SendAddChannelRequest(socket_url, requested_protocols, origin);
-
- if (pending_flow_control_quota_ > 0) {
- channel_->SendFlowControl(pending_flow_control_quota_);
- pending_flow_control_quota_ = 0;
- }
}
void WebSocketHost::OnSendFrame(bool fin,
@@ -409,14 +371,7 @@
DVLOG(3) << "WebSocketHost::OnFlowControl"
<< " routing_id=" << routing_id_ << " quota=" << quota;
- if (!channel_) {
- // WebSocketChannel is not yet created due to the delay introduced by
- // per-renderer WebSocket throttling.
- // SendFlowControl() is called after WebSocketChannel is created.
- pending_flow_control_quota_ += quota;
- return;
- }
-
+ DCHECK(channel_);
channel_->SendFlowControl(quota);
}
@@ -427,18 +382,7 @@
<< " routing_id=" << routing_id_ << " was_clean=" << was_clean
<< " code=" << code << " reason=\"" << reason << "\"";
- if (!channel_) {
- // WebSocketChannel is not yet created due to the delay introduced by
- // per-renderer WebSocket throttling.
- WebSocketDispatcherHost::WebSocketHostState result =
- dispatcher_->DoDropChannel(routing_id_,
- false,
- net::kWebSocketErrorAbnormalClosure,
- "");
- DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result);
- return;
- }
-
+ DCHECK(channel_);
// TODO(yhirano): Handle |was_clean| appropriately.
channel_->StartClosingHandshake(code, reason);
}
« no previous file with comments | « content/browser/renderer_host/websocket_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698