| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 state_ = CLOSING; | 149 state_ = CLOSING; |
| 150 if (current_buffer_) { | 150 if (current_buffer_) { |
| 151 // Will close in SendPending. | 151 // Will close in SendPending. |
| 152 return; | 152 return; |
| 153 } | 153 } |
| 154 state_ = CLOSED; | 154 state_ = CLOSED; |
| 155 CloseInternal(); | 155 CloseInternal(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void WebSocketJob::RestartWithAuth( | 158 void WebSocketJob::RestartWithAuth(const AuthCredentials& credentials) { |
| 159 const string16& username, | |
| 160 const string16& password) { | |
| 161 state_ = CONNECTING; | 159 state_ = CONNECTING; |
| 162 socket_->RestartWithAuth(username, password); | 160 socket_->RestartWithAuth(credentials); |
| 163 } | 161 } |
| 164 | 162 |
| 165 void WebSocketJob::DetachDelegate() { | 163 void WebSocketJob::DetachDelegate() { |
| 166 state_ = CLOSED; | 164 state_ = CLOSED; |
| 167 WebSocketThrottle::GetInstance()->RemoveFromQueue(this); | 165 WebSocketThrottle::GetInstance()->RemoveFromQueue(this); |
| 168 WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary(); | 166 WebSocketThrottle::GetInstance()->WakeupSocketIfNecessary(); |
| 169 | 167 |
| 170 scoped_refptr<WebSocketJob> protect(this); | 168 scoped_refptr<WebSocketJob> protect(this); |
| 171 weak_ptr_factory_.InvalidateWeakPtrs(); | 169 weak_ptr_factory_.InvalidateWeakPtrs(); |
| 172 | 170 |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 CloseInternal(); | 664 CloseInternal(); |
| 667 return; | 665 return; |
| 668 } | 666 } |
| 669 current_buffer_ = new DrainableIOBuffer( | 667 current_buffer_ = new DrainableIOBuffer( |
| 670 send_frame_handler_->GetCurrentBuffer(), | 668 send_frame_handler_->GetCurrentBuffer(), |
| 671 send_frame_handler_->GetCurrentBufferSize()); | 669 send_frame_handler_->GetCurrentBufferSize()); |
| 672 SendDataInternal(current_buffer_->data(), current_buffer_->BytesRemaining()); | 670 SendDataInternal(current_buffer_->data(), current_buffer_->BytesRemaining()); |
| 673 } | 671 } |
| 674 | 672 |
| 675 } // namespace net | 673 } // namespace net |
| OLD | NEW |