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

Side by Side Diff: net/quic/quic_reliable_client_stream.cc

Issue 1261273003: relnote: Change the QuicStreamSequencer to call OnDataAvailable instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace DonReading with OnFinRead Created 5 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
« no previous file with comments | « net/quic/quic_reliable_client_stream.h ('k') | net/quic/quic_stream_sequencer.cc » ('j') | 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/quic/quic_reliable_client_stream.h" 5 #include "net/quic/quic_reliable_client_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 } 71 }
72 72
73 QuicPriority QuicReliableClientStream::EffectivePriority() const { 73 QuicPriority QuicReliableClientStream::EffectivePriority() const {
74 if (delegate_ && delegate_->HasSendHeadersComplete()) { 74 if (delegate_ && delegate_->HasSendHeadersComplete()) {
75 return QuicDataStream::EffectivePriority(); 75 return QuicDataStream::EffectivePriority();
76 } 76 }
77 return QuicWriteBlockedList::kHighestPriority; 77 return QuicWriteBlockedList::kHighestPriority;
78 } 78 }
79 79
80 void QuicReliableClientStream::OnFinRead() {
81 // Do not close the stream here to give the caller a chance to
82 // invoke DoneReading.
83 }
84
85 void QuicReliableClientStream::DoneReading() {
86 QuicDataStream::OnFinRead();
87 }
88
89 int QuicReliableClientStream::WriteStreamData( 80 int QuicReliableClientStream::WriteStreamData(
90 base::StringPiece data, 81 base::StringPiece data,
91 bool fin, 82 bool fin,
92 const CompletionCallback& callback) { 83 const CompletionCallback& callback) {
93 // We should not have data buffered. 84 // We should not have data buffered.
94 DCHECK(!HasBufferedData()); 85 DCHECK(!HasBufferedData());
95 // Writes the data, or buffers it. 86 // Writes the data, or buffers it.
96 WriteOrBufferData(data, fin, nullptr); 87 WriteOrBufferData(data, fin, nullptr);
97 if (!HasBufferedData()) { 88 if (!HasBufferedData()) {
98 return OK; 89 return OK;
99 } 90 }
100 91
101 callback_ = callback; 92 callback_ = callback;
102 return ERR_IO_PENDING; 93 return ERR_IO_PENDING;
103 } 94 }
104 95
105 void QuicReliableClientStream::SetDelegate( 96 void QuicReliableClientStream::SetDelegate(
106 QuicReliableClientStream::Delegate* delegate) { 97 QuicReliableClientStream::Delegate* delegate) {
107 DCHECK(!(delegate_ && delegate)); 98 DCHECK(!(delegate_ && delegate));
108 delegate_ = delegate; 99 delegate_ = delegate;
109 if (delegate == nullptr && sequencer()->IsClosed()) { 100 if (delegate == nullptr && sequencer()->IsClosed()) {
110 DoneReading(); 101 OnFinRead();
111 } 102 }
112 } 103 }
113 104
114 void QuicReliableClientStream::OnError(int error) { 105 void QuicReliableClientStream::OnError(int error) {
115 if (delegate_) { 106 if (delegate_) {
116 QuicReliableClientStream::Delegate* delegate = delegate_; 107 QuicReliableClientStream::Delegate* delegate = delegate_;
117 delegate_ = nullptr; 108 delegate_ = nullptr;
118 delegate->OnError(error); 109 delegate->OnError(error);
119 } 110 }
120 } 111 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 base::Bind(&QuicReliableClientStream::NotifyDelegateOfDataAvailable, 168 base::Bind(&QuicReliableClientStream::NotifyDelegateOfDataAvailable,
178 weak_factory_.GetWeakPtr())); 169 weak_factory_.GetWeakPtr()));
179 } 170 }
180 171
181 void QuicReliableClientStream::NotifyDelegateOfDataAvailable() { 172 void QuicReliableClientStream::NotifyDelegateOfDataAvailable() {
182 if (delegate_) 173 if (delegate_)
183 delegate_->OnDataAvailable(); 174 delegate_->OnDataAvailable();
184 } 175 }
185 176
186 } // namespace net 177 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_reliable_client_stream.h ('k') | net/quic/quic_stream_sequencer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698