OLD | NEW |
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 #ifndef DEVICE_SERIAL_DATA_RECEIVER_H_ | 5 #ifndef DEVICE_SERIAL_DATA_RECEIVER_H_ |
6 #define DEVICE_SERIAL_DATA_RECEIVER_H_ | 6 #define DEVICE_SERIAL_DATA_RECEIVER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 private: | 41 private: |
42 class PendingReceive; | 42 class PendingReceive; |
43 struct PendingError; | 43 struct PendingError; |
44 friend class base::RefCounted<DataReceiver>; | 44 friend class base::RefCounted<DataReceiver>; |
45 | 45 |
46 virtual ~DataReceiver(); | 46 virtual ~DataReceiver(); |
47 | 47 |
48 // serial::DataSourceClient override. Invoked by the DataSource to report | 48 // serial::DataSourceClient override. Invoked by the DataSource to report |
49 // errors. | 49 // errors. |
50 virtual void OnError(uint32_t bytes_since_last_error, int32_t error) OVERRIDE; | 50 virtual void OnError(uint32_t bytes_since_last_error, int32_t error) override; |
51 | 51 |
52 // mojo::ErrorHandler override. Calls ShutDown(). | 52 // mojo::ErrorHandler override. Calls ShutDown(). |
53 virtual void OnConnectionError() OVERRIDE; | 53 virtual void OnConnectionError() override; |
54 | 54 |
55 // Invoked by the PendingReceive to report that the user is done with the | 55 // Invoked by the PendingReceive to report that the user is done with the |
56 // receive buffer, having read |bytes_read| bytes from it. | 56 // receive buffer, having read |bytes_read| bytes from it. |
57 void Done(uint32_t bytes_read); | 57 void Done(uint32_t bytes_read); |
58 | 58 |
59 // Invoked when |handle_| is ready to read. Unless an error has occurred, this | 59 // Invoked when |handle_| is ready to read. Unless an error has occurred, this |
60 // calls ReceiveInternal(). | 60 // calls ReceiveInternal(). |
61 void OnDoneWaiting(MojoResult result); | 61 void OnDoneWaiting(MojoResult result); |
62 | 62 |
63 // The implementation of Receive(). If a |pending_error_| is ready to | 63 // The implementation of Receive(). If a |pending_error_| is ready to |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 scoped_ptr<PendingError> pending_error_; | 103 scoped_ptr<PendingError> pending_error_; |
104 | 104 |
105 base::WeakPtrFactory<DataReceiver> weak_factory_; | 105 base::WeakPtrFactory<DataReceiver> weak_factory_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(DataReceiver); | 107 DISALLOW_COPY_AND_ASSIGN(DataReceiver); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace device | 110 } // namespace device |
111 | 111 |
112 #endif // DEVICE_SERIAL_DATA_RECEIVER_H_ | 112 #endif // DEVICE_SERIAL_DATA_RECEIVER_H_ |
OLD | NEW |