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

Unified Diff: ipc/mojo/async_handle_waiter.cc

Issue 1074963003: Clean up potentially leaky use of base::DeletePointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed another probleb Created 5 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 | « device/usb/usb_service.h ('k') | media/audio/virtual_audio_input_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/mojo/async_handle_waiter.cc
diff --git a/ipc/mojo/async_handle_waiter.cc b/ipc/mojo/async_handle_waiter.cc
index b9e68d7c4539886059b8428617eb43121eb19b4d..64a5251955d265664e6fba8ed346df2d55920a84 100644
--- a/ipc/mojo/async_handle_waiter.cc
+++ b/ipc/mojo/async_handle_waiter.cc
@@ -17,6 +17,7 @@ namespace internal {
class AsyncHandleWaiterContextTraits {
public:
static void Destruct(const AsyncHandleWaiter::Context* context);
+ static void Delete(const AsyncHandleWaiter::Context* context);
};
// The thread-safe part of |AsyncHandleWaiter|.
@@ -51,8 +52,9 @@ class AsyncHandleWaiter::Context
}
private:
- friend void base::DeletePointer<const Context>(const Context* self);
friend class AsyncHandleWaiterContextTraits;
+ friend class base::internal::OwnedWrapper<
+ const IPC::internal::AsyncHandleWaiter::Context>;
friend class base::RefCountedThreadSafe<Context>;
~Context() override {
@@ -157,8 +159,14 @@ void AsyncHandleWaiterContextTraits::Destruct(
const AsyncHandleWaiter::Context* context) {
context->io_runner_->PostTask(
FROM_HERE,
- base::Bind(&base::DeletePointer<const AsyncHandleWaiter::Context>,
- base::Unretained(context)));
+ base::Bind(&AsyncHandleWaiterContextTraits::Delete,
+ base::Owned(context)));
+}
+
+// static
+void AsyncHandleWaiterContextTraits::Delete(
+ const AsyncHandleWaiter::Context* context) {
+ // base::Owned() is going to do it for us.
}
} // namespace internal
« no previous file with comments | « device/usb/usb_service.h ('k') | media/audio/virtual_audio_input_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698