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

Unified Diff: net/websockets/websocket_job.cc

Issue 18932005: Reduce the complexity of WebSocketThrottle's wakeup code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android_dbg build fix Created 7 years, 5 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/base/net_error_list.h ('k') | net/websockets/websocket_job_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_job.cc
diff --git a/net/websockets/websocket_job.cc b/net/websockets/websocket_job.cc
index 8240850580491d1097590183cb8e8430753324c0..3d7c11842770c11e6ee9ef9fd9eb1121a4b776f7 100644
--- a/net/websockets/websocket_job.cc
+++ b/net/websockets/websocket_job.cc
@@ -148,7 +148,6 @@ void WebSocketJob::RestartWithAuth(const AuthCredentials& credentials) {
void WebSocketJob::DetachDelegate() {
state_ = CLOSED;
WebSocketThrottle::GetInstance()->RemoveFromQueue(this);
- WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary();
scoped_refptr<WebSocketJob> protect(this);
weak_ptr_factory_.InvalidateWeakPtrs();
@@ -169,8 +168,12 @@ int WebSocketJob::OnStartOpenConnection(
SocketStream* socket, const CompletionCallback& callback) {
DCHECK(callback_.is_null());
state_ = CONNECTING;
+
addresses_ = socket->address_list();
- WebSocketThrottle::GetInstance()->PutInQueue(this);
+ if (!WebSocketThrottle::GetInstance()->PutInQueue(this)) {
+ return ERR_WS_THROTTLE_QUEUE_TOO_LARGE;
+ }
+
if (delegate_) {
int result = delegate_->OnStartOpenConnection(socket, callback);
DCHECK_EQ(OK, result);
@@ -246,7 +249,6 @@ void WebSocketJob::OnReceivedData(
void WebSocketJob::OnClose(SocketStream* socket) {
state_ = CLOSED;
WebSocketThrottle::GetInstance()->RemoveFromQueue(this);
- WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary();
scoped_refptr<WebSocketJob> protect(this);
weak_ptr_factory_.InvalidateWeakPtrs();
@@ -497,7 +499,6 @@ void WebSocketJob::NotifyHeadersComplete() {
socket_.get(), &received_data.front(), received_data.size());
WebSocketThrottle::GetInstance()->RemoveFromQueue(this);
- WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary();
}
void WebSocketJob::SaveNextCookie() {
« no previous file with comments | « net/base/net_error_list.h ('k') | net/websockets/websocket_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698