Backed out changeset 38c914d4c7a7 (bug 1046109)

This commit is contained in:
Carsten "Tomcat" Book
2014-07-31 10:14:30 +02:00
parent c71d72204d
commit 031ee108eb
2 changed files with 33 additions and 41 deletions

View File

@@ -201,6 +201,37 @@ private:
T* mInstance;
};
class SocketReceiveRunnable : public SocketIORunnable<UnixSocketImpl>
{
public:
SocketReceiveRunnable(UnixSocketImpl* aImpl, UnixSocketRawData* aData)
: SocketIORunnable<UnixSocketImpl>(aImpl)
, mRawData(aData)
{
MOZ_ASSERT(aData);
}
NS_IMETHOD Run() MOZ_OVERRIDE
{
MOZ_ASSERT(NS_IsMainThread());
UnixSocketImpl* 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 RequestClosingSocketRunnable : public SocketIORunnable<UnixSocketImpl>
{
public:
@@ -607,8 +638,8 @@ UnixSocketImpl::OnSocketCanReceiveWithoutBlocking()
#endif
incoming->mSize = ret;
nsRefPtr<nsRunnable> r =
new SocketIOReceiveRunnable<UnixSocketImpl>(this, incoming.forget());
nsRefPtr<SocketReceiveRunnable> r =
new SocketReceiveRunnable(this, incoming.forget());
NS_DispatchToMainThread(r);
// If ret is less than MAX_READ_SIZE, there's no