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

Side by Side Diff: net/websockets/websocket_job.cc

Issue 2823034: Ignore if state is CLOSED (Closed)
Patch Set: Created 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/websockets/websocket_job.h" 5 #include "net/websockets/websocket_job.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/string_tokenizer.h" 9 #include "base/string_tokenizer.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 Singleton<WebSocketThrottle>::get()->PutInQueue(this); 166 Singleton<WebSocketThrottle>::get()->PutInQueue(this);
167 if (!waiting_) 167 if (!waiting_)
168 return OK; 168 return OK;
169 callback_ = callback; 169 callback_ = callback;
170 AddRef(); // Balanced when callback_ becomes NULL. 170 AddRef(); // Balanced when callback_ becomes NULL.
171 return ERR_IO_PENDING; 171 return ERR_IO_PENDING;
172 } 172 }
173 173
174 void WebSocketJob::OnConnected( 174 void WebSocketJob::OnConnected(
175 SocketStream* socket, int max_pending_send_allowed) { 175 SocketStream* socket, int max_pending_send_allowed) {
176 if (state_ == CLOSED)
177 return;
176 DCHECK_EQ(CONNECTING, state_); 178 DCHECK_EQ(CONNECTING, state_);
177 if (delegate_) 179 if (delegate_)
178 delegate_->OnConnected(socket, max_pending_send_allowed); 180 delegate_->OnConnected(socket, max_pending_send_allowed);
179 } 181 }
180 182
181 void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { 183 void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) {
182 DCHECK_NE(INITIALIZED, state_); 184 DCHECK_NE(INITIALIZED, state_);
183 if (state_ == CLOSED) 185 if (state_ == CLOSED)
184 return; 186 return;
185 if (state_ == CONNECTING) { 187 if (state_ == CONNECTING) {
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 socket_->Close(); 489 socket_->Close();
488 return; 490 return;
489 } 491 }
490 current_buffer_ = new DrainableIOBuffer( 492 current_buffer_ = new DrainableIOBuffer(
491 send_frame_handler_->GetCurrentBuffer(), 493 send_frame_handler_->GetCurrentBuffer(),
492 send_frame_handler_->GetCurrentBufferSize()); 494 send_frame_handler_->GetCurrentBufferSize());
493 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining()); 495 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining());
494 } 496 }
495 497
496 } // namespace net 498 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698