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

Side by Side Diff: device/serial/data_sink_receiver.cc

Issue 562563002: Make some fields non-nullable in serial.mojom and data_stream.mojom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | device/serial/data_source_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/serial/data_sink_receiver.h" 5 #include "device/serial/data_sink_receiver.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "device/serial/async_waiter.h" 10 #include "device/serial/async_waiter.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void DataSinkReceiver::ShutDown() { 82 void DataSinkReceiver::ShutDown() {
83 shut_down_ = true; 83 shut_down_ = true;
84 if (waiter_) 84 if (waiter_)
85 waiter_.reset(); 85 waiter_.reset();
86 } 86 }
87 87
88 DataSinkReceiver::~DataSinkReceiver() { 88 DataSinkReceiver::~DataSinkReceiver() {
89 } 89 }
90 90
91 void DataSinkReceiver::Init(mojo::ScopedDataPipeConsumerHandle handle) { 91 void DataSinkReceiver::Init(mojo::ScopedDataPipeConsumerHandle handle) {
92 if (!handle.is_valid() || handle_.is_valid()) { 92 if (handle_.is_valid()) {
93 DispatchFatalError(); 93 DispatchFatalError();
94 return; 94 return;
95 } 95 }
96 96
97 handle_ = handle.Pass(); 97 handle_ = handle.Pass();
98 StartWaiting(); 98 StartWaiting();
99 } 99 }
100 100
101 void DataSinkReceiver::Cancel(int32_t error) { 101 void DataSinkReceiver::Cancel(int32_t error) {
102 // If we have sent a ReportBytesSentAndError but have not received the 102 // If we have sent a ReportBytesSentAndError but have not received the
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 MojoResult result = 297 MojoResult result =
298 mojo::ReadDataRaw(handle, NULL, &num_bytes, MOJO_READ_DATA_FLAG_DISCARD); 298 mojo::ReadDataRaw(handle, NULL, &num_bytes, MOJO_READ_DATA_FLAG_DISCARD);
299 if (result != MOJO_RESULT_OK) 299 if (result != MOJO_RESULT_OK)
300 return result; 300 return result;
301 DCHECK(num_bytes <= bytes_to_flush_); 301 DCHECK(num_bytes <= bytes_to_flush_);
302 bytes_to_flush_ -= num_bytes; 302 bytes_to_flush_ -= num_bytes;
303 return bytes_to_flush_ == 0 ? MOJO_RESULT_OK : MOJO_RESULT_SHOULD_WAIT; 303 return bytes_to_flush_ == 0 ? MOJO_RESULT_OK : MOJO_RESULT_SHOULD_WAIT;
304 } 304 }
305 305
306 } // namespace device 306 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/serial/data_source_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698