Bug 1639837 - make CloseFileRunnable use mozilla::Runnable; r=jld

Differential Revision: https://phabricator.services.mozilla.com/D76300
This commit is contained in:
Nathan Froyd 2020-05-22 22:36:59 +00:00
Родитель c686b5d561
Коммит 5e67b31c1f
2 изменённых файлов: 7 добавлений и 17 удалений

Просмотреть файл

@ -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<nsIEventTarget> eventTarget =

Просмотреть файл

@ -9,7 +9,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/ipc/FileDescriptor.h"
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include <stdio.h>
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();