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

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

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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/nfc/nfc.mojom ('k') | device/serial/serial_connection.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 "base/numerics/safe_conversions.h" 5 #include "base/numerics/safe_conversions.h"
6 #include "device/serial/buffer.h" 6 #include "device/serial/buffer.h"
7 #include "net/base/io_buffer.h" 7 #include "net/base/io_buffer.h"
8 8
9 namespace device { 9 namespace device {
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 const char* SendBuffer::GetData() { 24 const char* SendBuffer::GetData() {
25 return data_.data(); 25 return data_.data();
26 } 26 }
27 27
28 uint32_t SendBuffer::GetSize() { 28 uint32_t SendBuffer::GetSize() {
29 return base::checked_cast<uint32_t>(data_.size()); 29 return base::checked_cast<uint32_t>(data_.size());
30 } 30 }
31 31
32 void SendBuffer::Done(uint32_t bytes_read) { 32 void SendBuffer::Done(uint32_t bytes_read) {
33 callback_.Run(bytes_read, device::serial::SEND_ERROR_NONE); 33 callback_.Run(bytes_read, device::serial::SendError::NONE);
34 } 34 }
35 35
36 void SendBuffer::DoneWithError(uint32_t bytes_read, int32_t error) { 36 void SendBuffer::DoneWithError(uint32_t bytes_read, int32_t error) {
37 callback_.Run(bytes_read, static_cast<device::serial::SendError>(error)); 37 callback_.Run(bytes_read, static_cast<device::serial::SendError>(error));
38 } 38 }
39 39
40 ReceiveBuffer::ReceiveBuffer( 40 ReceiveBuffer::ReceiveBuffer(
41 scoped_refptr<net::IOBuffer> buffer, 41 scoped_refptr<net::IOBuffer> buffer,
42 uint32_t size, 42 uint32_t size,
43 const base::Callback<void(int, device::serial::ReceiveError)>& callback) 43 const base::Callback<void(int, device::serial::ReceiveError)>& callback)
44 : buffer_(buffer), size_(size), callback_(callback) {} 44 : buffer_(buffer), size_(size), callback_(callback) {}
45 45
46 ReceiveBuffer::~ReceiveBuffer() {} 46 ReceiveBuffer::~ReceiveBuffer() {}
47 47
48 char* ReceiveBuffer::GetData() { 48 char* ReceiveBuffer::GetData() {
49 return buffer_->data(); 49 return buffer_->data();
50 } 50 }
51 51
52 uint32_t ReceiveBuffer::GetSize() { 52 uint32_t ReceiveBuffer::GetSize() {
53 return size_; 53 return size_;
54 } 54 }
55 55
56 void ReceiveBuffer::Done(uint32_t bytes_written) { 56 void ReceiveBuffer::Done(uint32_t bytes_written) {
57 callback_.Run(bytes_written, device::serial::RECEIVE_ERROR_NONE); 57 callback_.Run(bytes_written, device::serial::ReceiveError::NONE);
58 } 58 }
59 59
60 void ReceiveBuffer::DoneWithError(uint32_t bytes_written, int32_t error) { 60 void ReceiveBuffer::DoneWithError(uint32_t bytes_written, int32_t error) {
61 callback_.Run(bytes_written, 61 callback_.Run(bytes_written,
62 static_cast<device::serial::ReceiveError>(error)); 62 static_cast<device::serial::ReceiveError>(error));
63 } 63 }
64 64
65 } // namespace device 65 } // namespace device
OLDNEW
« no previous file with comments | « device/nfc/nfc.mojom ('k') | device/serial/serial_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698