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

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

Issue 1991403002: [battor agent] Fix the init sequence so it retries inits instead of resets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial draft 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 "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/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 FROM_HERE, 164 FROM_HERE,
165 base::Bind(&Listener::OnMessageRead, base::Unretained(listener_), true, 165 base::Bind(&Listener::OnMessageRead, base::Unretained(listener_), true,
166 parsed_type, base::Passed(std::move(bytes)))); 166 parsed_type, base::Passed(std::move(bytes))));
167 return; 167 return;
168 } 168 }
169 169
170 LogSerial("No complete message found."); 170 LogSerial("No complete message found.");
171 BeginReadBytes(max_bytes_to_read - already_read_buffer_.size()); 171 BeginReadBytes(max_bytes_to_read - already_read_buffer_.size());
172 } 172 }
173 173
174 void BattOrConnectionImpl::CancelReadMessage() {
175 io_handler_->CancelRead(device::serial::ReceiveError::NONE);
charliea (OOO until 10-5) 2016/05/23 14:08:52 Think it might be more accurate to cancel it w/ Re
aschulman 2016/06/10 07:22:59 Done.
176 }
177
174 void BattOrConnectionImpl::Flush() { 178 void BattOrConnectionImpl::Flush() {
175 io_handler_->Flush(); 179 io_handler_->Flush();
176 already_read_buffer_.clear(); 180 already_read_buffer_.clear();
177 } 181 }
178 182
179 scoped_refptr<device::SerialIoHandler> BattOrConnectionImpl::CreateIoHandler() { 183 scoped_refptr<device::SerialIoHandler> BattOrConnectionImpl::CreateIoHandler() {
180 return device::SerialIoHandler::Create(file_thread_task_runner_, 184 return device::SerialIoHandler::Create(file_thread_task_runner_,
181 ui_thread_task_runner_); 185 ui_thread_task_runner_);
182 } 186 }
183 187
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 base::ThreadTaskRunnerHandle::Get()->PostTask( 317 base::ThreadTaskRunnerHandle::Get()->PostTask(
314 FROM_HERE, 318 FROM_HERE,
315 base::Bind(&Listener::OnBytesSent, base::Unretained(listener_), success)); 319 base::Bind(&Listener::OnBytesSent, base::Unretained(listener_), success));
316 } 320 }
317 321
318 void BattOrConnectionImpl::LogSerial(const std::string& str) { 322 void BattOrConnectionImpl::LogSerial(const std::string& str) {
319 serial_log_ << str << std::endl << std::endl; 323 serial_log_ << str << std::endl << std::endl;
320 } 324 }
321 325
322 } // namespace battor 326 } // namespace battor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698