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

Unified Diff: device/serial/serial_io_handler.cc

Issue 2914173002: Removing file_thread_task_runner parameter from SerialIoHandler (Closed)
Patch Set: Removing file_thread_task_runner parameter from SerialIoHandler Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/serial/serial_io_handler.h ('k') | device/serial/serial_io_handler_posix.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/serial/serial_io_handler.cc
diff --git a/device/serial/serial_io_handler.cc b/device/serial/serial_io_handler.cc
index b73d532d09ebb797263095e4f264799ceb74cb99..1c614364d6794c7791bfef646c6c9b6f29c4aacf 100644
--- a/device/serial/serial_io_handler.cc
+++ b/device/serial/serial_io_handler.cc
@@ -21,10 +21,8 @@
namespace device {
SerialIoHandler::SerialIoHandler(
- scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner)
- : file_thread_task_runner_(file_thread_task_runner),
- ui_thread_task_runner_(ui_thread_task_runner) {
+ : ui_thread_task_runner_(ui_thread_task_runner) {
options_.bitrate = 9600;
options_.data_bits = serial::DataBits::EIGHT;
options_.parity_bit = serial::ParityBit::NO_PARITY;
@@ -35,7 +33,6 @@ SerialIoHandler::SerialIoHandler(
SerialIoHandler::~SerialIoHandler() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- Close();
}
void SerialIoHandler::Open(const std::string& port,
@@ -44,7 +41,6 @@ void SerialIoHandler::Open(const std::string& port,
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(open_complete_.is_null());
open_complete_ = callback;
- DCHECK(file_thread_task_runner_.get());
DCHECK(ui_thread_task_runner_.get());
MergeConnectionOptions(options);
port_ = port;
@@ -62,10 +58,6 @@ void SerialIoHandler::Open(const std::string& port,
&chromeos::PermissionBrokerClient::OpenPath, base::Unretained(client),
port, base::Bind(&SerialIoHandler::OnPathOpened, this, task_runner),
base::Bind(&SerialIoHandler::OnPathOpenError, this, task_runner)));
-#else
- file_thread_task_runner_->PostTask(
- FROM_HERE, base::Bind(&SerialIoHandler::StartOpen, this, port,
- base::ThreadTaskRunnerHandle::Get()));
Reilly Grant (use Gerrit) 2017/06/01 13:48:21 file_thread_task_runner_ is clearly used here so t
sujith 2017/06/01 14:57:31 Done.
#endif // defined(OS_CHROMEOS)
}
@@ -126,7 +118,6 @@ void SerialIoHandler::StartOpen(
const std::string& port,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) {
DCHECK(!open_complete_.is_null());
- DCHECK(file_thread_task_runner_->RunsTasksInCurrentSequence());
DCHECK(!file_.IsValid());
// It's the responsibility of the API wrapper around SerialIoHandler to
// validate the supplied path against the set of valid port names, and
@@ -158,8 +149,6 @@ void SerialIoHandler::FinishOpen(base::File file) {
file_ = std::move(file);
bool success = PostOpen() && ConfigurePortImpl();
- if (!success)
- Close();
callback.Run(success);
}
@@ -168,15 +157,6 @@ bool SerialIoHandler::PostOpen() {
return true;
}
-void SerialIoHandler::Close() {
- if (file_.IsValid()) {
- DCHECK(file_thread_task_runner_.get());
- file_thread_task_runner_->PostTask(
Reilly Grant (use Gerrit) 2017/06/01 13:48:21 Same here. We can't just remove the Close method.
sujith 2017/06/01 14:57:31 Done.
- FROM_HERE,
- base::Bind(&SerialIoHandler::DoClose, Passed(std::move(file_))));
- }
-}
-
// static
void SerialIoHandler::DoClose(base::File port) {
// port closed by destructor.
« no previous file with comments | « device/serial/serial_io_handler.h ('k') | device/serial/serial_io_handler_posix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698