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

Unified Diff: device/hid/hid_connection_win.cc

Issue 2802093009: Remove MessageLoop destruction observer from hid_connection_win.cc (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_connection_win.cc
diff --git a/device/hid/hid_connection_win.cc b/device/hid/hid_connection_win.cc
index a98007ae0958fa0d859566d99e7b2ad5e9c1e5d3..fb65d846675762f935ea911b31605f299251a2d6 100644
--- a/device/hid/hid_connection_win.cc
+++ b/device/hid/hid_connection_win.cc
@@ -11,7 +11,6 @@
#include "base/files/file.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/message_loop/message_loop.h"
#include "base/numerics/safe_conversions.h"
#include "base/win/object_watcher.h"
#include "components/device_event_log/device_event_log.h"
@@ -30,8 +29,7 @@ extern "C" {
namespace device {
-class PendingHidTransfer : public base::win::ObjectWatcher::Delegate,
- public base::MessageLoop::DestructionObserver {
+class PendingHidTransfer : public base::win::ObjectWatcher::Delegate {
public:
typedef base::OnceCallback<void(PendingHidTransfer*, bool)> Callback;
@@ -45,9 +43,6 @@ class PendingHidTransfer : public base::win::ObjectWatcher::Delegate,
// Implements base::win::ObjectWatcher::Delegate.
void OnObjectSignaled(HANDLE object) override;
- // Implements base::MessageLoop::DestructionObserver
- void WillDestroyCurrentMessageLoop() override;
-
private:
// The buffer isn't used by this object but it's important that a reference
// to it is held until the transfer completes.
@@ -70,7 +65,6 @@ PendingHidTransfer::PendingHidTransfer(scoped_refptr<net::IOBuffer> buffer,
}
PendingHidTransfer::~PendingHidTransfer() {
- base::MessageLoop::current()->RemoveDestructionObserver(this);
if (callback_)
std::move(callback_).Run(this, false);
}
@@ -79,7 +73,6 @@ void PendingHidTransfer::TakeResultFromWindowsAPI(BOOL result) {
if (result) {
std::move(callback_).Run(this, true);
} else if (GetLastError() == ERROR_IO_PENDING) {
- base::MessageLoop::current()->AddDestructionObserver(this);
watcher_.StartWatchingOnce(event_.Get(), this);
} else {
HID_PLOG(EVENT) << "HID transfer failed";
@@ -91,14 +84,9 @@ void PendingHidTransfer::OnObjectSignaled(HANDLE event_handle) {
std::move(callback_).Run(this, true);
}
-void PendingHidTransfer::WillDestroyCurrentMessageLoop() {
- watcher_.StopWatching();
- std::move(callback_).Run(this, false);
-}
-
HidConnectionWin::HidConnectionWin(scoped_refptr<HidDeviceInfo> device_info,
base::win::ScopedHandle file)
- : HidConnection(device_info), file_(std::move(file)) {}
+ : HidConnection(std::move(device_info)), file_(std::move(file)) {}
HidConnectionWin::~HidConnectionWin() {
DCHECK(!file_.IsValid());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698