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

Side by Side Diff: blimp/net/blimp_message_output_buffer.cc

Issue 1909143002: Use ConnectionErrorObserver, not callbacks, for error handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wez feedback Created 4 years, 8 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/net/blimp_message_output_buffer.h" 5 #include "blimp/net/blimp_message_output_buffer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 DVLOG(3) << "Writing message (id=" 137 DVLOG(3) << "Writing message (id="
138 << write_buffer_.front()->message->message_id() 138 << write_buffer_.front()->message->message_id()
139 << ", type=" << message_to_write->type() << ")"; 139 << ", type=" << message_to_write->type() << ")";
140 140
141 output_processor_->ProcessMessage(std::move(message_to_write), 141 output_processor_->ProcessMessage(std::move(message_to_write),
142 write_complete_cb_.callback()); 142 write_complete_cb_.callback());
143 DVLOG(3) << "Queue size: " << write_buffer_.size(); 143 DVLOG(3) << "Queue size: " << write_buffer_.size();
144 } 144 }
145 145
146 void BlimpMessageOutputBuffer::OnWriteComplete(int result) { 146 void BlimpMessageOutputBuffer::OnWriteComplete(int result) {
147 DCHECK_LE(result, net::OK); 147 VLOG(2) << "Write complete";
148 VLOG(2) << "Write complete, result=" << result;
149 148
haibinlu 2016/05/03 21:23:05 DCHECK_EQ(net::OK, result)
Wez 2016/05/07 22:13:47 See my comment on the earlier review ;)
Kevin M 2016/05/24 20:47:04 I added a DCHECK for positive values.
Kevin M 2016/05/24 20:47:04 Sorry, was that in reference to the callback signa
150 if (result == net::OK) { 149 ack_buffer_.push_back(std::move(write_buffer_.front()));
151 ack_buffer_.push_back(std::move(write_buffer_.front())); 150 write_buffer_.pop_front();
152 write_buffer_.pop_front(); 151 WriteNextMessageIfReady();
153 WriteNextMessageIfReady();
154 } else {
155 // An error occurred while writing to the network connection.
156 // Stop writing more messages until a new connection is established.
157 DLOG(WARNING) << "Write error (result=" << result << ")";
158 }
159 } 152 }
160 153
161 } // namespace blimp 154 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698