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

Unified Diff: chrome/browser/extensions/api/messaging/native_message_process_host.h

Issue 2384163003: Use FileDescriptorWatcher in NativeMessageProcessHost. (Closed)
Patch Set: fix test 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 | chrome/browser/extensions/api/messaging/native_message_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cefb070d42d945177de8550cd4f759db0fd4cd74..547878be3a51c859df18467fef7c6aed43e25ea4 100644
--- a/chrome/browser/extensions/api/messaging/native_message_process_host.h
+++ b/chrome/browser/extensions/api/messaging/native_message_process_host.h
@@ -11,13 +11,17 @@
#include "base/files/file.h"
#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
+#include "base/memory/weak_ptr.h"
#include "base/process/process.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
#include "extensions/browser/api/messaging/native_message_host.h"
#include "ui/gfx/native_widget_types.h"
+#if defined(OS_POSIX)
+#include "base/files/file_descriptor_watcher_posix.h"
+#endif
+
namespace net {
class DrainableIOBuffer;
@@ -35,11 +39,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)
- public NativeMessageHost {
+class NativeMessageProcessHost : public NativeMessageHost {
public:
~NativeMessageProcessHost() override;
@@ -54,12 +54,6 @@ class NativeMessageProcessHost :
void Start(Client* client) override;
scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override;
-#if defined(OS_POSIX)
- // MessageLoopForIO::Watcher interface
- void OnFileCanReadWithoutBlocking(int fd) override;
- 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();
@@ -117,7 +111,7 @@ class NativeMessageProcessHost :
#if defined(OS_POSIX)
base::PlatformFile read_file_;
- base::MessageLoopForIO::FileDescriptorWatcher read_watcher_;
+ std::unique_ptr<base::FileDescriptorWatcher::Controller> read_controller_;
#endif // !defined(OS_POSIX)
// Write stream.
« no previous file with comments | « no previous file | chrome/browser/extensions/api/messaging/native_message_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698