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

Side by Side Diff: tools/battor_agent/battor_connection_impl.cc

Issue 1642113002: tools/battor_agent: Fixes a VS warning in battor_connection_impl.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | 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 "tools/battor_agent/battor_connection_impl.h" 5 #include "tools/battor_agent/battor_connection_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "device/serial/buffer.h" 9 #include "device/serial/buffer.h"
10 #include "device/serial/serial_io_handler.h" 10 #include "device/serial/serial_io_handler.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 150
151 void BattOrConnectionImpl::BeginReadBytes(size_t max_bytes_to_read) { 151 void BattOrConnectionImpl::BeginReadBytes(size_t max_bytes_to_read) {
152 pending_read_buffer_ = 152 pending_read_buffer_ =
153 make_scoped_refptr(new net::IOBuffer(max_bytes_to_read)); 153 make_scoped_refptr(new net::IOBuffer(max_bytes_to_read));
154 154
155 auto on_receive_buffer_filled = 155 auto on_receive_buffer_filled =
156 base::Bind(&BattOrConnectionImpl::OnBytesRead, AsWeakPtr()); 156 base::Bind(&BattOrConnectionImpl::OnBytesRead, AsWeakPtr());
157 157
158 io_handler_->Read(make_scoped_ptr(new device::ReceiveBuffer( 158 io_handler_->Read(make_scoped_ptr(new device::ReceiveBuffer(
159 pending_read_buffer_, max_bytes_to_read, on_receive_buffer_filled))); 159 pending_read_buffer_, static_cast<uint32_t>(max_bytes_to_read),
160 on_receive_buffer_filled)));
160 } 161 }
161 162
162 void BattOrConnectionImpl::OnBytesRead(int bytes_read, 163 void BattOrConnectionImpl::OnBytesRead(int bytes_read,
163 device::serial::ReceiveError error) { 164 device::serial::ReceiveError error) {
164 if (bytes_read == 0 || error != device::serial::ReceiveError::NONE) { 165 if (bytes_read == 0 || error != device::serial::ReceiveError::NONE) {
165 // If we didn't have a message before, and we weren't able to read any 166 // If we didn't have a message before, and we weren't able to read any
166 // additional bytes, then there's no valid message available. 167 // additional bytes, then there's no valid message available.
167 EndReadBytes(false, BATTOR_MESSAGE_TYPE_CONTROL, nullptr); 168 EndReadBytes(false, BATTOR_MESSAGE_TYPE_CONTROL, nullptr);
168 return; 169 return;
169 } 170 }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 255 }
255 256
256 void BattOrConnectionImpl::OnBytesSent(int bytes_sent, 257 void BattOrConnectionImpl::OnBytesSent(int bytes_sent,
257 device::serial::SendError error) { 258 device::serial::SendError error) {
258 bool success = (error == device::serial::SendError::NONE) && 259 bool success = (error == device::serial::SendError::NONE) &&
259 (pending_write_length_ == static_cast<size_t>(bytes_sent)); 260 (pending_write_length_ == static_cast<size_t>(bytes_sent));
260 listener_->OnBytesSent(success); 261 listener_->OnBytesSent(success);
261 } 262 }
262 263
263 } // namespace battor 264 } // namespace battor
OLDNEW
« 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