mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1159209: Remove template parameters from |SocketIODeleteInstanceRunnable|, r=kmachulis
This patch removes the template parameters from |SocketIODeleteInstanceRunnable| and moves its methods into the C++ source file. All users have been adapted.
This commit is contained in:
parent
f1e1ede770
commit
bc3ec66d73
@ -20,7 +20,7 @@ namespace ipc {
|
|||||||
//
|
//
|
||||||
|
|
||||||
class ListenSocketIO final : public UnixSocketWatcher
|
class ListenSocketIO final : public UnixSocketWatcher
|
||||||
, protected SocketIOBase
|
, public SocketIOBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class ListenTask;
|
class ListenTask;
|
||||||
|
@ -345,5 +345,22 @@ SocketIORequestClosingRunnable::Run()
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SocketIODeleteInstanceRunnable
|
||||||
|
//
|
||||||
|
|
||||||
|
SocketIODeleteInstanceRunnable::SocketIODeleteInstanceRunnable(
|
||||||
|
SocketIOBase* aIO)
|
||||||
|
: mIO(aIO)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
NS_METHOD
|
||||||
|
SocketIODeleteInstanceRunnable::Run()
|
||||||
|
{
|
||||||
|
mIO = nullptr; // delete instance
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,25 +407,18 @@ public:
|
|||||||
NS_IMETHOD Run() override;
|
NS_IMETHOD Run() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* |SocketIODeleteInstanceRunnable| deletes an object on the main thread.
|
/**
|
||||||
|
* |SocketIODeleteInstanceRunnable| deletes an object on the main thread.
|
||||||
*/
|
*/
|
||||||
template<class T>
|
|
||||||
class SocketIODeleteInstanceRunnable final : public nsRunnable
|
class SocketIODeleteInstanceRunnable final : public nsRunnable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SocketIODeleteInstanceRunnable(T* aInstance)
|
SocketIODeleteInstanceRunnable(SocketIOBase* aIO);
|
||||||
: mInstance(aInstance)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
NS_IMETHOD Run() override
|
NS_IMETHOD Run() override;
|
||||||
{
|
|
||||||
mInstance = nullptr; // delete instance
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsAutoPtr<T> mInstance;
|
nsAutoPtr<SocketIOBase> mIO;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -492,9 +485,7 @@ public:
|
|||||||
// |io| safely knowing that it's not reference any longer.
|
// |io| safely knowing that it's not reference any longer.
|
||||||
io->ShutdownOnIOThread();
|
io->ShutdownOnIOThread();
|
||||||
|
|
||||||
nsRefPtr<nsRunnable> r = new SocketIODeleteInstanceRunnable<Tio>(io);
|
NS_DispatchToMainThread(new SocketIODeleteInstanceRunnable(io));
|
||||||
nsresult rv = NS_DispatchToMainThread(r);
|
|
||||||
NS_ENSURE_SUCCESS_VOID(rv);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user