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

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

Issue 423373002: Convert SerialIoHandler to use buffer interfaces for I/O API methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@js-serial
Patch Set: rebase Created 6 years, 4 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/BUILD.gn ('k') | device/serial/buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef DEVICE_SERIAL_BUFFER_H_
6 #define DEVICE_SERIAL_BUFFER_H_
7
8 #include "base/basictypes.h"
9
10 namespace device {
11
12 // A fixed-size read-only buffer. The data-reader should call Done() when it is
13 // finished reading bytes from the buffer. Alternatively, the reader can report
14 // an error by calling DoneWithError() with the number of bytes read and the
15 // error it wishes to report.
16 class ReadOnlyBuffer {
raymes 2014/08/01 02:25:43 Maybe just "ReadBuffer" and "WriteBuffer" (since I
Sam McNally 2014/08/01 06:30:31 Using ReadBuffer and WriteBuffer gets a bit confus
17 public:
18 virtual ~ReadOnlyBuffer();
19 virtual const char* GetData() = 0;
20 virtual uint32_t GetSize() = 0;
21 virtual void Done(uint32_t bytes_read) = 0;
22 virtual void DoneWithError(uint32_t bytes_read, int32_t error) = 0;
23 };
24
25 // A fixed-size writable buffer. The data-writer should call Done() when it is
26 // finished writing bytes to the buffer. Alternatively, the writer can report
27 // an error by calling DoneWithError() with the number of bytes written and the
28 // error it wishes to report.
29 class WritableBuffer {
30 public:
31 virtual ~WritableBuffer();
32 virtual char* GetData() = 0;
33 virtual uint32_t GetSize() = 0;
34 virtual void Done(uint32_t bytes_written) = 0;
35 virtual void DoneWithError(uint32_t bytes_written, int32_t error) = 0;
36 };
37
38 } // namespace device
39
40 #endif // DEVICE_SERIAL_BUFFER_H_
OLDNEW
« no previous file with comments | « device/serial/BUILD.gn ('k') | device/serial/buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698