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

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

Issue 1933053003: Used oneof in blimp_message.proto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added oneof to protocol_control.proto 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
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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 void BlimpMessageOutputBuffer::WriteNextMessageIfReady() { 128 void BlimpMessageOutputBuffer::WriteNextMessageIfReady() {
129 DVLOG(3) << "WriteNextMessageIfReady"; 129 DVLOG(3) << "WriteNextMessageIfReady";
130 if (write_buffer_.empty()) { 130 if (write_buffer_.empty()) {
131 DVLOG(3) << "Nothing to write."; 131 DVLOG(3) << "Nothing to write.";
132 return; 132 return;
133 } 133 }
134 134
135 std::unique_ptr<BlimpMessage> message_to_write( 135 std::unique_ptr<BlimpMessage> message_to_write(
136 new BlimpMessage(*write_buffer_.front()->message)); 136 new BlimpMessage(*write_buffer_.front()->message));
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() << ", "
Kevin M 2016/05/20 18:28:16 Nit: move the message_id logging portion into the
shaktisahu 2016/05/20 22:29:42 It might be too verbose in that case. I think we d
139 << ", type=" << message_to_write->type() << ")"; 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, net::OK);
148 VLOG(2) << "Write complete, result=" << result; 148 VLOG(2) << "Write complete, result=" << result;
149 149
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 { 154 } else {
155 // An error occurred while writing to the network connection. 155 // An error occurred while writing to the network connection.
156 // Stop writing more messages until a new connection is established. 156 // Stop writing more messages until a new connection is established.
157 DLOG(WARNING) << "Write error (result=" << result << ")"; 157 DLOG(WARNING) << "Write error (result=" << result << ")";
158 } 158 }
159 } 159 }
160 160
161 } // namespace blimp 161 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698