summaryrefslogtreecommitdiffstats
path: root/webkit/pending/CachedResource.h
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 22:31:35 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 22:31:35 +0000
commitde56f378336660dcc848763c80267a5e063ae47d (patch)
tree7f551b88923b35bc4022ce6ab3a3f602fb60d91c /webkit/pending/CachedResource.h
parentdc4f63c80cb90efe594131030aad6776e5945fcc (diff)
downloadchromium_src-de56f378336660dcc848763c80267a5e063ae47d.zip
chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.gz
chromium_src-de56f378336660dcc848763c80267a5e063ae47d.tar.bz2
Merge the chrome_webkit_merge_branch back on to trunk. This brings us
up to webkit@36102. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2778 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/pending/CachedResource.h')
-rw-r--r--webkit/pending/CachedResource.h38
1 files changed, 29 insertions, 9 deletions
diff --git a/webkit/pending/CachedResource.h b/webkit/pending/CachedResource.h
index 1d025ae..bcd03e0 100644
--- a/webkit/pending/CachedResource.h
+++ b/webkit/pending/CachedResource.h
@@ -34,6 +34,7 @@ namespace WebCore {
class Cache;
class CachedResourceClient;
+class CacheHandleBase;
class DocLoader;
class Request;
@@ -65,8 +66,11 @@ public:
Cached // regular case
};
- CachedResource(const String& url, Type, bool forCache = true, bool sendResourceLoadCallbacks = false);
+ CachedResource(const String& url, Type);
virtual ~CachedResource();
+
+ virtual void load(DocLoader* docLoader) { load(docLoader, false, false, true); }
+ void load(DocLoader*, bool incremental, bool skipCanLoadCheck, bool sendResourceLoadCallbacks);
virtual void setEncoding(const String&) { }
virtual String encoding() const { return String(); }
@@ -76,10 +80,20 @@ public:
const String &url() const { return m_url; }
Type type() const { return m_type; }
- virtual void ref(CachedResourceClient*);
- void deref(CachedResourceClient*);
- bool referenced() const { return !m_clients.isEmpty(); }
- virtual void allReferencesRemoved() {};
+ virtual void addClient(CachedResourceClient*);
+ void removeClient(CachedResourceClient*);
+ bool hasClients() const { return !m_clients.isEmpty(); }
+
+ enum PreloadResult {
+ PreloadNotReferenced,
+ PreloadReferenced,
+ PreloadReferencedWhileLoading,
+ PreloadReferencedWhileComplete
+ };
+ PreloadResult preloadResult() const { return m_preloadResult; }
+ void setRequestedFromNetworkingLayer() { m_requestedFromNetworkingLayer = true; }
+
+ virtual void allClientsRemoved() { };
unsigned count() const { return m_clients.size(); }
@@ -115,7 +129,7 @@ public:
void setResponse(const ResourceResponse& response) { m_response = response; }
const ResourceResponse& response() const { return m_response; }
- bool canDelete() const { return !referenced() && !m_request; }
+ bool canDelete() const { return !hasClients() && !m_request && !m_preloadCount; }
bool isExpired() const;
@@ -127,7 +141,6 @@ public:
void setAccept(const String& accept) { m_accept = accept; }
bool errorOccurred() const { return m_errorOccurred; }
- bool treatAsLocal() const { return m_shouldTreatAsLocal; }
bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; }
virtual void destroyDecodedData() {};
@@ -138,6 +151,10 @@ public:
SharedBuffer* data() const { return m_data.get(); }
#endif
+ bool isPreloaded() const { return m_preloadCount; }
+ void increasePreloadCount() { ++m_preloadCount; }
+ void decreasePreloadCount() { ASSERT(m_preloadCount); --m_preloadCount; }
+
protected:
void setEncodedSize(unsigned);
void setDecodedSize(unsigned);
@@ -165,6 +182,11 @@ private:
double m_lastDecodedAccessTime; // Used as a "thrash guard" in the cache
bool m_sendResourceLoadCallbacks;
+
+ unsigned m_preloadCount;
+ PreloadResult m_preloadResult;
+ bool m_requestedFromNetworkingLayer;
+
protected:
bool m_inCache;
bool m_loading;
@@ -181,8 +203,6 @@ private:
CachedResource* m_nextInLiveResourcesList;
CachedResource* m_prevInLiveResourcesList;
- bool m_shouldTreatAsLocal;
-
DocLoader* m_docLoader; // only non-0 for resources that are not in the cache
};