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

Unified Diff: chromeos/process_proxy/process_proxy.h

Issue 1258193002: User MessageLoopForIO::WatchFileDescriptor in proces_output_watcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 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_unittest.cc ('k') | chromeos/process_proxy/process_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/process_proxy/process_proxy.h
diff --git a/chromeos/process_proxy/process_proxy.h b/chromeos/process_proxy/process_proxy.h
index 65f3d341e12e6ea124109130457a7cec4f11500a..d49ba803aa112363428005abe3b767f6ca4c57dd 100644
--- a/chromeos/process_proxy/process_proxy.h
+++ b/chromeos/process_proxy/process_proxy.h
@@ -15,11 +15,15 @@
#include "chromeos/process_proxy/process_output_watcher.h"
namespace base {
+class SingleThreadTaskRunner;
class TaskRunner;
-class Thread;
} // namespace base
namespace chromeos {
+class ProcessOutputWatcher;
+} // namespace chromeos
+
+namespace chromeos {
// Proxy to a single ChromeOS process.
// This is refcounted. Note that output watcher, when it gets triggered owns a
@@ -32,11 +36,9 @@ class ProcessProxy : public base::RefCountedThreadSafe<ProcessProxy> {
// Opens a process using command |command|. |pid| is set to new process' pid.
bool Open(const std::string& command, pid_t* pid);
- // Triggers watcher object on |watch_thread|. |watch_thread| gets blocked, so
- // it should not be one of commonly used threads. It should be thread created
- // specifically for running process output watcher.
- bool StartWatchingOnThread(base::Thread* watch_thread,
- const ProcessOutputCallback& callback);
+ bool StartWatchingOutput(
+ const scoped_refptr<base::SingleThreadTaskRunner>& watcher_runner,
+ const ProcessOutputCallback& callback);
// Sends some data to the process.
bool Write(const std::string& text);
@@ -67,15 +69,12 @@ class ProcessProxy : public base::RefCountedThreadSafe<ProcessProxy> {
void CallOnProcessOutputCallback(ProcessOutputType type,
const std::string& output);
- bool StopWatching();
+ void StopWatching();
- // Methods for cleaning up pipes.
- void CloseAllFdPairs();
// Expects array of 2 file descripters.
void CloseFdPair(int* pipe);
// Expects pointer to single file descriptor.
void CloseFd(int* fd);
- void ClearAllFdPairs();
// Expects array of 2 file descripters.
void ClearFdPair(int* pipe);
@@ -85,11 +84,11 @@ class ProcessProxy : public base::RefCountedThreadSafe<ProcessProxy> {
bool callback_set_;
ProcessOutputCallback callback_;
scoped_refptr<base::TaskRunner> callback_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> watcher_runner_;
- bool watcher_started_;
+ scoped_ptr<ProcessOutputWatcher> output_watcher_;
int pt_pair_[2];
- int shutdown_pipe_[2];
DISALLOW_COPY_AND_ASSIGN(ProcessProxy);
};
« no previous file with comments | « chromeos/process_proxy/process_output_watcher_unittest.cc ('k') | chromeos/process_proxy/process_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698