Bug 1046109: Add |SocketIOBase|, r=kyle
|SocketIOBase| is a base class for Socket I/O classes. It's not a requirement, but provides a number of helpful methods for common I/O operations on the I/O thread.
This commit is contained in:
@@ -122,5 +122,34 @@ SocketConsumerBase::SetConnectionStatus(
|
||||
mConnectionStatus = aConnectionStatus;
|
||||
}
|
||||
|
||||
//
|
||||
// SocketIOBase
|
||||
//
|
||||
|
||||
SocketIOBase::~SocketIOBase()
|
||||
{ }
|
||||
|
||||
void
|
||||
SocketIOBase::EnqueueData(UnixSocketRawData* aData)
|
||||
{
|
||||
if (!aData->mSize) {
|
||||
delete aData; // delete empty data immediately
|
||||
return;
|
||||
}
|
||||
mOutgoingQ.AppendElement(aData);
|
||||
}
|
||||
|
||||
bool
|
||||
SocketIOBase::HasPendingData() const
|
||||
{
|
||||
return !mOutgoingQ.IsEmpty();
|
||||
}
|
||||
|
||||
SocketIOBase::SocketIOBase(size_t aMaxReadSize)
|
||||
: mMaxReadSize(aMaxReadSize)
|
||||
{
|
||||
MOZ_ASSERT(mMaxReadSize);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user