mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Bug 673260. HttpChannelChild::RecvAssociateApplicationCache needs to be buffered. r=jduell
This commit is contained in:
parent
701de872f8
commit
b5abd62ccf
@ -144,6 +144,48 @@ HttpChannelChild::ReleaseIPDLReference()
|
||||
Release();
|
||||
}
|
||||
|
||||
class AssociateApplicationCacheEvent : public ChannelEvent
|
||||
{
|
||||
public:
|
||||
AssociateApplicationCacheEvent(HttpChannelChild* child,
|
||||
const nsCString &groupID,
|
||||
const nsCString &clientID)
|
||||
: mChild(child)
|
||||
, groupID(groupID)
|
||||
, clientID(clientID) {}
|
||||
|
||||
void Run() { mChild->AssociateApplicationCache(groupID, clientID); }
|
||||
private:
|
||||
HttpChannelChild* mChild;
|
||||
nsCString groupID;
|
||||
nsCString clientID;
|
||||
};
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvAssociateApplicationCache(const nsCString &groupID,
|
||||
const nsCString &clientID)
|
||||
{
|
||||
if (mEventQ.ShouldEnqueue()) {
|
||||
mEventQ.Enqueue(new AssociateApplicationCacheEvent(this, groupID, clientID));
|
||||
} else {
|
||||
AssociateApplicationCache(groupID, clientID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelChild::AssociateApplicationCache(const nsCString &groupID,
|
||||
const nsCString &clientID)
|
||||
{
|
||||
nsresult rv;
|
||||
mApplicationCache = do_CreateInstance(NS_APPLICATIONCACHE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
mLoadedFromApplicationCache = PR_TRUE;
|
||||
mApplicationCache->InitAsHandle(groupID, clientID);
|
||||
}
|
||||
|
||||
class StartRequestEvent : public ChannelEvent
|
||||
{
|
||||
public:
|
||||
@ -192,21 +234,6 @@ class StartRequestEvent : public ChannelEvent
|
||||
PRNetAddr mPeerAddr;
|
||||
};
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvAssociateApplicationCache(const nsCString &groupID,
|
||||
const nsCString &clientID)
|
||||
{
|
||||
nsresult rv;
|
||||
mApplicationCache = do_CreateInstance(
|
||||
NS_APPLICATIONCACHE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return true;
|
||||
|
||||
mLoadedFromApplicationCache = PR_TRUE;
|
||||
mApplicationCache->InitAsHandle(groupID, clientID);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpChannelChild::RecvOnStartRequest(const nsHttpResponseHead& responseHead,
|
||||
const PRBool& useResponseHead,
|
||||
|
@ -173,6 +173,8 @@ private:
|
||||
bool mKeptAlive;
|
||||
ChannelEventQueue mEventQ;
|
||||
|
||||
void AssociateApplicationCache(const nsCString &groupID,
|
||||
const nsCString &clientID);
|
||||
void OnStartRequest(const nsHttpResponseHead& responseHead,
|
||||
const PRBool& useResponseHead,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
@ -204,6 +206,7 @@ private:
|
||||
// Called asynchronously from Resume: continues any pending calls into client.
|
||||
void CompleteResume();
|
||||
|
||||
friend class AssociateApplicationCacheEvent;
|
||||
friend class StartRequestEvent;
|
||||
friend class StopRequestEvent;
|
||||
friend class TransportAndDataEvent;
|
||||
|
Loading…
Reference in New Issue
Block a user