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

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

Issue 2914173002: Removing file_thread_task_runner parameter from SerialIoHandler (Closed)
Patch Set: removed unused variable Created 3 years, 6 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
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 "device/serial/serial_io_handler_posix.h" 5 #include "device/serial/serial_io_handler_posix.h"
6 6
7 #include <sys/ioctl.h> 7 #include <sys/ioctl.h>
8 #include <termios.h> 8 #include <termios.h>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #undef SPEED_TO_BITRATE_CASE 106 #undef SPEED_TO_BITRATE_CASE
107 } 107 }
108 #endif 108 #endif
109 109
110 } // namespace 110 } // namespace
111 111
112 namespace device { 112 namespace device {
113 113
114 // static 114 // static
115 scoped_refptr<SerialIoHandler> SerialIoHandler::Create( 115 scoped_refptr<SerialIoHandler> SerialIoHandler::Create(
116 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
117 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) { 116 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) {
118 return new SerialIoHandlerPosix(file_thread_task_runner, 117 return new SerialIoHandlerPosix(ui_thread_task_runner);
119 ui_thread_task_runner);
120 } 118 }
121 119
122 void SerialIoHandlerPosix::ReadImpl() { 120 void SerialIoHandlerPosix::ReadImpl() {
123 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); 121 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
124 DCHECK(pending_read_buffer()); 122 DCHECK(pending_read_buffer());
125 DCHECK(file().IsValid()); 123 DCHECK(file().IsValid());
126 124
127 // Try to read immediately. This is needed because on some platforms 125 // Try to read immediately. This is needed because on some platforms
128 // (e.g., OSX) there may not be a notification from the message loop 126 // (e.g., OSX) there may not be a notification from the message loop
129 // when the fd is ready to read immediately after it is opened. There 127 // when the fd is ready to read immediately after it is opened. There
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 bool SerialIoHandlerPosix::PostOpen() { 283 bool SerialIoHandlerPosix::PostOpen() {
286 #if defined(OS_CHROMEOS) 284 #if defined(OS_CHROMEOS)
287 // The Chrome OS permission broker does not open devices in async mode. 285 // The Chrome OS permission broker does not open devices in async mode.
288 return base::SetNonBlocking(file().GetPlatformFile()); 286 return base::SetNonBlocking(file().GetPlatformFile());
289 #else 287 #else
290 return true; 288 return true;
291 #endif 289 #endif
292 } 290 }
293 291
294 SerialIoHandlerPosix::SerialIoHandlerPosix( 292 SerialIoHandlerPosix::SerialIoHandlerPosix(
295 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
296 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner) 293 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner)
297 : SerialIoHandler(file_thread_task_runner, ui_thread_task_runner) {} 294 : SerialIoHandler(ui_thread_task_runner) {}
298 295
299 SerialIoHandlerPosix::~SerialIoHandlerPosix() { 296 SerialIoHandlerPosix::~SerialIoHandlerPosix() {
300 } 297 }
301 298
302 void SerialIoHandlerPosix::AttemptRead(bool within_read) { 299 void SerialIoHandlerPosix::AttemptRead(bool within_read) {
303 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); 300 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
304 301
305 if (pending_read_buffer()) { 302 if (pending_read_buffer()) {
306 int bytes_read = HANDLE_EINTR(read(file().GetPlatformFile(), 303 int bytes_read = HANDLE_EINTR(read(file().GetPlatformFile(),
307 pending_read_buffer(), 304 pending_read_buffer(),
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 memcpy(buffer, chars_stashed_, std::min(new_bytes_read, 2)); 628 memcpy(buffer, chars_stashed_, std::min(new_bytes_read, 2));
632 memcpy(chars_stashed_, tmp, num_chars_stashed_); 629 memcpy(chars_stashed_, tmp, num_chars_stashed_);
633 return new_bytes_read; 630 return new_bytes_read;
634 } 631 }
635 632
636 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) { 633 std::string SerialIoHandler::MaybeFixUpPortName(const std::string& port_name) {
637 return port_name; 634 return port_name;
638 } 635 }
639 636
640 } // namespace device 637 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_io_handler_posix.h ('k') | device/serial/serial_io_handler_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698