OLD | NEW |
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 state_ = CLOSING; | 127 state_ = CLOSING; |
128 if (current_buffer_) { | 128 if (current_buffer_) { |
129 // Will close in SendPending. | 129 // Will close in SendPending. |
130 return; | 130 return; |
131 } | 131 } |
132 state_ = CLOSED; | 132 state_ = CLOSED; |
133 socket_->Close(); | 133 socket_->Close(); |
134 } | 134 } |
135 | 135 |
136 void WebSocketJob::RestartWithAuth( | 136 void WebSocketJob::RestartWithAuth( |
137 const std::wstring& username, | 137 const string16& username, |
138 const std::wstring& password) { | 138 const string16& password) { |
139 state_ = CONNECTING; | 139 state_ = CONNECTING; |
140 socket_->RestartWithAuth(username, password); | 140 socket_->RestartWithAuth(username, password); |
141 } | 141 } |
142 | 142 |
143 void WebSocketJob::DetachDelegate() { | 143 void WebSocketJob::DetachDelegate() { |
144 state_ = CLOSED; | 144 state_ = CLOSED; |
145 Singleton<WebSocketThrottle>::get()->RemoveFromQueue(this); | 145 Singleton<WebSocketThrottle>::get()->RemoveFromQueue(this); |
146 Singleton<WebSocketThrottle>::get()->WakeupSocketIfNecessary(); | 146 Singleton<WebSocketThrottle>::get()->WakeupSocketIfNecessary(); |
147 | 147 |
148 scoped_refptr<WebSocketJob> protect(this); | 148 scoped_refptr<WebSocketJob> protect(this); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 socket_->Close(); | 489 socket_->Close(); |
490 return; | 490 return; |
491 } | 491 } |
492 current_buffer_ = new DrainableIOBuffer( | 492 current_buffer_ = new DrainableIOBuffer( |
493 send_frame_handler_->GetCurrentBuffer(), | 493 send_frame_handler_->GetCurrentBuffer(), |
494 send_frame_handler_->GetCurrentBufferSize()); | 494 send_frame_handler_->GetCurrentBufferSize()); |
495 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining()); | 495 socket_->SendData(current_buffer_->data(), current_buffer_->BytesRemaining()); |
496 } | 496 } |
497 | 497 |
498 } // namespace net | 498 } // namespace net |
OLD | NEW |