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..6c160addefe2d607423b7728837d8ece10c9df1a 100644 |
--- a/device/serial/serial_io_handler_win.h |
+++ b/device/serial/serial_io_handler_win.h |
@@ -15,6 +15,9 @@ namespace device { |
class SerialIoHandlerWin : public SerialIoHandler, |
public base::MessageLoopForIO::IOHandler { |
+ public: |
+ class UiThreadHelper; |
Reilly Grant (use Gerrit)
2015/11/11 20:43:59
This class should be private.
juncai
2015/11/12 05:27:08
Done.
|
+ |
protected: |
// SerialIoHandler implementation. |
void ReadImpl() override; |
@@ -44,6 +47,8 @@ class SerialIoHandlerWin : public SerialIoHandler, |
DWORD bytes_transfered, |
DWORD error) override; |
+ void RemoveDevice(const std::string& device_path); |
Reilly Grant (use Gerrit)
2015/11/11 20:43:59
s/RemoveDevice/OnDeviceRemoved/
juncai
2015/11/12 05:27:08
Done.
|
+ |
// Context used for asynchronous WaitCommEvent calls. |
scoped_ptr<base::MessageLoopForIO::IOContext> comm_context_; |
@@ -61,6 +66,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_; |
+ base::WeakPtrFactory<SerialIoHandlerWin> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin); |
}; |