Bug 1091962 - AutoEventEnqueuer must keep alive ChannelEventQueue, r=smaug, r=jduell

This commit is contained in:
Andrea Marchesini 2014-12-04 13:23:33 -08:00
parent e113c26245
commit 3051ad31c3
2 changed files with 8 additions and 8 deletions

View File

@ -162,7 +162,7 @@ ChannelEventQueue::MaybeFlushQueue()
// Ensures that ShouldEnqueue() will be true during its lifetime (letting // Ensures that ShouldEnqueue() will be true during its lifetime (letting
// caller know incoming IPDL msgs should be queued). Flushes the queue when it // caller know incoming IPDL msgs should be queued). Flushes the queue when it
// goes out of scope. // goes out of scope.
class AutoEventEnqueuer class MOZ_STACK_CLASS AutoEventEnqueuer
{ {
public: public:
explicit AutoEventEnqueuer(ChannelEventQueue *queue) : mEventQueue(queue) { explicit AutoEventEnqueuer(ChannelEventQueue *queue) : mEventQueue(queue) {
@ -172,7 +172,7 @@ class AutoEventEnqueuer
mEventQueue->EndForcedQueueing(); mEventQueue->EndForcedQueueing();
} }
private: private:
ChannelEventQueue* mEventQueue; nsRefPtr<ChannelEventQueue> mEventQueue;
}; };
} }

View File

@ -205,7 +205,7 @@ WebSocketChannelChild::OnStart(const nsCString& aProtocol,
mEncrypted = aEncrypted; mEncrypted = aEncrypted;
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnStart(mContext); mListener->OnStart(mContext);
} }
} }
@ -247,7 +247,7 @@ WebSocketChannelChild::OnStop(const nsresult& aStatusCode)
{ {
LOG(("WebSocketChannelChild::RecvOnStop() %p\n", this)); LOG(("WebSocketChannelChild::RecvOnStop() %p\n", this));
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnStop(mContext, aStatusCode); mListener->OnStop(mContext, aStatusCode);
} }
} }
@ -296,7 +296,7 @@ WebSocketChannelChild::OnMessageAvailable(const nsCString& aMsg)
{ {
LOG(("WebSocketChannelChild::RecvOnMessageAvailable() %p\n", this)); LOG(("WebSocketChannelChild::RecvOnMessageAvailable() %p\n", this));
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnMessageAvailable(mContext, aMsg); mListener->OnMessageAvailable(mContext, aMsg);
} }
} }
@ -320,7 +320,7 @@ WebSocketChannelChild::OnBinaryMessageAvailable(const nsCString& aMsg)
{ {
LOG(("WebSocketChannelChild::RecvOnBinaryMessageAvailable() %p\n", this)); LOG(("WebSocketChannelChild::RecvOnBinaryMessageAvailable() %p\n", this));
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnBinaryMessageAvailable(mContext, aMsg); mListener->OnBinaryMessageAvailable(mContext, aMsg);
} }
} }
@ -362,7 +362,7 @@ WebSocketChannelChild::OnAcknowledge(const uint32_t& aSize)
{ {
LOG(("WebSocketChannelChild::RecvOnAcknowledge() %p\n", this)); LOG(("WebSocketChannelChild::RecvOnAcknowledge() %p\n", this));
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnAcknowledge(mContext, aSize); mListener->OnAcknowledge(mContext, aSize);
} }
} }
@ -410,7 +410,7 @@ WebSocketChannelChild::OnServerClose(const uint16_t& aCode,
{ {
LOG(("WebSocketChannelChild::RecvOnServerClose() %p\n", this)); LOG(("WebSocketChannelChild::RecvOnServerClose() %p\n", this));
if (mListener) { if (mListener) {
AutoEventEnqueuer ensureSerialDispatch(mEventQ);; AutoEventEnqueuer ensureSerialDispatch(mEventQ);
mListener->OnServerClose(mContext, aCode, aReason); mListener->OnServerClose(mContext, aCode, aReason);
} }
} }