Index: device/serial/serial_io_handler_win.h |
diff --git a/device/serial/serial_io_handler_win.h b/device/serial/serial_io_handler_win.h |
index 7f438b53ae4a83f74252bfe6013407d625da4a76..831eab614048b10a780c56a29ac659336c59f027 100644 |
--- a/device/serial/serial_io_handler_win.h |
+++ b/device/serial/serial_io_handler_win.h |
@@ -32,6 +32,7 @@ class SerialIoHandlerWin : public SerialIoHandler, |
bool PostOpen() override; |
private: |
+ class UiThreadHelper; |
friend class SerialIoHandler; |
explicit SerialIoHandlerWin( |
@@ -44,6 +45,8 @@ class SerialIoHandlerWin : public SerialIoHandler, |
DWORD bytes_transfered, |
DWORD error) override; |
+ void OnDeviceRemoved(const std::string& device_path); |
+ |
// Context used for asynchronous WaitCommEvent calls. |
scoped_ptr<base::MessageLoopForIO::IOContext> comm_context_; |
@@ -61,6 +64,11 @@ class SerialIoHandlerWin : public SerialIoHandler, |
// after a corresponding WaitCommEvent has completed. |
bool is_comm_pending_; |
+ // The helper lives on the UI thread and holds a weak reference back to the |
+ // handler that owns it. |
+ UiThreadHelper* helper_ = nullptr; |
+ base::WeakPtrFactory<SerialIoHandlerWin> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin); |
}; |