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

Unified Diff: services/native_support/process_io_redirection.h

Issue 1321253010: Add a "native_support" service. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix android? Created 5 years, 3 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 | « services/native_support/process_impl_unittest.cc ('k') | services/native_support/process_io_redirection.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/native_support/process_io_redirection.h
diff --git a/services/native_support/process_io_redirection.h b/services/native_support/process_io_redirection.h
new file mode 100644
index 0000000000000000000000000000000000000000..00e3461dd70cf9659062b01f93d852cd0eb213a9
--- /dev/null
+++ b/services/native_support/process_io_redirection.h
@@ -0,0 +1,74 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_NATIVE_SUPPORT_PROCESS_IO_REDIRECTION_H_
+#define SERVICES_NATIVE_SUPPORT_PROCESS_IO_REDIRECTION_H_
+
+#include <memory>
+
+#include "base/files/scoped_file.h"
+#include "base/macros.h"
+#include "mojo/services/files/public/interfaces/file.mojom.h"
+#include "services/native_support/redirectors.h"
+
+namespace native_support {
+
+class ProcessIORedirection {
+ public:
+ virtual ~ProcessIORedirection() {}
+
+ protected:
+ ProcessIORedirection() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ProcessIORedirection);
+};
+
+class ProcessIORedirectionForStdIO : public ProcessIORedirection {
+ public:
+ ProcessIORedirectionForStdIO(mojo::files::FilePtr stdin_file,
+ mojo::files::FilePtr stdout_file,
+ mojo::files::FilePtr stderr_file,
+ base::ScopedFD stdin_fd,
+ base::ScopedFD stdout_fd,
+ base::ScopedFD stderr_fd);
+ ~ProcessIORedirectionForStdIO() override;
+
+ private:
+ mojo::files::FilePtr stdin_file_;
+ mojo::files::FilePtr stdout_file_;
+ mojo::files::FilePtr stderr_file_;
+ base::ScopedFD stdin_fd_;
+ base::ScopedFD stdout_fd_;
+ base::ScopedFD stderr_fd_;
+
+ // The above things must outlive these.
+ std::unique_ptr<MojoFileToFDRedirector> stdin_redirector_;
+ std::unique_ptr<FDToMojoFileRedirector> stdout_redirector_;
+ std::unique_ptr<FDToMojoFileRedirector> stderr_redirector_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessIORedirectionForStdIO);
+};
+
+class ProcessIORedirectionForTerminal : public ProcessIORedirection {
+ public:
+ ProcessIORedirectionForTerminal(mojo::files::FilePtr terminal_file,
+ base::ScopedFD terminal_fd);
+ ~ProcessIORedirectionForTerminal() override;
+
+ private:
+ mojo::files::FilePtr terminal_file_;
+ base::ScopedFD terminal_fd_;
+
+ // The above things must outlive these.
+ // TODO(vtl): We should have a bidirectional redirector instead.
+ MojoFileToFDRedirector input_redirector_;
+ FDToMojoFileRedirector output_redirector_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessIORedirectionForTerminal);
+};
+
+} // namespace native_support
+
+#endif // SERVICES_NATIVE_SUPPORT_PROCESS_IO_REDIRECTION_H_
« no previous file with comments | « services/native_support/process_impl_unittest.cc ('k') | services/native_support/process_io_redirection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698