|
|
Chromium Code Reviews|
Created:
5 years, 9 months ago by henrika (OOO until Aug 14) Modified:
5 years, 9 months ago CC:
chromium-reviews, darin-cc_chromium.org, jam Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionRevert of Per-renderer WebSocket throttling (patchset #13 id:300001 of https://codereview.chromium.org/972963002/)
Reason for revert:
Suspected to have caused WebSocket breakage.
Failure seen on apprtc.appspot.com and in browser_tests. Run the manual MANUAL_WorksWithAppRTC test for repro.
See https://code.google.com/p/chromium/issues/detail?id=467471&thanks=467471&ts=1426498439 for details.
Original issue's description:
> Per-renderer WebSocket throttling
>
> Design Doc:
> https://docs.google.com/document/d/1aw2oN5PKfk-1gLnBrlv1OwLA8K3-ykM2ckwX2lubTg4/edit?usp=sharing
>
> BUG=459377
>
> Committed: https://crrev.com/58d344316cf2b2cc110619c0fea4979ef143b3a9
> Cr-Commit-Position: refs/heads/master@{#320074}
TBR=ricea@chromium.org,hiroshige@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=459377
Committed: https://crrev.com/3464a08a0c157c57ea02881687f10058303de8ea
Cr-Commit-Position: refs/heads/master@{#320705}
Patch Set 1 #
Created: 5 years, 9 months ago
(Patch set is too large to download)
Messages
Total messages: 15 (6 generated)
Created Revert of Per-renderer WebSocket throttling
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1009303002/1
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for
content/browser/renderer_host/websocket_dispatcher_host_unittest.cc:
While running git apply --index -3 -p1;
error: patch failed:
content/browser/renderer_host/websocket_dispatcher_host_unittest.cc:310
Falling back to three-way merge...
Applied patch to
'content/browser/renderer_host/websocket_dispatcher_host_unittest.cc' with
conflicts.
U content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
Patch: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
Index: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
index
088f85d3b4150bbc0c834dccf69f85b926fd27bf..0d2e7057bbcef5c0d90dadebc580843114e208bd
100644
--- a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
@@ -11,12 +11,10 @@
#include "base/bind_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "content/browser/renderer_host/websocket_host.h"
#include "content/common/websocket.h"
#include "content/common/websocket_messages.h"
#include "ipc/ipc_message.h"
-#include "net/websockets/websocket_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -35,64 +33,26 @@
MockWebSocketHost(int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
- base::TimeDelta delay,
WebSocketDispatcherHostTest* owner);
~MockWebSocketHost() override {}
bool OnMessageReceived(const IPC::Message& message) override {
received_messages_.push_back(message);
- switch (message.type()) {
- case WebSocketMsg_DropChannel::ID:
- // Needed for PerRendererThrottlingFailedHandshakes, because without
- // calling WebSocketHost::OnMessageReceived() (and thus
- // WebSocketHost::OnDropChannel()), the connection stays pending and
- // we cannot test per-renderer throttling with failed connections.
- return WebSocketHost::OnMessageReceived(message);
-
- default:
- return true;
- }
+ return true;
}
void GoAway() override;
std::vector<IPC::Message> received_messages_;
base::WeakPtr<WebSocketDispatcherHostTest> owner_;
- base::TimeDelta delay_;
-};
-
-class TestingWebSocketDispatcherHost : public WebSocketDispatcherHost {
- public:
- TestingWebSocketDispatcherHost(
- int process_id,
- const GetRequestContextCallback& get_context_callback,
- const WebSocketHostFactory& websocket_host_factory)
- : WebSocketDispatcherHost(process_id,
- get_context_callback,
- websocket_host_factory) {}
-
- // This is needed because BrowserMessageFilter::Send() tries post the task to
- // the IO thread, which doesn't exist in the context of these tests.
- bool Send(IPC::Message* message) override {
- delete message;
- return true;
- }
-
- using WebSocketDispatcherHost::num_pending_connections;
- using WebSocketDispatcherHost::num_failed_connections;
- using WebSocketDispatcherHost::num_succeeded_connections;
-
- private:
- ~TestingWebSocketDispatcherHost() override {}
};
class WebSocketDispatcherHostTest : public ::testing::Test {
public:
WebSocketDispatcherHostTest()
- : next_routing_id_(123),
- weak_ptr_factory_(this) {
- dispatcher_host_ = new TestingWebSocketDispatcherHost(
+ : weak_ptr_factory_(this) {
+ dispatcher_host_ = new WebSocketDispatcherHost(
kMagicRenderProcessId,
base::Bind(&WebSocketDispatcherHostTest::OnGetRequestContext,
base::Unretained(this)),
@@ -115,90 +75,35 @@
}
protected:
- // Adds |n| connections. Returns true if succeeded.
- bool AddMultipleChannels(int number_of_channels) {
- GURL socket_url("ws://example.com/test");
- std::vector<std::string> requested_protocols;
- url::Origin origin("http://example.com");
- int render_frame_id = -3;
-
- for (int i = 0; i < number_of_channels; ++i) {
- int routing_id = next_routing_id_++;
- WebSocketHostMsg_AddChannelRequest message(
- routing_id,
- socket_url,
- requested_protocols,
- origin,
- render_frame_id);
- if (!dispatcher_host_->OnMessageReceived(message))
- return false;
- }
-
- return true;
- }
-
- // Adds and cancels |n| connections. Returns true if succeeded.
- bool AddAndCancelMultipleChannels(int number_of_channels) {
- GURL socket_url("ws://example.com/test");
- std::vector<std::string> requested_protocols;
- url::Origin origin("http://example.com");
- int render_frame_id = -3;
-
- for (int i = 0; i < number_of_channels; ++i) {
- int routing_id = next_routing_id_++;
- WebSocketHostMsg_AddChannelRequest messageAddChannelRequest(
- routing_id,
- socket_url,
- requested_protocols,
- origin,
- render_frame_id);
- if (!dispatcher_host_->OnMessageReceived(messageAddChannelRequest))
- return false;
-
- WebSocketMsg_DropChannel messageDropChannel(
- routing_id, false, net::kWebSocketErrorAbnormalClosure, "");
- if (!dispatcher_host_->OnMessageReceived(messageDropChannel))
- return false;
- }
-
- return true;
- }
-
- scoped_refptr<TestingWebSocketDispatcherHost> dispatcher_host_;
+ scoped_refptr<WebSocketDispatcherHost> dispatcher_host_;
// Stores allocated MockWebSocketHost instances. Doesn't take ownership of
// them.
std::vector<MockWebSocketHost*> mock_hosts_;
std::vector<int> gone_hosts_;
+ base::WeakPtrFactory<WebSocketDispatcherHostTest> weak_ptr_factory_;
+
private:
net::URLRequestContext* OnGetRequestContext() {
return NULL;
}
- WebSocketHost* CreateWebSocketHost(int routing_id, base::TimeDelta delay) {
- MockWebSocketHost* host = new MockWebSocketHost(
- routing_id, dispatcher_host_.get(), NULL, delay, this);
+ WebSocketHost* CreateWebSocketHost(int routing_id) {
+ MockWebSocketHost* host =
+ new MockWebSocketHost(routing_id, dispatcher_host_.get(), NULL, this);
mock_hosts_.push_back(host);
return host;
}
-
- base::MessageLoop message_loop_;
-
- int next_routing_id_;
-
- base::WeakPtrFactory<WebSocketDispatcherHostTest> weak_ptr_factory_;
};
MockWebSocketHost::MockWebSocketHost(
int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
- base::TimeDelta delay,
WebSocketDispatcherHostTest* owner)
- : WebSocketHost(routing_id, dispatcher, url_request_context, delay),
- owner_(owner->GetWeakPtr()),
- delay_(delay) {}
+ : WebSocketHost(routing_id, dispatcher, url_request_context),
+ owner_(owner->GetWeakPtr()) {}
void MockWebSocketHost::GoAway() {
if (owner_)
@@ -223,7 +128,7 @@
GURL socket_url("ws://example.com/test");
std::vector<std::string> requested_protocols;
requested_protocols.push_back("hello");
- url::Origin origin("http://example.com");
+ url::Origin origin("http://example.com/test");
int render_frame_id = -2;
WebSocketHostMsg_AddChannelRequest message(
routing_id, socket_url, requested_protocols, origin, render_frame_id);
@@ -257,7 +162,7 @@
GURL socket_url("ws://example.com/test");
std::vector<std::string> requested_protocols;
requested_protocols.push_back("hello");
- url::Origin origin("http://example.com");
+ url::Origin origin("http://example.com/test");
int render_frame_id = -2;
WebSocketHostMsg_AddChannelRequest add_channel_message(
routing_id, socket_url, requested_protocols, origin, render_frame_id);
@@ -310,105 +215,5 @@
EXPECT_EQ(456, gone_hosts_[1]);
}
-TEST_F(WebSocketDispatcherHostTest, DelayFor4thPendingConnectionIsZero) {
- ASSERT_TRUE(AddMultipleChannels(4));
-
- EXPECT_EQ(4, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(4U, mock_hosts_.size());
- EXPECT_EQ(base::TimeDelta(), mock_hosts_[3]->delay_);
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayFor8thPendingConnectionIsNonZero) {
- ASSERT_TRUE(AddMultipleChannels(8));
-
- EXPECT_EQ(8, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(8U, mock_hosts_.size());
- EXPECT_LT(base::TimeDelta(), mock_hosts_[7]->delay_);
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayFor17thPendingConnection) {
- ASSERT_TRUE(AddMultipleChannels(17));
-
- EXPECT_EQ(17, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(17U, mock_hosts_.size());
- EXPECT_LE(base::TimeDelta::FromMilliseconds(1000), mock_hosts_[16]->delay_);
- EXPECT_GE(base::TimeDelta::FromMilliseconds(5000), mock_hosts_[16]->delay_);
-}
-
-// The 256th connection is rejected by per-renderer WebSocket throttling.
-// This is not counted as a failure.
-TEST_F(WebSocketDispatcherHostTest, Rejects256thPendingConnection) {
- ASSERT_TRUE(AddMultipleChannels(256));
-
- EXPECT_EQ(255, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(255U, mock_hosts_.size());
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayIsZeroAfter3FailedConnections) {
- ASSERT_TRUE(AddAndCancelMultipleChannels(3));
-
- EXPEC…
(message too large)
The CQ bit was unchecked by commit-bot@chromium.org
The CQ bit was checked by hiroshige@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1009303002/1
The CQ bit was unchecked by commit-bot@chromium.org
Failed to apply patch for
content/browser/renderer_host/websocket_dispatcher_host_unittest.cc:
While running git apply --index -3 -p1;
error: patch failed:
content/browser/renderer_host/websocket_dispatcher_host_unittest.cc:310
Falling back to three-way merge...
Applied patch to
'content/browser/renderer_host/websocket_dispatcher_host_unittest.cc' with
conflicts.
U content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
Patch: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
Index: content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
index
088f85d3b4150bbc0c834dccf69f85b926fd27bf..0d2e7057bbcef5c0d90dadebc580843114e208bd
100644
--- a/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/websocket_dispatcher_host_unittest.cc
@@ -11,12 +11,10 @@
#include "base/bind_helpers.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "content/browser/renderer_host/websocket_host.h"
#include "content/common/websocket.h"
#include "content/common/websocket_messages.h"
#include "ipc/ipc_message.h"
-#include "net/websockets/websocket_errors.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -35,64 +33,26 @@
MockWebSocketHost(int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
- base::TimeDelta delay,
WebSocketDispatcherHostTest* owner);
~MockWebSocketHost() override {}
bool OnMessageReceived(const IPC::Message& message) override {
received_messages_.push_back(message);
- switch (message.type()) {
- case WebSocketMsg_DropChannel::ID:
- // Needed for PerRendererThrottlingFailedHandshakes, because without
- // calling WebSocketHost::OnMessageReceived() (and thus
- // WebSocketHost::OnDropChannel()), the connection stays pending and
- // we cannot test per-renderer throttling with failed connections.
- return WebSocketHost::OnMessageReceived(message);
-
- default:
- return true;
- }
+ return true;
}
void GoAway() override;
std::vector<IPC::Message> received_messages_;
base::WeakPtr<WebSocketDispatcherHostTest> owner_;
- base::TimeDelta delay_;
-};
-
-class TestingWebSocketDispatcherHost : public WebSocketDispatcherHost {
- public:
- TestingWebSocketDispatcherHost(
- int process_id,
- const GetRequestContextCallback& get_context_callback,
- const WebSocketHostFactory& websocket_host_factory)
- : WebSocketDispatcherHost(process_id,
- get_context_callback,
- websocket_host_factory) {}
-
- // This is needed because BrowserMessageFilter::Send() tries post the task to
- // the IO thread, which doesn't exist in the context of these tests.
- bool Send(IPC::Message* message) override {
- delete message;
- return true;
- }
-
- using WebSocketDispatcherHost::num_pending_connections;
- using WebSocketDispatcherHost::num_failed_connections;
- using WebSocketDispatcherHost::num_succeeded_connections;
-
- private:
- ~TestingWebSocketDispatcherHost() override {}
};
class WebSocketDispatcherHostTest : public ::testing::Test {
public:
WebSocketDispatcherHostTest()
- : next_routing_id_(123),
- weak_ptr_factory_(this) {
- dispatcher_host_ = new TestingWebSocketDispatcherHost(
+ : weak_ptr_factory_(this) {
+ dispatcher_host_ = new WebSocketDispatcherHost(
kMagicRenderProcessId,
base::Bind(&WebSocketDispatcherHostTest::OnGetRequestContext,
base::Unretained(this)),
@@ -115,90 +75,35 @@
}
protected:
- // Adds |n| connections. Returns true if succeeded.
- bool AddMultipleChannels(int number_of_channels) {
- GURL socket_url("ws://example.com/test");
- std::vector<std::string> requested_protocols;
- url::Origin origin("http://example.com");
- int render_frame_id = -3;
-
- for (int i = 0; i < number_of_channels; ++i) {
- int routing_id = next_routing_id_++;
- WebSocketHostMsg_AddChannelRequest message(
- routing_id,
- socket_url,
- requested_protocols,
- origin,
- render_frame_id);
- if (!dispatcher_host_->OnMessageReceived(message))
- return false;
- }
-
- return true;
- }
-
- // Adds and cancels |n| connections. Returns true if succeeded.
- bool AddAndCancelMultipleChannels(int number_of_channels) {
- GURL socket_url("ws://example.com/test");
- std::vector<std::string> requested_protocols;
- url::Origin origin("http://example.com");
- int render_frame_id = -3;
-
- for (int i = 0; i < number_of_channels; ++i) {
- int routing_id = next_routing_id_++;
- WebSocketHostMsg_AddChannelRequest messageAddChannelRequest(
- routing_id,
- socket_url,
- requested_protocols,
- origin,
- render_frame_id);
- if (!dispatcher_host_->OnMessageReceived(messageAddChannelRequest))
- return false;
-
- WebSocketMsg_DropChannel messageDropChannel(
- routing_id, false, net::kWebSocketErrorAbnormalClosure, "");
- if (!dispatcher_host_->OnMessageReceived(messageDropChannel))
- return false;
- }
-
- return true;
- }
-
- scoped_refptr<TestingWebSocketDispatcherHost> dispatcher_host_;
+ scoped_refptr<WebSocketDispatcherHost> dispatcher_host_;
// Stores allocated MockWebSocketHost instances. Doesn't take ownership of
// them.
std::vector<MockWebSocketHost*> mock_hosts_;
std::vector<int> gone_hosts_;
+ base::WeakPtrFactory<WebSocketDispatcherHostTest> weak_ptr_factory_;
+
private:
net::URLRequestContext* OnGetRequestContext() {
return NULL;
}
- WebSocketHost* CreateWebSocketHost(int routing_id, base::TimeDelta delay) {
- MockWebSocketHost* host = new MockWebSocketHost(
- routing_id, dispatcher_host_.get(), NULL, delay, this);
+ WebSocketHost* CreateWebSocketHost(int routing_id) {
+ MockWebSocketHost* host =
+ new MockWebSocketHost(routing_id, dispatcher_host_.get(), NULL, this);
mock_hosts_.push_back(host);
return host;
}
-
- base::MessageLoop message_loop_;
-
- int next_routing_id_;
-
- base::WeakPtrFactory<WebSocketDispatcherHostTest> weak_ptr_factory_;
};
MockWebSocketHost::MockWebSocketHost(
int routing_id,
WebSocketDispatcherHost* dispatcher,
net::URLRequestContext* url_request_context,
- base::TimeDelta delay,
WebSocketDispatcherHostTest* owner)
- : WebSocketHost(routing_id, dispatcher, url_request_context, delay),
- owner_(owner->GetWeakPtr()),
- delay_(delay) {}
+ : WebSocketHost(routing_id, dispatcher, url_request_context),
+ owner_(owner->GetWeakPtr()) {}
void MockWebSocketHost::GoAway() {
if (owner_)
@@ -223,7 +128,7 @@
GURL socket_url("ws://example.com/test");
std::vector<std::string> requested_protocols;
requested_protocols.push_back("hello");
- url::Origin origin("http://example.com");
+ url::Origin origin("http://example.com/test");
int render_frame_id = -2;
WebSocketHostMsg_AddChannelRequest message(
routing_id, socket_url, requested_protocols, origin, render_frame_id);
@@ -257,7 +162,7 @@
GURL socket_url("ws://example.com/test");
std::vector<std::string> requested_protocols;
requested_protocols.push_back("hello");
- url::Origin origin("http://example.com");
+ url::Origin origin("http://example.com/test");
int render_frame_id = -2;
WebSocketHostMsg_AddChannelRequest add_channel_message(
routing_id, socket_url, requested_protocols, origin, render_frame_id);
@@ -310,105 +215,5 @@
EXPECT_EQ(456, gone_hosts_[1]);
}
-TEST_F(WebSocketDispatcherHostTest, DelayFor4thPendingConnectionIsZero) {
- ASSERT_TRUE(AddMultipleChannels(4));
-
- EXPECT_EQ(4, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(4U, mock_hosts_.size());
- EXPECT_EQ(base::TimeDelta(), mock_hosts_[3]->delay_);
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayFor8thPendingConnectionIsNonZero) {
- ASSERT_TRUE(AddMultipleChannels(8));
-
- EXPECT_EQ(8, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(8U, mock_hosts_.size());
- EXPECT_LT(base::TimeDelta(), mock_hosts_[7]->delay_);
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayFor17thPendingConnection) {
- ASSERT_TRUE(AddMultipleChannels(17));
-
- EXPECT_EQ(17, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(17U, mock_hosts_.size());
- EXPECT_LE(base::TimeDelta::FromMilliseconds(1000), mock_hosts_[16]->delay_);
- EXPECT_GE(base::TimeDelta::FromMilliseconds(5000), mock_hosts_[16]->delay_);
-}
-
-// The 256th connection is rejected by per-renderer WebSocket throttling.
-// This is not counted as a failure.
-TEST_F(WebSocketDispatcherHostTest, Rejects256thPendingConnection) {
- ASSERT_TRUE(AddMultipleChannels(256));
-
- EXPECT_EQ(255, dispatcher_host_->num_pending_connections());
- EXPECT_EQ(0, dispatcher_host_->num_failed_connections());
- EXPECT_EQ(0, dispatcher_host_->num_succeeded_connections());
-
- ASSERT_EQ(255U, mock_hosts_.size());
-}
-
-TEST_F(WebSocketDispatcherHostTest, DelayIsZeroAfter3FailedConnections) {
- ASSERT_TRUE(AddAndCancelMultipleChannels(3));
-
- EXPEC…
(message too large)
The CQ bit was unchecked by commit-bot@chromium.org
The CQ bit was checked by hiroshige@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1009303002/1
Message was sent while issue was closed.
Committed patchset #1 (id:1)
Message was sent while issue was closed.
Patchset 1 (id:??) landed as https://crrev.com/3464a08a0c157c57ea02881687f10058303de8ea Cr-Commit-Position: refs/heads/master@{#320705}
Message was sent while issue was closed.
A revert of this CL (patchset #1 id:1) has been created in https://codereview.chromium.org/1011743002/ by hiroshige@chromium.org. The reason for reverting is: The breakage still persists https://crbug.com/467471 after the original CL was reverted.. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
