summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorsammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 04:41:15 +0000
committersammc@chromium.org <sammc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 04:42:33 +0000
commit548e66d363ca99101ba3c5fb1201795ebdc4a6ac (patch)
tree6f765d5da285b6b40fa58ef00bc55a4f1a064b30 /device
parentf7f41c0ef72424608774cd2d445e86bcd16963f4 (diff)
downloadchromium_src-548e66d363ca99101ba3c5fb1201795ebdc4a6ac.zip
chromium_src-548e66d363ca99101ba3c5fb1201795ebdc4a6ac.tar.gz
chromium_src-548e66d363ca99101ba3c5fb1201795ebdc4a6ac.tar.bz2
Ignore double cancels of serial reads and writes.
Previously, two CancelRead calls on the same message loop tick would cause QueueReadCompleted to be called twice, triggering a second call to ReadCompleted with pending_read_buffer_ cleared. With this change, extra calls to CancelRead and CancelWrite have no effect. BUG=401252 Review URL: https://codereview.chromium.org/461533002 Cr-Commit-Position: refs/heads/master@{#288653} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device')
-rw-r--r--device/serial/serial_io_handler.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/device/serial/serial_io_handler.cc b/device/serial/serial_io_handler.cc
index 379dee3..eb55e41 100644
--- a/device/serial/serial_io_handler.cc
+++ b/device/serial/serial_io_handler.cc
@@ -148,7 +148,7 @@ bool SerialIoHandler::IsWritePending() const {
void SerialIoHandler::CancelRead(serial::ReceiveError reason) {
DCHECK(CalledOnValidThread());
- if (IsReadPending()) {
+ if (IsReadPending() && !read_canceled_) {
read_canceled_ = true;
read_cancel_reason_ = reason;
CancelReadImpl();
@@ -157,7 +157,7 @@ void SerialIoHandler::CancelRead(serial::ReceiveError reason) {
void SerialIoHandler::CancelWrite(serial::SendError reason) {
DCHECK(CalledOnValidThread());
- if (IsWritePending()) {
+ if (IsWritePending() && !write_canceled_) {
write_canceled_ = true;
write_cancel_reason_ = reason;
CancelWriteImpl();