mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 795507bd02d3 (bug 1046109)
This commit is contained in:
parent
ff000e441e
commit
713f24ed6c
@ -246,35 +246,7 @@ private:
|
||||
nsAutoPtr<UnixSocketRawData> mData;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class SocketIORequestClosingRunnable MOZ_FINAL : public SocketIORunnable<T>
|
||||
{
|
||||
public:
|
||||
SocketIORequestClosingRunnable(T* aImpl)
|
||||
: SocketIORunnable<T>(aImpl)
|
||||
{ }
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
T* io = SocketIORunnable<T>::GetIO();
|
||||
|
||||
if (io->IsShutdownOnMainThread()) {
|
||||
NS_WARNING("CloseSocket has already been called!");
|
||||
// Since we've already explicitly closed and the close happened before
|
||||
// this, this isn't really an error. Since we've warned, return OK.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
SocketConsumerBase* consumer = io->GetConsumer();
|
||||
MOZ_ASSERT(consumer);
|
||||
|
||||
consumer->CloseSocket();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +201,32 @@ private:
|
||||
T* mInstance;
|
||||
};
|
||||
|
||||
class RequestClosingSocketRunnable : public SocketIORunnable<UnixSocketImpl>
|
||||
{
|
||||
public:
|
||||
RequestClosingSocketRunnable(UnixSocketImpl* aImpl)
|
||||
: SocketIORunnable<UnixSocketImpl>(aImpl)
|
||||
{ }
|
||||
|
||||
NS_IMETHOD Run() MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
UnixSocketImpl* impl = GetIO();
|
||||
if (impl->IsShutdownOnMainThread()) {
|
||||
NS_WARNING("CloseSocket has already been called!");
|
||||
// Since we've already explicitly closed and the close happened before
|
||||
// this, this isn't really an error. Since we've warned, return OK.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Start from here, same handling flow as calling CloseSocket() from
|
||||
// upper layer
|
||||
impl->mConsumer->CloseSocket();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
class UnixSocketImplTask : public CancelableTask
|
||||
{
|
||||
public:
|
||||
@ -568,8 +594,8 @@ UnixSocketImpl::OnSocketCanReceiveWithoutBlocking()
|
||||
// We're done with our descriptors. Ensure that spurious events don't
|
||||
// cause us to end up back here.
|
||||
RemoveWatchers(READ_WATCHER|WRITE_WATCHER);
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIORequestClosingRunnable<UnixSocketImpl>(this);
|
||||
nsRefPtr<RequestClosingSocketRunnable> r =
|
||||
new RequestClosingSocketRunnable(this);
|
||||
NS_DispatchToMainThread(r);
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user