зеркало из https://github.com/mozilla/gecko-dev.git
Bug 442803: Remove offline fetching from nsPrefetchService.cpp. r+sr=bz
This commit is contained in:
Родитель
637b927680
Коммит
0968273f82
|
@ -59,14 +59,8 @@ interface nsIPrefetchService : nsISupports
|
|||
in boolean aExplicit);
|
||||
|
||||
/**
|
||||
* Enqueue a request to prefetch the specified URI, making sure it's in the
|
||||
* offline cache.
|
||||
*
|
||||
* @param aURI the URI of the document to prefetch
|
||||
* @param aReferrerURI the URI of the referring page
|
||||
* @param aSource the DOM node (such as a <link> tag) that requested this
|
||||
* fetch, or null if the prefetch was not requested by a DOM node.
|
||||
* @param aExplicit the link element has an explicit offline link type
|
||||
* @status DEPRECATED This method is no longer used, and will throw
|
||||
* NS_ERROR_NOT_IMPLEMENTED.
|
||||
*/
|
||||
void prefetchURIForOfflineUse(in nsIURI aURI,
|
||||
in nsIURI aReferrerURI,
|
||||
|
@ -77,9 +71,12 @@ interface nsIPrefetchService : nsISupports
|
|||
* Enumerate the items in the prefetch queue. Each element in the
|
||||
* enumeration is an nsIDOMLoadStatus.
|
||||
*
|
||||
* @param aIncludeNormalItems include normal prefetch items in the list.
|
||||
* @param aIncludeNormalItems include normal prefetch items in the
|
||||
* list. This parameter is deprecated and must be TRUE,
|
||||
* or NS_ERROR_INT_IMPLEMENTED will be thrown.
|
||||
* @param aIncludeOfflineItems include items being fetched for offline
|
||||
* use.
|
||||
* use. This parameter is deprecated and must be FALSE,
|
||||
* or NS_ERROR_NOT_IMPLEMENTED will be thrown.
|
||||
*/
|
||||
nsISimpleEnumerator enumerateQueue(in boolean aIncludeNormalItems,
|
||||
in boolean aIncludeOfflineItems);
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
#include "nsPrefetchService.h"
|
||||
#include "nsICacheSession.h"
|
||||
#include "nsIOfflineCacheSession.h"
|
||||
#include "nsICacheService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsICategoryManager.h"
|
||||
|
@ -104,9 +103,7 @@ class nsPrefetchQueueEnumerator : public nsISimpleEnumerator
|
|||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
nsPrefetchQueueEnumerator(nsPrefetchService *aService,
|
||||
PRBool aIncludeNormal,
|
||||
PRBool aIncludeOffline);
|
||||
nsPrefetchQueueEnumerator(nsPrefetchService *aService);
|
||||
~nsPrefetchQueueEnumerator();
|
||||
|
||||
private:
|
||||
|
@ -114,20 +111,14 @@ private:
|
|||
|
||||
nsRefPtr<nsPrefetchService> mService;
|
||||
nsRefPtr<nsPrefetchNode> mCurrent;
|
||||
PRBool mIncludeNormal;
|
||||
PRBool mIncludeOffline;
|
||||
PRBool mStarted;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsPrefetchQueueEnumerator <public>
|
||||
//-----------------------------------------------------------------------------
|
||||
nsPrefetchQueueEnumerator::nsPrefetchQueueEnumerator(nsPrefetchService *aService,
|
||||
PRBool aIncludeNormal,
|
||||
PRBool aIncludeOffline)
|
||||
nsPrefetchQueueEnumerator::nsPrefetchQueueEnumerator(nsPrefetchService *aService)
|
||||
: mService(aService)
|
||||
, mIncludeNormal(aIncludeNormal)
|
||||
, mIncludeOffline(aIncludeOffline)
|
||||
, mStarted(PR_FALSE)
|
||||
{
|
||||
Increment();
|
||||
|
@ -187,8 +178,7 @@ nsPrefetchQueueEnumerator::Increment()
|
|||
mCurrent = mCurrent->mNext;
|
||||
}
|
||||
}
|
||||
} while (mCurrent && mIncludeOffline != mCurrent->mOffline &&
|
||||
mIncludeNormal == mCurrent->mOffline);
|
||||
} while (mCurrent);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -204,12 +194,10 @@ NS_IMPL_ISUPPORTS1(nsPrefetchQueueEnumerator, nsISimpleEnumerator)
|
|||
nsPrefetchNode::nsPrefetchNode(nsPrefetchService *aService,
|
||||
nsIURI *aURI,
|
||||
nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource,
|
||||
PRBool aOffline)
|
||||
nsIDOMNode *aSource)
|
||||
: mNext(nsnull)
|
||||
, mURI(aURI)
|
||||
, mReferrerURI(aReferrerURI)
|
||||
, mOffline(aOffline)
|
||||
, mService(aService)
|
||||
, mChannel(nsnull)
|
||||
, mState(nsIDOMLoadStatus::UNINITIALIZED)
|
||||
|
@ -235,21 +223,10 @@ nsPrefetchNode::OpenChannel()
|
|||
httpChannel->SetReferrer(mReferrerURI);
|
||||
httpChannel->SetRequestHeader(
|
||||
NS_LITERAL_CSTRING("X-Moz"),
|
||||
mOffline ?
|
||||
NS_LITERAL_CSTRING("offline-resource") :
|
||||
NS_LITERAL_CSTRING("prefetch"),
|
||||
PR_FALSE);
|
||||
}
|
||||
|
||||
if (mOffline) {
|
||||
nsCOMPtr<nsICachingChannel> cachingChannel =
|
||||
do_QueryInterface(mChannel);
|
||||
if (cachingChannel) {
|
||||
rv = cachingChannel->SetCacheForOfflineUse(PR_TRUE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
rv = mChannel->AsyncOpen(this, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -294,40 +271,34 @@ nsPrefetchNode::OnStartRequest(nsIRequest *aRequest,
|
|||
do_QueryInterface(aRequest, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool cacheForOfflineUse;
|
||||
rv = cachingChannel->GetCacheForOfflineUse(&cacheForOfflineUse);
|
||||
// no need to prefetch a document that is already in the cache
|
||||
PRBool fromCache;
|
||||
if (NS_SUCCEEDED(cachingChannel->IsFromCache(&fromCache)) &&
|
||||
fromCache) {
|
||||
LOG(("document is already in the cache; canceling prefetch\n"));
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// no need to prefetch a document that must be requested fresh each
|
||||
// and every time.
|
||||
//
|
||||
nsCOMPtr<nsISupports> cacheToken;
|
||||
cachingChannel->GetCacheToken(getter_AddRefs(cacheToken));
|
||||
if (!cacheToken)
|
||||
return NS_ERROR_ABORT; // bail, no cache entry
|
||||
|
||||
nsCOMPtr<nsICacheEntryInfo> entryInfo =
|
||||
do_QueryInterface(cacheToken, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!cacheForOfflineUse) {
|
||||
// no need to prefetch a document that is already in the cache
|
||||
PRBool fromCache;
|
||||
if (NS_SUCCEEDED(cachingChannel->IsFromCache(&fromCache)) &&
|
||||
fromCache) {
|
||||
LOG(("document is already in the cache; canceling prefetch\n"));
|
||||
PRUint32 expTime;
|
||||
if (NS_SUCCEEDED(entryInfo->GetExpirationTime(&expTime))) {
|
||||
if (NowInSeconds() >= expTime) {
|
||||
LOG(("document cannot be reused from cache; "
|
||||
"canceling prefetch\n"));
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// no need to prefetch a document that must be requested fresh each
|
||||
// and every time.
|
||||
//
|
||||
nsCOMPtr<nsISupports> cacheToken;
|
||||
cachingChannel->GetCacheToken(getter_AddRefs(cacheToken));
|
||||
if (!cacheToken)
|
||||
return NS_ERROR_ABORT; // bail, no cache entry
|
||||
|
||||
nsCOMPtr<nsICacheEntryInfo> entryInfo =
|
||||
do_QueryInterface(cacheToken, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRUint32 expTime;
|
||||
if (NS_SUCCEEDED(entryInfo->GetExpirationTime(&expTime))) {
|
||||
if (NowInSeconds() >= expTime) {
|
||||
LOG(("document cannot be reused from cache; "
|
||||
"canceling prefetch\n"));
|
||||
return NS_BINDING_ABORTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mState = nsIDOMLoadStatus::RECEIVING;
|
||||
|
@ -401,26 +372,14 @@ nsPrefetchNode::OnChannelRedirect(nsIChannel *aOldChannel,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
PRBool offline;
|
||||
nsCOMPtr<nsICachingChannel> oldCachingChannel =
|
||||
do_QueryInterface(aOldChannel);
|
||||
if (NS_SUCCEEDED(oldCachingChannel->GetCacheForOfflineUse(&offline)) &&
|
||||
offline) {
|
||||
nsCOMPtr<nsICachingChannel> newCachingChannel =
|
||||
do_QueryInterface(aOldChannel);
|
||||
if (newCachingChannel)
|
||||
newCachingChannel->SetCacheForOfflineUse(PR_TRUE);
|
||||
}
|
||||
|
||||
PRBool match;
|
||||
rv = newURI->SchemeIs("http", &match);
|
||||
if (NS_FAILED(rv) || !match) {
|
||||
if (!offline ||
|
||||
NS_FAILED(newURI->SchemeIs("https", &match)) ||
|
||||
!match) {
|
||||
LOG(("rejected: URL is not of type http\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
LOG(("rejected: URL is not of type http\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
||||
// HTTP request headers are not automatically forwarded to the new channel.
|
||||
|
@ -428,9 +387,7 @@ nsPrefetchNode::OnChannelRedirect(nsIChannel *aOldChannel,
|
|||
NS_ENSURE_STATE(httpChannel);
|
||||
|
||||
httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("X-Moz"),
|
||||
offline ?
|
||||
NS_LITERAL_CSTRING("offline-resource") :
|
||||
NS_LITERAL_CSTRING("prefetch"),
|
||||
NS_LITERAL_CSTRING("prefetch"),
|
||||
PR_FALSE);
|
||||
|
||||
mChannel = aNewChannel;
|
||||
|
@ -449,7 +406,6 @@ nsPrefetchService::nsPrefetchService()
|
|||
, mStopCount(0)
|
||||
, mHaveProcessed(PR_FALSE)
|
||||
, mDisabled(PR_TRUE)
|
||||
, mFetchedOffline(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -457,7 +413,7 @@ nsPrefetchService::~nsPrefetchService()
|
|||
{
|
||||
// cannot reach destructor if prefetch in progress (listener owns reference
|
||||
// to this service)
|
||||
EmptyQueue(PR_TRUE);
|
||||
EmptyQueue();
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -505,18 +461,6 @@ nsPrefetchService::ProcessNextURI()
|
|||
|
||||
do {
|
||||
rv = DequeueNode(getter_AddRefs(mCurrentNode));
|
||||
if (rv == NS_ERROR_NOT_AVAILABLE && mFetchedOffline) {
|
||||
// done loading stuff, go ahead and evict unowned entries from
|
||||
// the offline cache
|
||||
mFetchedOffline = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIOfflineCacheSession> session;
|
||||
rv = GetOfflineCacheSession(getter_AddRefs(session));
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
session->EvictUnownedEntries();
|
||||
break;
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
|
@ -532,8 +476,6 @@ nsPrefetchService::ProcessNextURI()
|
|||
// if opening the channel fails, then just skip to the next uri
|
||||
//
|
||||
rv = mCurrentNode->OpenChannel();
|
||||
if (NS_SUCCEEDED(rv) && mCurrentNode->mOffline)
|
||||
mFetchedOffline = PR_TRUE;
|
||||
}
|
||||
while (NS_FAILED(rv));
|
||||
}
|
||||
|
@ -547,11 +489,8 @@ nsPrefetchService::NotifyLoadRequested(nsPrefetchNode *node)
|
|||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
const char *topic = node->mOffline ? "offline-load-requested" :
|
||||
"prefetch-load-requested";
|
||||
|
||||
observerService->NotifyObservers(static_cast<nsIDOMLoadStatus*>(node),
|
||||
topic, nsnull);
|
||||
"prefetch-load-requested", nsnull);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -563,11 +502,8 @@ nsPrefetchService::NotifyLoadCompleted(nsPrefetchNode *node)
|
|||
do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
const char *topic = node->mOffline ? "offline-load-completed" :
|
||||
"prefetch-load-completed";
|
||||
|
||||
observerService->NotifyObservers(static_cast<nsIDOMLoadStatus*>(node),
|
||||
topic, nsnull);
|
||||
"prefetch-load-completed", nsnull);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -615,11 +551,10 @@ nsresult
|
|||
nsPrefetchService::EnqueueURI(nsIURI *aURI,
|
||||
nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource,
|
||||
PRBool aOffline,
|
||||
nsPrefetchNode **aNode)
|
||||
{
|
||||
nsPrefetchNode *node = new nsPrefetchNode(this, aURI, aReferrerURI,
|
||||
aSource, aOffline);
|
||||
aSource);
|
||||
if (!node)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -646,52 +581,23 @@ nsPrefetchService::DequeueNode(nsPrefetchNode **node)
|
|||
}
|
||||
|
||||
void
|
||||
nsPrefetchService::EmptyQueue(PRBool includeOffline)
|
||||
nsPrefetchService::EmptyQueue()
|
||||
{
|
||||
nsPrefetchNode *prev = 0;
|
||||
nsPrefetchNode *node = mQueueHead;
|
||||
|
||||
while (node) {
|
||||
nsPrefetchNode *next = node->mNext;
|
||||
if (includeOffline || !node->mOffline) {
|
||||
if (prev)
|
||||
prev->mNext = next;
|
||||
else
|
||||
mQueueHead = next;
|
||||
NS_RELEASE(node);
|
||||
}
|
||||
if (prev)
|
||||
prev->mNext = next;
|
||||
else
|
||||
prev = node;
|
||||
mQueueHead = next;
|
||||
NS_RELEASE(node);
|
||||
|
||||
node = next;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrefetchService::GetOfflineCacheSession(nsIOfflineCacheSession **aSession)
|
||||
{
|
||||
if (!mOfflineCacheSession) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsICacheService> serv =
|
||||
do_GetService(NS_CACHESERVICE_CONTRACTID,
|
||||
&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsICacheSession> session;
|
||||
rv = serv->CreateSession("HTTP-offline",
|
||||
nsICache::STORE_OFFLINE,
|
||||
nsICache::STREAM_BASED,
|
||||
getter_AddRefs(session));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mOfflineCacheSession = do_QueryInterface(session, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ADDREF(*aSession = mOfflineCacheSession);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsPrefetchService::StartPrefetching()
|
||||
{
|
||||
|
@ -725,14 +631,9 @@ nsPrefetchService::StopPrefetching()
|
|||
if (!mCurrentNode)
|
||||
return;
|
||||
|
||||
// if it's an offline prefetch, requeue it for when prefetching starts
|
||||
// again
|
||||
if (mCurrentNode->mOffline)
|
||||
EnqueueNode(mCurrentNode);
|
||||
|
||||
mCurrentNode->CancelChannel(NS_BINDING_ABORTED);
|
||||
mCurrentNode = nsnull;
|
||||
EmptyQueue(PR_FALSE);
|
||||
EmptyQueue();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -753,8 +654,7 @@ nsresult
|
|||
nsPrefetchService::Prefetch(nsIURI *aURI,
|
||||
nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource,
|
||||
PRBool aExplicit,
|
||||
PRBool aOffline)
|
||||
PRBool aExplicit)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -788,11 +688,6 @@ nsPrefetchService::Prefetch(nsIURI *aURI,
|
|||
PRBool match;
|
||||
rv = aURI->SchemeIs("http", &match);
|
||||
if (NS_FAILED(rv) || !match) {
|
||||
if (aOffline) {
|
||||
// Offline https urls can be prefetched
|
||||
rv = aURI->SchemeIs("https", &match);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !match) {
|
||||
LOG(("rejected: URL is not of type http\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
|
@ -804,11 +699,6 @@ nsPrefetchService::Prefetch(nsIURI *aURI,
|
|||
//
|
||||
rv = aReferrerURI->SchemeIs("http", &match);
|
||||
if (NS_FAILED(rv) || !match) {
|
||||
if (aOffline) {
|
||||
// Offline https urls can be prefetched
|
||||
rv = aURI->SchemeIs("https", &match);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv) || !match) {
|
||||
LOG(("rejected: referrer URL is not of type http\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
|
@ -834,12 +724,8 @@ nsPrefetchService::Prefetch(nsIURI *aURI,
|
|||
if (mCurrentNode) {
|
||||
PRBool equals;
|
||||
if (NS_SUCCEEDED(mCurrentNode->mURI->Equals(aURI, &equals)) && equals) {
|
||||
// We may still need to put it on the queue if the channel
|
||||
// isn't fetching to the offline cache
|
||||
if (!aOffline || mCurrentNode->mOffline) {
|
||||
LOG(("rejected: URL is already being prefetched\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
LOG(("rejected: URL is already being prefetched\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -850,17 +736,13 @@ nsPrefetchService::Prefetch(nsIURI *aURI,
|
|||
for (; node; node = node->mNext) {
|
||||
PRBool equals;
|
||||
if (NS_SUCCEEDED(node->mURI->Equals(aURI, &equals)) && equals) {
|
||||
if (aOffline) {
|
||||
// make sure the node is placed in the offline cache
|
||||
node->mOffline = PR_TRUE;
|
||||
}
|
||||
LOG(("rejected: URL is already on prefetch queue\n"));
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
}
|
||||
|
||||
nsRefPtr<nsPrefetchNode> enqueuedNode;
|
||||
rv = EnqueueURI(aURI, aReferrerURI, aSource, aOffline,
|
||||
rv = EnqueueURI(aURI, aReferrerURI, aSource,
|
||||
getter_AddRefs(enqueuedNode));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -879,7 +761,7 @@ nsPrefetchService::PrefetchURI(nsIURI *aURI,
|
|||
nsIDOMNode *aSource,
|
||||
PRBool aExplicit)
|
||||
{
|
||||
return Prefetch(aURI, aReferrerURI, aSource, aExplicit, PR_FALSE);
|
||||
return Prefetch(aURI, aReferrerURI, aSource, aExplicit);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -888,7 +770,7 @@ nsPrefetchService::PrefetchURIForOfflineUse(nsIURI *aURI,
|
|||
nsIDOMNode *aSource,
|
||||
PRBool aExplicit)
|
||||
{
|
||||
return Prefetch(aURI, aReferrerURI, aSource, aExplicit, PR_TRUE);
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -896,9 +778,10 @@ nsPrefetchService::EnumerateQueue(PRBool aIncludeNormalItems,
|
|||
PRBool aIncludeOfflineItems,
|
||||
nsISimpleEnumerator **aEnumerator)
|
||||
{
|
||||
*aEnumerator = new nsPrefetchQueueEnumerator(this,
|
||||
aIncludeNormalItems,
|
||||
aIncludeOfflineItems);
|
||||
NS_ENSURE_TRUE(aIncludeNormalItems && !aIncludeOfflineItems,
|
||||
NS_ERROR_NOT_IMPLEMENTED);
|
||||
|
||||
*aEnumerator = new nsPrefetchQueueEnumerator(this);
|
||||
if (!*aEnumerator) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*aEnumerator);
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
class nsPrefetchService;
|
||||
class nsPrefetchListener;
|
||||
class nsPrefetchNode;
|
||||
class nsIOfflineCacheSession;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsPrefetchService
|
||||
|
@ -90,25 +89,19 @@ private:
|
|||
nsresult Prefetch(nsIURI *aURI,
|
||||
nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource,
|
||||
PRBool aExplicit,
|
||||
PRBool aOffline);
|
||||
PRBool aExplicit);
|
||||
|
||||
void AddProgressListener();
|
||||
void RemoveProgressListener();
|
||||
nsresult EnqueueURI(nsIURI *aURI, nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource, PRBool aOffline,
|
||||
nsPrefetchNode **node);
|
||||
nsIDOMNode *aSource, nsPrefetchNode **node);
|
||||
nsresult EnqueueNode(nsPrefetchNode *node);
|
||||
nsresult DequeueNode(nsPrefetchNode **node);
|
||||
void EmptyQueue(PRBool includeOffline);
|
||||
nsresult SaveOfflineList(nsIURI *aDocumentUri,
|
||||
nsIDOMDocument *aDoc);
|
||||
nsresult GetOfflineCacheSession(nsIOfflineCacheSession **aSession);
|
||||
void EmptyQueue();
|
||||
|
||||
void StartPrefetching();
|
||||
void StopPrefetching();
|
||||
|
||||
nsCOMPtr<nsIOfflineCacheSession> mOfflineCacheSession;
|
||||
nsPrefetchNode *mQueueHead;
|
||||
nsPrefetchNode *mQueueTail;
|
||||
nsRefPtr<nsPrefetchNode> mCurrentNode;
|
||||
|
@ -116,8 +109,6 @@ private:
|
|||
// true if pending document loads have ever reached zero.
|
||||
PRInt32 mHaveProcessed;
|
||||
PRBool mDisabled;
|
||||
PRBool mFetchedOffline;
|
||||
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -140,8 +131,7 @@ public:
|
|||
nsPrefetchNode(nsPrefetchService *aPrefetchService,
|
||||
nsIURI *aURI,
|
||||
nsIURI *aReferrerURI,
|
||||
nsIDOMNode *aSource,
|
||||
PRBool aOffline);
|
||||
nsIDOMNode *aSource);
|
||||
|
||||
~nsPrefetchNode() {}
|
||||
|
||||
|
@ -152,7 +142,6 @@ public:
|
|||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
nsCOMPtr<nsIWeakReference> mSource;
|
||||
PRBool mOffline;
|
||||
|
||||
private:
|
||||
nsRefPtr<nsPrefetchService> mService;
|
||||
|
|
Загрузка…
Ссылка в новой задаче