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

Side by Side Diff: device/serial/data_source_sender.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 | « device/serial/data_sink_receiver.cc ('k') | device/serial/data_stream.mojom » ('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_source_sender.h" 5 #include "device/serial/data_source_sender.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ready_callback_.Reset(); 83 ready_callback_.Reset();
84 error_callback_.Reset(); 84 error_callback_.Reset();
85 } 85 }
86 86
87 DataSourceSender::~DataSourceSender() { 87 DataSourceSender::~DataSourceSender() {
88 DCHECK(shut_down_); 88 DCHECK(shut_down_);
89 } 89 }
90 90
91 void DataSourceSender::Init(mojo::ScopedDataPipeProducerHandle handle) { 91 void DataSourceSender::Init(mojo::ScopedDataPipeProducerHandle handle) {
92 // This should never occur. |handle_| is only valid and |pending_send_| is 92 // This should never occur. |handle_| is only valid and |pending_send_| is
93 // only set after Init is called. Receiving an invalid |handle| from the 93 // only set after Init is called.
94 // client is also unrecoverable. 94 if (pending_send_ || handle_.is_valid() || shut_down_) {
95 if (pending_send_ || handle_.is_valid() || !handle.is_valid() || shut_down_) {
96 DispatchFatalError(); 95 DispatchFatalError();
97 return; 96 return;
98 } 97 }
99 handle_ = handle.Pass(); 98 handle_ = handle.Pass();
100 pending_send_.reset(new PendingSend(this, ready_callback_)); 99 pending_send_.reset(new PendingSend(this, ready_callback_));
101 StartWaiting(); 100 StartWaiting();
102 } 101 }
103 102
104 void DataSourceSender::Resume() { 103 void DataSourceSender::Resume() {
105 if (pending_send_ || !handle_.is_valid()) { 104 if (pending_send_ || !handle_.is_valid()) {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 int32_t error) { 239 int32_t error) {
241 DCHECK(sender_.get()); 240 DCHECK(sender_.get());
242 pending_send_->DoneWithError(bytes_written, error); 241 pending_send_->DoneWithError(bytes_written, error);
243 sender_ = NULL; 242 sender_ = NULL;
244 pending_send_ = NULL; 243 pending_send_ = NULL;
245 buffer_ = NULL; 244 buffer_ = NULL;
246 buffer_size_ = 0; 245 buffer_size_ = 0;
247 } 246 }
248 247
249 } // namespace device 248 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/data_sink_receiver.cc ('k') | device/serial/data_stream.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698