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

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

Issue 2826913002: [BattOr] Retry battor_agent commands when they fail. (Closed)
Patch Set: Doubled retry attempts (each StopTracing attempt requires two retries) Created 3 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 "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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 if (!serial_log_path.empty()) { 73 if (!serial_log_path.empty()) {
74 serial_log_.open(serial_log_path.c_str(), 74 serial_log_.open(serial_log_path.c_str(),
75 std::fstream::out | std::fstream::trunc); 75 std::fstream::out | std::fstream::trunc);
76 } 76 }
77 } 77 }
78 78
79 BattOrConnectionImpl::~BattOrConnectionImpl() {} 79 BattOrConnectionImpl::~BattOrConnectionImpl() {}
80 80
81 void BattOrConnectionImpl::Open() { 81 void BattOrConnectionImpl::Open() {
82 if (io_handler_) { 82 if (io_handler_) {
83 // Opening new connection so flush serial data from old connection.
84 Flush();
rnephew (Reviews Here) 2017/05/09 15:04:06 Are the flushes not needed elsewhere because we mo
aschulman 2017/05/11 13:13:00 Correct. Before we had to flush manually between r
83 OnOpened(true); 85 OnOpened(true);
84 return; 86 return;
85 } 87 }
86 88
87 io_handler_ = CreateIoHandler(); 89 io_handler_ = CreateIoHandler();
88 90
89 device::serial::ConnectionOptions options; 91 device::serial::ConnectionOptions options;
90 options.bitrate = kBattOrBitrate; 92 options.bitrate = kBattOrBitrate;
91 options.data_bits = kBattOrDataBits; 93 options.data_bits = kBattOrDataBits;
92 options.parity_bit = kBattOrParityBit; 94 options.parity_bit = kBattOrParityBit;
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 base::ThreadTaskRunnerHandle::Get()->PostTask( 354 base::ThreadTaskRunnerHandle::Get()->PostTask(
353 FROM_HERE, 355 FROM_HERE,
354 base::Bind(&Listener::OnBytesSent, base::Unretained(listener_), success)); 356 base::Bind(&Listener::OnBytesSent, base::Unretained(listener_), success));
355 } 357 }
356 358
357 void BattOrConnectionImpl::LogSerial(const std::string& str) { 359 void BattOrConnectionImpl::LogSerial(const std::string& str) {
358 serial_log_ << str << std::endl << std::endl; 360 serial_log_ << str << std::endl << std::endl;
359 } 361 }
360 362
361 } // namespace battor 363 } // namespace battor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698