| Index: chrome/browser/extensions/api/messaging/native_message_process_host.cc
|
| diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host.cc b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
|
| index 5921943b51692f941ab781796da37a7110ca8235..7d4304e31ee08ebf2dc8f1d67a29ea805f3bc506 100644
|
| --- a/chrome/browser/extensions/api/messaging/native_message_process_host.cc
|
| +++ b/chrome/browser/extensions/api/messaging/native_message_process_host.cc
|
| @@ -199,17 +199,6 @@ NativeMessageProcessHost::task_runner() const {
|
| return task_runner_;
|
| }
|
|
|
| -#if defined(OS_POSIX)
|
| -void NativeMessageProcessHost::OnFileCanReadWithoutBlocking(int fd) {
|
| - DCHECK_EQ(fd, read_file_);
|
| - DoRead();
|
| -}
|
| -
|
| -void NativeMessageProcessHost::OnFileCanWriteWithoutBlocking(int fd) {
|
| - NOTREACHED();
|
| -}
|
| -#endif // !defined(OS_POSIX)
|
| -
|
| void NativeMessageProcessHost::ReadNowForTesting() {
|
| DoRead();
|
| }
|
| @@ -225,9 +214,9 @@ void NativeMessageProcessHost::WaitRead() {
|
| // would always be consuming one thread in the thread pool. On Windows
|
| // FileStream uses overlapped IO, so that optimization isn't necessary there.
|
| #if defined(OS_POSIX)
|
| - base::MessageLoopForIO::current()->WatchFileDescriptor(
|
| - read_file_, false /* persistent */,
|
| - base::MessageLoopForIO::WATCH_READ, &read_watcher_, this);
|
| + read_controller_ = base::FileDescriptorWatcher::WatchReadable(
|
| + read_file_,
|
| + base::Bind(&NativeMessageProcessHost::DoRead, base::Unretained(this)));
|
| #else // defined(OS_POSIX)
|
| DoRead();
|
| #endif // defined(!OS_POSIX)
|
| @@ -236,6 +225,10 @@ void NativeMessageProcessHost::WaitRead() {
|
| void NativeMessageProcessHost::DoRead() {
|
| DCHECK(task_runner_->BelongsToCurrentThread());
|
|
|
| +#if defined(OS_POSIX)
|
| + read_controller_.reset();
|
| +#endif
|
| +
|
| while (!closed_ && !read_pending_) {
|
| read_buffer_ = new net::IOBuffer(kReadBufferSize);
|
| int result =
|
|
|