summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorsammc <sammc@chromium.org>2014-09-10 17:52:33 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-11 00:54:12 +0000
commitda421fab9270e9fd48875f14e3ae9a001c6f0d77 (patch)
tree9a1dae677a164cefadfbfc23cf278b9fe32bdf59 /device
parentafd3e88bf107971191bc5f45d24f7ba3b8106854 (diff)
downloadchromium_src-da421fab9270e9fd48875f14e3ae9a001c6f0d77.zip
chromium_src-da421fab9270e9fd48875f14e3ae9a001c6f0d77.tar.gz
chromium_src-da421fab9270e9fd48875f14e3ae9a001c6f0d77.tar.bz2
Make some fields non-nullable in serial.mojom and data_stream.mojom.
This also removes some null checks for the now non-nullable fields. BUG=407683 Review URL: https://codereview.chromium.org/562563002 Cr-Commit-Position: refs/heads/master@{#294277}
Diffstat (limited to 'device')
-rw-r--r--device/serial/data_sink_receiver.cc2
-rw-r--r--device/serial/data_source_sender.cc5
-rw-r--r--device/serial/data_stream.mojom4
-rw-r--r--device/serial/serial.mojom16
4 files changed, 13 insertions, 14 deletions
diff --git a/device/serial/data_sink_receiver.cc b/device/serial/data_sink_receiver.cc
index 7e3834e..cadc9e3 100644
--- a/device/serial/data_sink_receiver.cc
+++ b/device/serial/data_sink_receiver.cc
@@ -89,7 +89,7 @@ DataSinkReceiver::~DataSinkReceiver() {
}
void DataSinkReceiver::Init(mojo::ScopedDataPipeConsumerHandle handle) {
- if (!handle.is_valid() || handle_.is_valid()) {
+ if (handle_.is_valid()) {
DispatchFatalError();
return;
}
diff --git a/device/serial/data_source_sender.cc b/device/serial/data_source_sender.cc
index c240303..e67a81e 100644
--- a/device/serial/data_source_sender.cc
+++ b/device/serial/data_source_sender.cc
@@ -90,9 +90,8 @@ DataSourceSender::~DataSourceSender() {
void DataSourceSender::Init(mojo::ScopedDataPipeProducerHandle handle) {
// This should never occur. |handle_| is only valid and |pending_send_| is
- // only set after Init is called. Receiving an invalid |handle| from the
- // client is also unrecoverable.
- if (pending_send_ || handle_.is_valid() || !handle.is_valid() || shut_down_) {
+ // only set after Init is called.
+ if (pending_send_ || handle_.is_valid() || shut_down_) {
DispatchFatalError();
return;
}
diff --git a/device/serial/data_stream.mojom b/device/serial/data_stream.mojom
index ae64c4e..689b381 100644
--- a/device/serial/data_stream.mojom
+++ b/device/serial/data_stream.mojom
@@ -8,7 +8,7 @@ module device.serial {
interface DataSource {
// Initializes this DataSource with a data pipe handle to use for data
// transmission.
- Init(handle<data_pipe_producer>? producer_handle);
+ Init(handle<data_pipe_producer> producer_handle);
// Resumes sending data after it has been stopped due to an error.
Resume();
@@ -25,7 +25,7 @@ interface DataSourceClient {
interface DataSink {
// Initializes this DataSink with a data pipe handle to use for data
// transmission.
- Init(handle<data_pipe_consumer>? consumer_handle);
+ Init(handle<data_pipe_consumer> consumer_handle);
// Requests the cancellation of any data that has been written to the pipe,
// but has not yet been sent to the sink.
diff --git a/device/serial/serial.mojom b/device/serial/serial.mojom
index 92e6a9e..89f0bcd 100644
--- a/device/serial/serial.mojom
+++ b/device/serial/serial.mojom
@@ -7,7 +7,7 @@ import "data_stream.mojom"
module device.serial {
struct DeviceInfo {
- string? path;
+ string path;
uint16 vendor_id;
bool has_vendor_id = false;
uint16 product_id;
@@ -82,7 +82,7 @@ struct DeviceControlSignals {
};
interface SerialService {
- GetDevices() => (DeviceInfo?[]? devices);
+ GetDevices() => (DeviceInfo[] devices);
// Creates a |Connection| to |path| with options specified by |options|,
// returning it via |connection|. Sending and receiving data over this
@@ -90,17 +90,17 @@ interface SerialService {
// and |connection| will not be usable if |path| does not specify a valid
// serial device or there is an error connecting to or configuring the
// connection.
- Connect(string? path,
+ Connect(string path,
ConnectionOptions? options,
- Connection&? connection,
- DataSink&? sink,
- DataSource&? source);
+ Connection& connection,
+ DataSink& sink,
+ DataSource& source);
};
interface Connection {
GetInfo() => (ConnectionInfo? info);
- SetOptions(ConnectionOptions? options) => (bool success);
- SetControlSignals(HostControlSignals? signals) => (bool success);
+ SetOptions(ConnectionOptions options) => (bool success);
+ SetControlSignals(HostControlSignals signals) => (bool success);
GetControlSignals() => (DeviceControlSignals? signals);
Flush() => (bool success);
};