Index: chrome/browser/extensions/api/messaging/native_message_process_host.h |
diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.h b/chrome/browser/extensions/api/messaging/native_message_process_host.h |
index 482d3b067e5fb02ee1fc1a72fd7627b4f6fc4ba9..6158effa2ac65d5bb0a9ed95023ec67762d95b5e 100644 |
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.h |
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h |
@@ -34,11 +34,7 @@ namespace extensions { |
// This class must only be created, called, and deleted on the IO thread. |
// Public methods typically accept callbacks which will be invoked on the UI |
// thread. |
-class NativeMessageProcessHost |
-#if defined(OS_POSIX) |
- : public base::MessageLoopForIO::Watcher |
-#endif // !defined(OS_POSIX) |
-{ |
+class NativeMessageProcessHost { |
public: |
// Interface for the object that receives messages from the native process. |
class Client { |
@@ -83,15 +79,8 @@ class NativeMessageProcessHost |
// Send a message with the specified payload. |
void Send(const std::string& json); |
-#if defined(OS_POSIX) |
- // MessageLoopForIO::Watcher interface |
- virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
- virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
-#endif // !defined(OS_POSIX) |
- |
- // Try and read a single message from |read_file_|. This should only be called |
- // in unittests when you know there is data in the file. |
- void ReadNowForTesting(); |
+ // Use regular Read instead of ReadNonBlocking when reading from a file. |
+ void DontWaitToReadForTesting(); |
private: |
NativeMessageProcessHost(base::WeakPtr<Client> weak_client_ui, |
@@ -141,31 +130,30 @@ class NativeMessageProcessHost |
// Launcher used to launch the native process. |
scoped_ptr<NativeProcessLauncher> launcher_; |
- // Set to true after the native messaging connection has been stopped, e.g. |
- // due to an error. |
- bool closed_; |
- |
base::ProcessHandle process_handle_; |
// Input stream reader. |
scoped_ptr<net::FileStream> read_stream_; |
-#if defined(OS_POSIX) |
- // TODO(rvargas): Remove these members, maybe merging the functionality to |
- // net::FileStream. |
- base::PlatformFile read_file_; |
- base::MessageLoopForIO::FileDescriptorWatcher read_watcher_; |
-#endif // !defined(OS_POSIX) |
- |
// Write stream. |
scoped_ptr<net::FileStream> write_stream_; |
// Read buffer passed to FileStream::Read(). |
scoped_refptr<net::IOBuffer> read_buffer_; |
+ // Set to true after the native messaging connection has been stopped, e.g. |
+ // due to an error. |
+ bool closed_; |
+ |
// Set to true when a read is pending. |
bool read_pending_; |
+ // Set to true when a write is pending. |
+ bool write_pending_; |
+ |
+ // Set to true to use regular reads during a test. |
+ bool direct_read_for_test_; |
+ |
// Buffer for incomplete incoming messages. |
std::string incoming_data_; |
@@ -175,9 +163,6 @@ class NativeMessageProcessHost |
// The message that's currently being sent. |
scoped_refptr<net::DrainableIOBuffer> current_write_buffer_; |
- // Set to true when a write is pending. |
- bool write_pending_; |
- |
DISALLOW_COPY_AND_ASSIGN(NativeMessageProcessHost); |
}; |