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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/linked_ptr.h" | 8 #include "base/linked_ptr.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
625 | 625 |
626 // We only notify the stream when we've fully written the pending frame. | 626 // We only notify the stream when we've fully written the pending frame. |
627 if (!in_flight_write_.buffer()->BytesRemaining()) { | 627 if (!in_flight_write_.buffer()->BytesRemaining()) { |
628 if (stream) { | 628 if (stream) { |
629 // Report the number of bytes written to the caller, but exclude the | 629 // Report the number of bytes written to the caller, but exclude the |
630 // frame size overhead. NOTE: if this frame was compressed the | 630 // frame size overhead. NOTE: if this frame was compressed the |
631 // reported bytes written is the compressed size, not the original | 631 // reported bytes written is the compressed size, not the original |
632 // size. | 632 // size. |
633 if (result > 0) { | 633 if (result > 0) { |
634 result = in_flight_write_.buffer()->size(); | 634 result = in_flight_write_.buffer()->size(); |
635 DCHECK_GT(result, static_cast<int>(spdy::SpdyFrame::size())); | 635 DCHECK_GE(result, static_cast<int>(spdy::SpdyFrame::size())); |
willchan no longer on Chromium
2011/02/01 23:35:59
Why is it a DCHECK_GE now?
Satish
2011/02/22 14:25:44
Per the SPDY spec the last chunk is indicated with
| |
636 result -= static_cast<int>(spdy::SpdyFrame::size()); | 636 result -= static_cast<int>(spdy::SpdyFrame::size()); |
637 } | 637 } |
638 | 638 |
639 // It is possible that the stream was cancelled while we were writing | 639 // It is possible that the stream was cancelled while we were writing |
640 // to the socket. | 640 // to the socket. |
641 if (!stream->cancelled()) | 641 if (!stream->cancelled()) |
642 stream->OnWriteComplete(result); | 642 stream->OnWriteComplete(result); |
643 } | 643 } |
644 | 644 |
645 // Cleanup the write which just completed. | 645 // Cleanup the write which just completed. |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1481 if (it == pending_callback_map_.end()) | 1481 if (it == pending_callback_map_.end()) |
1482 return; | 1482 return; |
1483 | 1483 |
1484 CompletionCallback* callback = it->second.callback; | 1484 CompletionCallback* callback = it->second.callback; |
1485 int result = it->second.result; | 1485 int result = it->second.result; |
1486 pending_callback_map_.erase(it); | 1486 pending_callback_map_.erase(it); |
1487 callback->Run(result); | 1487 callback->Run(result); |
1488 } | 1488 } |
1489 | 1489 |
1490 } // namespace net | 1490 } // namespace net |
OLD | NEW |