| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 weak_ptr_factory_.GetWeakPtr())); | 381 weak_ptr_factory_.GetWeakPtr())); |
| 382 } else { | 382 } else { |
| 383 DoSendData(); | 383 DoSendData(); |
| 384 } | 384 } |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 void WebSocketJob::LoadCookieCallback(const std::string& cookie) { | 388 void WebSocketJob::LoadCookieCallback(const std::string& cookie) { |
| 389 if (!cookie.empty()) | 389 if (!cookie.empty()) |
| 390 // TODO(tyoshino): Sending cookie means that connection doesn't need | 390 // TODO(tyoshino): Sending cookie means that connection doesn't need |
| 391 // PRIVACY_MODE_ENABLED as cookies may be server-bound and channel id | 391 // kPrivacyModeEnabled as cookies may be server-bound and channel id |
| 392 // wouldn't negatively affect privacy anyway. Need to restart connection | 392 // wouldn't negatively affect privacy anyway. Need to restart connection |
| 393 // or refactor to determine cookie status prior to connecting. | 393 // or refactor to determine cookie status prior to connecting. |
| 394 handshake_request_->AppendHeaderIfMissing("Cookie", cookie); | 394 handshake_request_->AppendHeaderIfMissing("Cookie", cookie); |
| 395 DoSendData(); | 395 DoSendData(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 void WebSocketJob::DoSendData() { | 398 void WebSocketJob::DoSendData() { |
| 399 if (spdy_websocket_stream_.get()) { | 399 if (spdy_websocket_stream_.get()) { |
| 400 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); | 400 scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); |
| 401 handshake_request_->GetRequestHeaderBlock( | 401 handshake_request_->GetRequestHeaderBlock( |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 693 |
| 694 scoped_refptr<IOBufferWithSize> next_buffer = send_buffer_queue_.front(); | 694 scoped_refptr<IOBufferWithSize> next_buffer = send_buffer_queue_.front(); |
| 695 send_buffer_queue_.pop_front(); | 695 send_buffer_queue_.pop_front(); |
| 696 current_send_buffer_ = | 696 current_send_buffer_ = |
| 697 new DrainableIOBuffer(next_buffer.get(), next_buffer->size()); | 697 new DrainableIOBuffer(next_buffer.get(), next_buffer->size()); |
| 698 SendDataInternal(current_send_buffer_->data(), | 698 SendDataInternal(current_send_buffer_->data(), |
| 699 current_send_buffer_->BytesRemaining()); | 699 current_send_buffer_->BytesRemaining()); |
| 700 } | 700 } |
| 701 | 701 |
| 702 } // namespace net | 702 } // namespace net |
| OLD | NEW |