mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1050174: Use |SocketIOReceiveRunnable| for Bluetooth sockets (under bluetooth2/), r=btian
This commit is contained in:
parent
8ee99a171e
commit
e7f495af17
@ -254,38 +254,6 @@ public:
|
||||
ShutdownSocketTask(DroidSocketImpl* aImpl) : mImpl(aImpl) { }
|
||||
};
|
||||
|
||||
class SocketReceiveTask : public SocketIORunnable<DroidSocketImpl>
|
||||
{
|
||||
public:
|
||||
SocketReceiveTask(DroidSocketImpl* aImpl, UnixSocketRawData* aData)
|
||||
: SocketIORunnable<DroidSocketImpl>(aImpl)
|
||||
, mRawData(aData)
|
||||
{
|
||||
MOZ_ASSERT(aData);
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
DroidSocketImpl* impl = GetIO();
|
||||
|
||||
if (impl->IsShutdownOnMainThread()) {
|
||||
NS_WARNING("mConsumer is null, aborting receive!");
|
||||
// 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;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(impl->mConsumer);
|
||||
impl->mConsumer->ReceiveSocketData(mRawData);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsAutoPtr<UnixSocketRawData> mRawData;
|
||||
};
|
||||
|
||||
class SocketSendTask : public Task
|
||||
{
|
||||
public:
|
||||
@ -503,9 +471,9 @@ DroidSocketImpl::OnSocketCanReceiveWithoutBlocking(int aFd)
|
||||
}
|
||||
|
||||
incoming->mSize = ret;
|
||||
nsRefPtr<SocketReceiveTask> t =
|
||||
new SocketReceiveTask(this, incoming.forget());
|
||||
NS_DispatchToMainThread(t);
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new SocketIOReceiveRunnable<DroidSocketImpl>(this, incoming.forget());
|
||||
NS_DispatchToMainThread(r);
|
||||
|
||||
// If ret is less than MAX_READ_SIZE, there's no
|
||||
// more data in the socket for us to read now.
|
||||
|
Loading…
Reference in New Issue
Block a user