| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/hid/hid_connection_win.h" | 5 #include "device/hid/hid_connection_win.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 typedef base::Callback<void(PendingHidTransfer*, bool)> Callback; | 32 typedef base::Callback<void(PendingHidTransfer*, bool)> Callback; |
| 33 | 33 |
| 34 PendingHidTransfer(scoped_refptr<net::IOBuffer> buffer, | 34 PendingHidTransfer(scoped_refptr<net::IOBuffer> buffer, |
| 35 const Callback& callback); | 35 const Callback& callback); |
| 36 | 36 |
| 37 void TakeResultFromWindowsAPI(BOOL result); | 37 void TakeResultFromWindowsAPI(BOOL result); |
| 38 | 38 |
| 39 OVERLAPPED* GetOverlapped() { return &overlapped_; } | 39 OVERLAPPED* GetOverlapped() { return &overlapped_; } |
| 40 | 40 |
| 41 // Implements base::win::ObjectWatcher::Delegate. | 41 // Implements base::win::ObjectWatcher::Delegate. |
| 42 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 42 virtual void OnObjectSignaled(HANDLE object) override; |
| 43 | 43 |
| 44 // Implements base::MessageLoop::DestructionObserver | 44 // Implements base::MessageLoop::DestructionObserver |
| 45 virtual void WillDestroyCurrentMessageLoop() OVERRIDE; | 45 virtual void WillDestroyCurrentMessageLoop() override; |
| 46 | 46 |
| 47 // The buffer isn't used by this object but it's important that a reference | 47 // The buffer isn't used by this object but it's important that a reference |
| 48 // to it is held until the transfer completes. | 48 // to it is held until the transfer completes. |
| 49 scoped_refptr<net::IOBuffer> buffer_; | 49 scoped_refptr<net::IOBuffer> buffer_; |
| 50 Callback callback_; | 50 Callback callback_; |
| 51 OVERLAPPED overlapped_; | 51 OVERLAPPED overlapped_; |
| 52 base::win::ScopedHandle event_; | 52 base::win::ScopedHandle event_; |
| 53 base::win::ObjectWatcher watcher_; | 53 base::win::ObjectWatcher watcher_; |
| 54 | 54 |
| 55 private: | 55 private: |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (GetOverlappedResult( | 254 if (GetOverlappedResult( |
| 255 file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { | 255 file_.Get(), transfer->GetOverlapped(), &bytes_transferred, FALSE)) { |
| 256 callback.Run(true); | 256 callback.Run(true); |
| 257 } else { | 257 } else { |
| 258 VPLOG(1) << "HID write failed"; | 258 VPLOG(1) << "HID write failed"; |
| 259 callback.Run(false); | 259 callback.Run(false); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 } // namespace device | 263 } // namespace device |
| OLD | NEW |