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

Unified Diff: net/quic/chromium/bidirectional_stream_quic_impl.cc

Issue 2917753002: Use early-return when BidirectionalStreamQuicImpl calls NotifyError. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/chromium/bidirectional_stream_quic_impl.cc
diff --git a/net/quic/chromium/bidirectional_stream_quic_impl.cc b/net/quic/chromium/bidirectional_stream_quic_impl.cc
index 8a714f0725ed11d38ae94594f92fda8a8c7ae952..c3864fce8561b7ad838f3baef728c3a58ca391ac 100644
--- a/net/quic/chromium/bidirectional_stream_quic_impl.cc
+++ b/net/quic/chromium/bidirectional_stream_quic_impl.cc
@@ -266,27 +266,29 @@ void BidirectionalStreamQuicImpl::OnError(int error) {
void BidirectionalStreamQuicImpl::OnStreamReady(int rv) {
DCHECK_NE(ERR_IO_PENDING, rv);
DCHECK(rv == OK || !stream_);
- if (rv == OK) {
- stream_ = session_->ReleaseStream(this);
-
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::ReadInitialHeaders,
- weak_factory_.GetWeakPtr()));
-
- NotifyStreamReady();
- } else {
+ if (rv != OK) {
NotifyError(rv);
+ return;
}
+
+ stream_ = session_->ReleaseStream(this);
+
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&BidirectionalStreamQuicImpl::ReadInitialHeaders,
+ weak_factory_.GetWeakPtr()));
+
+ NotifyStreamReady();
}
void BidirectionalStreamQuicImpl::OnSendDataComplete(int rv) {
DCHECK(rv == OK || !stream_);
- if (rv == OK) {
- if (delegate_)
- delegate_->OnDataSent();
- } else {
+ if (rv != 0) {
NotifyError(rv);
+ return;
}
+
+ if (delegate_)
+ delegate_->OnDataSent();
}
void BidirectionalStreamQuicImpl::OnReadInitialHeadersComplete(int rv) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698