Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 10829066: Fix a SPDY crash bug where a CHECK() is hit because a cancelled stream is considered active by the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only call CloseCreatedStream when stream_id == 0 Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_session_spdy3_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 : public SpdySession::SpdyIOBufferProducer { 80 : public SpdySession::SpdyIOBufferProducer {
81 public: 81 public:
82 SpdyStreamIOBufferProducer(SpdyStream* stream) : stream_(stream) {} 82 SpdyStreamIOBufferProducer(SpdyStream* stream) : stream_(stream) {}
83 83
84 // SpdyFrameProducer 84 // SpdyFrameProducer
85 virtual RequestPriority GetPriority() const OVERRIDE { 85 virtual RequestPriority GetPriority() const OVERRIDE {
86 return stream_->priority(); 86 return stream_->priority();
87 } 87 }
88 88
89 virtual SpdyIOBuffer* ProduceNextBuffer(SpdySession* session) OVERRIDE { 89 virtual SpdyIOBuffer* ProduceNextBuffer(SpdySession* session) OVERRIDE {
90 if (stream_->cancelled())
91 return NULL;
90 if (stream_->stream_id() == 0) 92 if (stream_->stream_id() == 0)
91 SpdySession::SpdyIOBufferProducer::ActivateStream(session, stream_); 93 SpdySession::SpdyIOBufferProducer::ActivateStream(session, stream_);
92 frame_.reset(stream_->ProduceNextFrame()); 94 frame_.reset(stream_->ProduceNextFrame());
93 return frame_ == NULL ? NULL : 95 return frame_ == NULL ? NULL :
94 SpdySession::SpdyIOBufferProducer::CreateIOBuffer( 96 SpdySession::SpdyIOBufferProducer::CreateIOBuffer(
95 frame_.get(), GetPriority(), stream_); 97 frame_.get(), GetPriority(), stream_);
96 } 98 }
97 99
98 private: 100 private:
99 scoped_refptr<SpdyStream> stream_; 101 scoped_refptr<SpdyStream> stream_;
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 delegate->OnClose(status); 521 delegate->OnClose(status);
520 } 522 }
521 523
522 void SpdyStream::Cancel() { 524 void SpdyStream::Cancel() {
523 if (cancelled()) 525 if (cancelled())
524 return; 526 return;
525 527
526 cancelled_ = true; 528 cancelled_ = true;
527 if (session_->IsStreamActive(stream_id_)) 529 if (session_->IsStreamActive(stream_id_))
528 session_->ResetStream(stream_id_, CANCEL, ""); 530 session_->ResetStream(stream_id_, CANCEL, "");
531 else if (stream_id_ == 0)
532 session_->CloseCreatedStream(this, CANCEL);
529 } 533 }
530 534
531 void SpdyStream::Close() { 535 void SpdyStream::Close() {
532 if (stream_id_ != 0) 536 if (stream_id_ != 0)
533 session_->CloseStream(stream_id_, net::OK); 537 session_->CloseStream(stream_id_, net::OK);
534 else 538 else
535 session_->CloseCreatedStream(this, OK); 539 session_->CloseCreatedStream(this, OK);
536 } 540 }
537 541
538 int SpdyStream::SendRequest(bool has_upload_data) { 542 int SpdyStream::SendRequest(bool has_upload_data) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", 798 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime",
795 recv_last_byte_time_ - recv_first_byte_time_); 799 recv_last_byte_time_ - recv_first_byte_time_);
796 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", 800 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime",
797 recv_last_byte_time_ - send_time_); 801 recv_last_byte_time_ - send_time_);
798 802
799 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); 803 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_);
800 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); 804 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_);
801 } 805 }
802 806
803 } // namespace net 807 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_spdy3_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698