From 5e67b31c1f87318ea1ba1dbb0130640434c66a9c Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 22 May 2020 22:36:59 +0000 Subject: [PATCH] Bug 1639837 - make CloseFileRunnable use mozilla::Runnable; r=jld Differential Revision: https://phabricator.services.mozilla.com/D76300 --- ipc/glue/FileDescriptorUtils.cpp | 10 +++------- ipc/glue/FileDescriptorUtils.h | 14 ++++---------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/ipc/glue/FileDescriptorUtils.cpp b/ipc/glue/FileDescriptorUtils.cpp index 104787a02530..680d0ccd4044 100644 --- a/ipc/glue/FileDescriptorUtils.cpp +++ b/ipc/glue/FileDescriptorUtils.cpp @@ -12,7 +12,6 @@ #include "nsDebug.h" #include "nsNetCID.h" #include "nsServiceManagerUtils.h" -#include "nsThreadUtils.h" #include "prio.h" #include "private/pprio.h" @@ -25,15 +24,12 @@ using mozilla::ipc::CloseFileRunnable; -#ifdef DEBUG - CloseFileRunnable::CloseFileRunnable(const FileDescriptor& aFileDescriptor) - : mFileDescriptor(aFileDescriptor) { + : Runnable("CloseFileRunnable"), + mFileDescriptor(aFileDescriptor) { MOZ_ASSERT(aFileDescriptor.IsValid()); } -#endif // DEBUG - CloseFileRunnable::~CloseFileRunnable() { if (mFileDescriptor.IsValid()) { // It's probably safer to take the main thread IO hit here rather than leak @@ -42,7 +38,7 @@ CloseFileRunnable::~CloseFileRunnable() { } } -NS_IMPL_ISUPPORTS(CloseFileRunnable, nsIRunnable) +NS_IMPL_ISUPPORTS_INHERITED0(CloseFileRunnable, Runnable) void CloseFileRunnable::Dispatch() { nsCOMPtr eventTarget = diff --git a/ipc/glue/FileDescriptorUtils.h b/ipc/glue/FileDescriptorUtils.h index 0c5db5c6f4d4..e8aab0639ee7 100644 --- a/ipc/glue/FileDescriptorUtils.h +++ b/ipc/glue/FileDescriptorUtils.h @@ -9,7 +9,7 @@ #include "mozilla/Attributes.h" #include "mozilla/ipc/FileDescriptor.h" -#include "nsIRunnable.h" +#include "nsThreadUtils.h" #include namespace mozilla { @@ -18,21 +18,15 @@ namespace ipc { // When Dispatch() is called (from main thread) this class arranges to close the // provided FileDescriptor on one of the socket transport service threads (to // avoid main thread I/O). -class CloseFileRunnable final : public nsIRunnable { +class CloseFileRunnable final : public Runnable { typedef mozilla::ipc::FileDescriptor FileDescriptor; FileDescriptor mFileDescriptor; public: - explicit CloseFileRunnable(const FileDescriptor& aFileDescriptor) -#ifdef DEBUG - ; -#else - : mFileDescriptor(aFileDescriptor) { - } -#endif + explicit CloseFileRunnable(const FileDescriptor& aFileDescriptor); - NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIRUNNABLE void Dispatch();