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/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include <algorithm> // min | 7 #include <algorithm> // min |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 write_buffer_len_ = 0; | 489 write_buffer_len_ = 0; |
490 | 490 |
491 // Proxy write callbacks result in deep callback chains. Post to allow the | 491 // Proxy write callbacks result in deep callback chains. Post to allow the |
492 // stream's write callback chain to unwind (see crbug.com/355511). | 492 // stream's write callback chain to unwind (see crbug.com/355511). |
493 base::ThreadTaskRunnerHandle::Get()->PostTask( | 493 base::ThreadTaskRunnerHandle::Get()->PostTask( |
494 FROM_HERE, base::Bind(&SpdyProxyClientSocket::RunCallback, | 494 FROM_HERE, base::Bind(&SpdyProxyClientSocket::RunCallback, |
495 write_callback_weak_factory_.GetWeakPtr(), | 495 write_callback_weak_factory_.GetWeakPtr(), |
496 ResetAndReturn(&write_callback_), rv)); | 496 ResetAndReturn(&write_callback_), rv)); |
497 } | 497 } |
498 | 498 |
| 499 void SpdyProxyClientSocket::OnTrailers(const SpdyHeaderBlock& trailers) { |
| 500 // |spdy_stream_| is of type SPDY_BIDIRECTIONAL_STREAM, so trailers are |
| 501 // combined with response headers and this method will not be calld. |
| 502 NOTREACHED(); |
| 503 } |
| 504 |
499 void SpdyProxyClientSocket::OnClose(int status) { | 505 void SpdyProxyClientSocket::OnClose(int status) { |
500 was_ever_used_ = spdy_stream_->WasEverUsed(); | 506 was_ever_used_ = spdy_stream_->WasEverUsed(); |
501 spdy_stream_.reset(); | 507 spdy_stream_.reset(); |
502 | 508 |
503 bool connecting = next_state_ != STATE_DISCONNECTED && | 509 bool connecting = next_state_ != STATE_DISCONNECTED && |
504 next_state_ < STATE_OPEN; | 510 next_state_ < STATE_OPEN; |
505 if (next_state_ == STATE_OPEN) | 511 if (next_state_ == STATE_OPEN) |
506 next_state_ = STATE_CLOSED; | 512 next_state_ = STATE_CLOSED; |
507 else | 513 else |
508 next_state_ = STATE_DISCONNECTED; | 514 next_state_ = STATE_DISCONNECTED; |
(...skipping 13 matching lines...) Expand all Loading... |
522 } else if (!read_callback_.is_null()) { | 528 } else if (!read_callback_.is_null()) { |
523 // If we have a read_callback_, the we need to make sure we call it back. | 529 // If we have a read_callback_, the we need to make sure we call it back. |
524 OnDataReceived(scoped_ptr<SpdyBuffer>()); | 530 OnDataReceived(scoped_ptr<SpdyBuffer>()); |
525 } | 531 } |
526 // This may have been deleted by read_callback_, so check first. | 532 // This may have been deleted by read_callback_, so check first. |
527 if (weak_ptr.get() && !write_callback.is_null()) | 533 if (weak_ptr.get() && !write_callback.is_null()) |
528 write_callback.Run(ERR_CONNECTION_CLOSED); | 534 write_callback.Run(ERR_CONNECTION_CLOSED); |
529 } | 535 } |
530 | 536 |
531 } // namespace net | 537 } // namespace net |
OLD | NEW |