mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 992206: Use |SocketIORequestClosingRunnable| for Bluetooth sockets, r=shuang
This commit is contained in:
parent
16d792817c
commit
9388876f6f
@ -203,33 +203,6 @@ private:
|
||||
T* mInstance;
|
||||
};
|
||||
|
||||
class RequestClosingSocketTask : public SocketIORunnable<DroidSocketImpl>
|
||||
{
|
||||
public:
|
||||
RequestClosingSocketTask(DroidSocketImpl* aImpl)
|
||||
: SocketIORunnable<DroidSocketImpl>(aImpl)
|
||||
{ }
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
DroidSocketImpl* 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->CloseDroidSocket();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
class ShutdownSocketTask : public Task {
|
||||
virtual void Run()
|
||||
{
|
||||
@ -465,8 +438,9 @@ DroidSocketImpl::OnSocketCanReceiveWithoutBlocking(int aFd)
|
||||
// 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<RequestClosingSocketTask> t = new RequestClosingSocketTask(this);
|
||||
NS_DispatchToMainThread(t);
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIORequestClosingRunnable<DroidSocketImpl>(this);
|
||||
NS_DispatchToMainThread(r);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user