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

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: 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 DCHECK_EQ(result, net::OK);
Wez 2016/04/21 22:44:29 It seems that you're changing the MessageProcessor
Kevin M 2016/04/22 22:10:41 Done.
148 VLOG(2) << "Write complete, result=" << result; 148 VLOG(2) << "Write complete.";
Wez 2016/04/21 22:44:29 nit: None of our other log messages, above, seem t
Kevin M 2016/04/22 22:10:41 Done.
149 149 ack_buffer_.push_back(std::move(write_buffer_.front()));
150 if (result == net::OK) { 150 write_buffer_.pop_front();
151 ack_buffer_.push_back(std::move(write_buffer_.front())); 151 WriteNextMessageIfReady();
152 write_buffer_.pop_front();
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