| Index: remoting/host/clipboard_x11.cc
|
| diff --git a/remoting/host/clipboard_x11.cc b/remoting/host/clipboard_x11.cc
|
| index ec9b93ec0812d0ec158d12b8ad251935b787422c..cd03accc7be2aba13f7ee6da23f3fc4d97d05f8c 100644
|
| --- a/remoting/host/clipboard_x11.cc
|
| +++ b/remoting/host/clipboard_x11.cc
|
| @@ -10,9 +10,9 @@
|
| #undef Status // Xlib.h #defines this, which breaks protobuf headers.
|
|
|
| #include "base/bind.h"
|
| +#include "base/files/file_descriptor_watcher_posix.h"
|
| #include "base/logging.h"
|
| #include "base/macros.h"
|
| -#include "base/message_loop/message_loop.h"
|
| #include "remoting/host/linux/x_server_clipboard.h"
|
| #include "remoting/proto/event.pb.h"
|
| #include "remoting/protocol/clipboard_stub.h"
|
| @@ -20,8 +20,7 @@
|
| namespace remoting {
|
|
|
| // This code is expected to be called on the desktop thread only.
|
| -class ClipboardX11 : public Clipboard,
|
| - public base::MessageLoopForIO::Watcher {
|
| +class ClipboardX11 : public Clipboard {
|
| public:
|
| ClipboardX11();
|
| ~ClipboardX11() override;
|
| @@ -31,10 +30,6 @@ class ClipboardX11 : public Clipboard,
|
| std::unique_ptr<protocol::ClipboardStub> client_clipboard) override;
|
| void InjectClipboardEvent(const protocol::ClipboardEvent& event) override;
|
|
|
| - // MessageLoopForIO::Watcher interface.
|
| - void OnFileCanReadWithoutBlocking(int fd) override;
|
| - void OnFileCanWriteWithoutBlocking(int fd) override;
|
| -
|
| private:
|
| void OnClipboardChanged(const std::string& mime_type,
|
| const std::string& data);
|
| @@ -50,7 +45,8 @@ class ClipboardX11 : public Clipboard,
|
| Display* display_;
|
|
|
| // Watcher used to handle X11 events from |display_|.
|
| - base::MessageLoopForIO::FileDescriptorWatcher x_connection_watcher_;
|
| + std::unique_ptr<base::FileDescriptorWatcher::Controller>
|
| + x_connection_watch_controller_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ClipboardX11);
|
| };
|
| @@ -67,6 +63,7 @@ ClipboardX11::~ClipboardX11() {
|
| void ClipboardX11::Start(
|
| std::unique_ptr<protocol::ClipboardStub> client_clipboard) {
|
| // TODO(lambroslambrou): Share the X connection with InputInjector.
|
| + DCHECK(!display_);
|
| display_ = XOpenDisplay(nullptr);
|
| if (!display_) {
|
| LOG(ERROR) << "Couldn't open X display";
|
| @@ -78,12 +75,9 @@ void ClipboardX11::Start(
|
| base::Bind(&ClipboardX11::OnClipboardChanged,
|
| base::Unretained(this)));
|
|
|
| - base::MessageLoopForIO::current()->WatchFileDescriptor(
|
| + x_connection_watch_controller_ = base::FileDescriptorWatcher::WatchReadable(
|
| ConnectionNumber(display_),
|
| - true,
|
| - base::MessageLoopForIO::WATCH_READ,
|
| - &x_connection_watcher_,
|
| - this);
|
| + base::Bind(&ClipboardX11::PumpXEvents, base::Unretained(this)));
|
| PumpXEvents();
|
| }
|
|
|
| @@ -92,13 +86,6 @@ void ClipboardX11::InjectClipboardEvent(
|
| x_server_clipboard_.SetClipboard(event.mime_type(), event.data());
|
| }
|
|
|
| -void ClipboardX11::OnFileCanReadWithoutBlocking(int fd) {
|
| - PumpXEvents();
|
| -}
|
| -
|
| -void ClipboardX11::OnFileCanWriteWithoutBlocking(int fd) {
|
| -}
|
| -
|
| void ClipboardX11::OnClipboardChanged(const std::string& mime_type,
|
| const std::string& data) {
|
| protocol::ClipboardEvent event;
|
|
|