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 EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 6 #define EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // task upon construction and implicitly cancels the task upon | 122 // task upon construction and implicitly cancels the task upon |
123 // destruction if it hasn't run yet. | 123 // destruction if it hasn't run yet. |
124 class TimeoutTask { | 124 class TimeoutTask { |
125 public: | 125 public: |
126 TimeoutTask(const base::Closure& closure, const base::TimeDelta& delay); | 126 TimeoutTask(const base::Closure& closure, const base::TimeDelta& delay); |
127 ~TimeoutTask(); | 127 ~TimeoutTask(); |
128 | 128 |
129 private: | 129 private: |
130 void Run() const; | 130 void Run() const; |
131 | 131 |
132 base::WeakPtrFactory<TimeoutTask> weak_factory_; | |
133 base::Closure closure_; | 132 base::Closure closure_; |
134 base::TimeDelta delay_; | 133 base::TimeDelta delay_; |
| 134 base::WeakPtrFactory<TimeoutTask> weak_factory_; |
135 }; | 135 }; |
136 | 136 |
137 // Handles a receive timeout. | 137 // Handles a receive timeout. |
138 void OnReceiveTimeout(); | 138 void OnReceiveTimeout(); |
139 | 139 |
140 // Handles a send timeout. | 140 // Handles a send timeout. |
141 void OnSendTimeout(); | 141 void OnSendTimeout(); |
142 | 142 |
143 // Receives read completion notification from the |io_handler_|. | 143 // Receives read completion notification from the |io_handler_|. |
144 void OnAsyncReadComplete(int bytes_read, device::serial::ReceiveError error); | 144 void OnAsyncReadComplete(int bytes_read, device::serial::ReceiveError error); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 template <> | 205 template <> |
206 struct TypeConverter<device::serial::ConnectionOptionsPtr, | 206 struct TypeConverter<device::serial::ConnectionOptionsPtr, |
207 extensions::core_api::serial::ConnectionOptions> { | 207 extensions::core_api::serial::ConnectionOptions> { |
208 static device::serial::ConnectionOptionsPtr Convert( | 208 static device::serial::ConnectionOptionsPtr Convert( |
209 const extensions::core_api::serial::ConnectionOptions& input); | 209 const extensions::core_api::serial::ConnectionOptions& input); |
210 }; | 210 }; |
211 | 211 |
212 } // namespace mojo | 212 } // namespace mojo |
213 | 213 |
214 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ | 214 #endif // EXTENSIONS_BROWSER_API_SERIAL_SERIAL_CONNECTION_H_ |
OLD | NEW |