mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 559200 - Follow up to remove unsafe locking r=dougt
--HG-- extra : rebase_source : 97dc0338081b4347a5ff0ef91861d4337967a224
This commit is contained in:
parent
d504f2a9fd
commit
12daa07c69
@ -49,8 +49,6 @@
|
|||||||
#include "nsMimeTypes.h"
|
#include "nsMimeTypes.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
|
|
||||||
using mozilla::MutexAutoLock;
|
|
||||||
|
|
||||||
class Callback
|
class Callback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -68,7 +66,6 @@ HttpChannelChild::HttpChannelChild()
|
|||||||
, mState(HCC_NEW)
|
, mState(HCC_NEW)
|
||||||
, mIPCOpen(false)
|
, mIPCOpen(false)
|
||||||
, mShouldBuffer(true)
|
, mShouldBuffer(true)
|
||||||
, mBufferLock("mozilla.net.HttpChannelChild.mBufferLock")
|
|
||||||
{
|
{
|
||||||
LOG(("Creating HttpChannelChild @%x\n", this));
|
LOG(("Creating HttpChannelChild @%x\n", this));
|
||||||
}
|
}
|
||||||
@ -156,7 +153,6 @@ HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead,
|
|||||||
if (mResponseHead)
|
if (mResponseHead)
|
||||||
SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
|
SetCookie(mResponseHead->PeekHeader(nsHttp::Set_Cookie));
|
||||||
|
|
||||||
MutexAutoLock lock(mBufferLock);
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
nsCOMPtr<nsIHttpChannel> kungFuDeathGrip(this);
|
nsCOMPtr<nsIHttpChannel> kungFuDeathGrip(this);
|
||||||
for (PRUint32 i = 0; i < mBufferedCallbacks.Length(); i++) {
|
for (PRUint32 i = 0; i < mBufferedCallbacks.Length(); i++) {
|
||||||
@ -389,14 +385,8 @@ bool
|
|||||||
HttpChannelChild::BufferOrDispatch(Callback* callback)
|
HttpChannelChild::BufferOrDispatch(Callback* callback)
|
||||||
{
|
{
|
||||||
if (mShouldBuffer) {
|
if (mShouldBuffer) {
|
||||||
MutexAutoLock lock(mBufferLock);
|
|
||||||
// If we can't grab the lock immediately, that means we're currently
|
|
||||||
// emptying the buffer. Therefore, the following condition should now
|
|
||||||
// be false, and we can resume immediate message processing.
|
|
||||||
if (mShouldBuffer) {
|
|
||||||
mBufferedCallbacks.AppendElement(callback);
|
mBufferedCallbacks.AppendElement(callback);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool result = callback->Run();
|
bool result = callback->Run();
|
||||||
|
@ -152,7 +152,6 @@ private:
|
|||||||
// received until OnStartRequest completes.
|
// received until OnStartRequest completes.
|
||||||
nsTArray<nsAutoPtr<Callback> > mBufferedCallbacks;
|
nsTArray<nsAutoPtr<Callback> > mBufferedCallbacks;
|
||||||
bool mShouldBuffer;
|
bool mShouldBuffer;
|
||||||
mozilla::Mutex mBufferLock;
|
|
||||||
|
|
||||||
bool BufferOrDispatch(Callback* callback);
|
bool BufferOrDispatch(Callback* callback);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user