mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset b20b097fde99 (bug 1046109)
This commit is contained in:
parent
cebdb18236
commit
a4bf4f800a
@ -486,36 +486,6 @@ private:
|
||||
UnixSocketRawData* mData;
|
||||
};
|
||||
|
||||
/* |SocketIOShutdownTask| signals shutdown to the Socket I/O object on
|
||||
* the I/O thread and sends it to the main thread for destruction.
|
||||
*/
|
||||
template <typename T>
|
||||
class SocketIOShutdownTask MOZ_FINAL : public SocketIOTask<T>
|
||||
{
|
||||
public:
|
||||
SocketIOShutdownTask(T* aIO)
|
||||
: SocketIOTask<T>(aIO)
|
||||
{ }
|
||||
|
||||
void Run() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
T* io = SocketIOTask<T>::GetIO();
|
||||
|
||||
// At this point, there should be no new events on the I/O thread
|
||||
// after this one with the possible exception of an accept task,
|
||||
// which ShutdownOnIOThread will cancel for us. We are now fully
|
||||
// shut down, so we can send a message to the main thread to delete
|
||||
// |io| safely knowing that it's not reference any longer.
|
||||
io->ShutdownOnIOThread();
|
||||
|
||||
nsRefPtr<nsRunnable> r = new SocketIODeleteInstanceRunnable<T>(io);
|
||||
nsresult rv = NS_DispatchToMainThread(r);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,34 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class ShutdownSocketTask : public SocketIOTask<UnixSocketImpl>
|
||||
{
|
||||
public:
|
||||
ShutdownSocketTask(UnixSocketImpl* aImpl)
|
||||
: SocketIOTask<UnixSocketImpl>(aImpl)
|
||||
{ }
|
||||
|
||||
void Run() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(!IsCanceled());
|
||||
|
||||
UnixSocketImpl* impl = GetIO();
|
||||
|
||||
// At this point, there should be no new events on the IO thread after this
|
||||
// one with the possible exception of a SocketListenTask that
|
||||
// ShutdownOnIOThread will cancel for us. We are now fully shut down, so we
|
||||
// can send a message to the main thread that will delete impl safely knowing
|
||||
// that no more tasks reference it.
|
||||
impl->ShutdownOnIOThread();
|
||||
|
||||
nsRefPtr<nsIRunnable> r =
|
||||
new SocketIODeleteInstanceRunnable<UnixSocketImpl>(impl);
|
||||
nsresult rv = NS_DispatchToMainThread(r);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
UnixSocketImpl::FireSocketError()
|
||||
{
|
||||
@ -523,8 +551,8 @@ UnixSocketConsumer::CloseSocket()
|
||||
// will create a new implementation.
|
||||
mImpl->ShutdownOnMainThread();
|
||||
|
||||
XRE_GetIOMessageLoop()->PostTask(
|
||||
FROM_HERE, new SocketIOShutdownTask<UnixSocketImpl>(mImpl));
|
||||
XRE_GetIOMessageLoop()->PostTask(FROM_HERE,
|
||||
new ShutdownSocketTask(mImpl));
|
||||
|
||||
mImpl = nullptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user