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

Unified Diff: chromeos/process_proxy/process_output_watcher.h

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 | « no previous file | chromeos/process_proxy/process_output_watcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/process_proxy/process_output_watcher.h
diff --git a/chromeos/process_proxy/process_output_watcher.h b/chromeos/process_proxy/process_output_watcher.h
index 168c586a82dc0ce7e86ca02557bf1c1ee9a9ffc0..3b7f489aa2ebf1bbc5793416caf811a93bd59898 100644
--- a/chromeos/process_proxy/process_output_watcher.h
+++ b/chromeos/process_proxy/process_output_watcher.h
@@ -7,13 +7,14 @@
#include <stddef.h>
+#include <memory>
#include <string>
#include "base/callback.h"
#include "base/files/file.h"
+#include "base/files/file_descriptor_watcher_posix.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
#include "chromeos/chromeos_export.h"
namespace chromeos {
@@ -29,18 +30,16 @@ typedef base::Callback<void(ProcessOutputType,
// Observes output on |out_fd| and invokes |callback| when some output is
// detected. It assumes UTF8 output.
-class CHROMEOS_EXPORT ProcessOutputWatcher
- : public base::MessageLoopForIO::Watcher {
+class CHROMEOS_EXPORT ProcessOutputWatcher {
public:
ProcessOutputWatcher(int out_fd, const ProcessOutputCallback& callback);
- ~ProcessOutputWatcher() override;
+ ~ProcessOutputWatcher();
void Start();
private:
- // MessageLoopForIO::Watcher overrides:
- void OnFileCanReadWithoutBlocking(int fd) override;
- void OnFileCanWriteWithoutBlocking(int fd) override;
+ // Called when |process_output_file_| is readable without blocking.
+ void OnProcessOutputCanReadWithoutBlocking();
// Listens to output from fd passed to the constructor.
void WatchProcessOutput();
@@ -66,7 +65,7 @@ class CHROMEOS_EXPORT ProcessOutputWatcher
// Contains file descsriptor to which watched process output is written.
base::File process_output_file_;
- base::MessageLoopForIO::FileDescriptorWatcher output_file_watcher_;
+ std::unique_ptr<base::FileDescriptorWatcher::Controller> output_file_watcher_;
// Callback that will be invoked when some output is detected.
ProcessOutputCallback on_read_callback_;
« no previous file with comments | « no previous file | chromeos/process_proxy/process_output_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698