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

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: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « blimp/net/blimp_connection_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 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 << *message_to_write << ")"; 139 << *message_to_write << ")";
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_LE(result, 0);
148 VLOG(2) << "Write complete, result=" << result;
149 148
149 VLOG(2) << "Write result=" << net::ErrorToString(result);
150 if (result == net::OK) { 150 if (result == net::OK) {
151 ack_buffer_.push_back(std::move(write_buffer_.front())); 151 ack_buffer_.push_back(std::move(write_buffer_.front()));
152 write_buffer_.pop_front(); 152 write_buffer_.pop_front();
153 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 } 154 }
159 } 155 }
160 156
161 } // namespace blimp 157 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/blimp_connection_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698