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

Unified Diff: chromeos/process_proxy/process_output_watcher.cc

Issue 2384293002: Use FileDescriptorWatcher in ProcessOutputWatcher (Closed)
Patch Set: fix build error Created 4 years, 2 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 | « chromeos/process_proxy/process_output_watcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/process_proxy/process_output_watcher.cc
diff --git a/chromeos/process_proxy/process_output_watcher.cc b/chromeos/process_proxy/process_output_watcher.cc
index a88f5f5893bd94ee247ccc13ebbd0d75d292b111..b9eee0d0a0922a329fb87ef3c22b744960bc4e7c 100644
--- a/chromeos/process_proxy/process_output_watcher.cc
+++ b/chromeos/process_proxy/process_output_watcher.cc
@@ -67,21 +67,16 @@ void ProcessOutputWatcher::Start() {
WatchProcessOutput();
}
-void ProcessOutputWatcher::OnFileCanReadWithoutBlocking(int fd) {
- DCHECK_EQ(process_output_file_.GetPlatformFile(), fd);
-
- output_file_watcher_.StopWatchingFileDescriptor();
- ReadFromFd(fd);
-}
-
-void ProcessOutputWatcher::OnFileCanWriteWithoutBlocking(int fd) {
- NOTREACHED();
+void ProcessOutputWatcher::OnProcessOutputCanReadWithoutBlocking() {
+ output_file_watcher_.reset();
+ ReadFromFd(process_output_file_.GetPlatformFile());
}
void ProcessOutputWatcher::WatchProcessOutput() {
- base::MessageLoopForIO::current()->WatchFileDescriptor(
- process_output_file_.GetPlatformFile(), false,
- base::MessageLoopForIO::WATCH_READ, &output_file_watcher_, this);
+ output_file_watcher_ = base::FileDescriptorWatcher::WatchReadable(
+ process_output_file_.GetPlatformFile(),
+ base::Bind(&ProcessOutputWatcher::OnProcessOutputCanReadWithoutBlocking,
+ base::Unretained(this)));
}
void ProcessOutputWatcher::ReadFromFd(int fd) {
« no previous file with comments | « chromeos/process_proxy/process_output_watcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698