[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
ap at apple.com
ap at apple.com
Wed Dec 22 14:41:12 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 11b2835fca527e2311635aa5975af88c2c6b968a
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 15 22:05:56 2010 +0000
2010-10-15 Alexey Proskuryakov <ap at apple.com>
Reviewed by Darin Adler in <https://bugs.webkit.org/show_bug.cgi?id=47736>.
Add a logging channel for WebCore cache and resource loading.
Test: http/tests/cache/stopped-revalidation.html
* platform/Logging.cpp:
* platform/Logging.h:
Added a logging channel for Cache and Loader.
* loader/Cache.cpp:
(WebCore::Cache::requestResource):
(WebCore::Cache::revalidateResource):
(WebCore::Cache::revalidationFailed):
(WebCore::Cache::evict):
* loader/CachedResource.cpp:
(WebCore::CachedResource::setResourceToRevalidate):
(WebCore::CachedResource::switchClientsToRevalidatedResource):
(WebCore::CachedResource::mustRevalidate):
Added logging.
* loader/loader.cpp:
(WebCore::Loader::load): Added logging.
(WebCore::Loader::scheduleServePendingRequests): Ditto.
(WebCore::Loader::requestTimerFired): Ditto.
(WebCore::Loader::servePendingRequests): Ditto.
(WebCore::Loader::Host::servePendingRequests): Changed logging to use the new channel.
(WebCore::Loader::Host::didFinishLoading): Changed logging to use the new channel.
(WebCore::Loader::Host::didFail): Added logging.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69886 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fca674f..6698104 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-10-15 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Darin Adler in <https://bugs.webkit.org/show_bug.cgi?id=47736>.
+
+ Add a logging channel for WebCore cache and resource loading.
+
+ Test: http/tests/cache/stopped-revalidation.html
+
+ * platform/Logging.cpp:
+ * platform/Logging.h:
+ Added a logging channel for Cache and Loader.
+
+ * loader/Cache.cpp:
+ (WebCore::Cache::requestResource):
+ (WebCore::Cache::revalidateResource):
+ (WebCore::Cache::revalidationFailed):
+ (WebCore::Cache::evict):
+ * loader/CachedResource.cpp:
+ (WebCore::CachedResource::setResourceToRevalidate):
+ (WebCore::CachedResource::switchClientsToRevalidatedResource):
+ (WebCore::CachedResource::mustRevalidate):
+ Added logging.
+
+ * loader/loader.cpp:
+ (WebCore::Loader::load): Added logging.
+ (WebCore::Loader::scheduleServePendingRequests): Ditto.
+ (WebCore::Loader::requestTimerFired): Ditto.
+ (WebCore::Loader::servePendingRequests): Ditto.
+ (WebCore::Loader::Host::servePendingRequests): Changed logging to use the new channel.
+ (WebCore::Loader::Host::didFinishLoading): Changed logging to use the new channel.
+ (WebCore::Loader::Host::didFail): Added logging.
+
2010-10-15 No'am Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Simon Fraser.
diff --git a/WebCore/loader/Cache.cpp b/WebCore/loader/Cache.cpp
index 28c9f93..d676538 100644
--- a/WebCore/loader/Cache.cpp
+++ b/WebCore/loader/Cache.cpp
@@ -34,6 +34,7 @@
#include "FrameLoaderTypes.h"
#include "FrameView.h"
#include "Image.h"
+#include "Logging.h"
#include "ResourceHandle.h"
#include "SecurityOrigin.h"
#include <stdio.h>
@@ -95,6 +96,8 @@ static CachedResource* createResource(CachedResource::Type type, const KURL& url
CachedResource* Cache::requestResource(CachedResourceLoader* cachedResourceLoader, CachedResource::Type type, const KURL& url, const String& charset, bool requestIsPreload)
{
+ LOG(ResourceLoading, "Cache::requestResource '%s', charset '%s', preload=%u", url.string().latin1().data(), charset.latin1().data(), requestIsPreload);
+
// FIXME: Do we really need to special-case an empty URL?
// Would it be better to just go on with the cache code and let it fail later?
if (url.isEmpty())
@@ -103,16 +106,20 @@ CachedResource* Cache::requestResource(CachedResourceLoader* cachedResourceLoade
// Look up the resource in our map.
CachedResource* resource = resourceForURL(url.string());
- if (resource && requestIsPreload && !resource->isPreloaded())
+ if (resource && requestIsPreload && !resource->isPreloaded()) {
+ LOG(ResourceLoading, "Cache::requestResource already has a preload request for this request, and it hasn't been preloaded yet");
return 0;
+ }
if (!cachedResourceLoader->doc()->securityOrigin()->canDisplay(url)) {
+ LOG(ResourceLoading, "...URL was not allowed by SecurityOrigin");
if (!requestIsPreload)
FrameLoader::reportLocalLoadFailed(cachedResourceLoader->doc()->frame(), url.string());
return 0;
}
if (!resource) {
+ LOG(ResourceLoading, "CachedResource for '%s' wasn't found in cache. Creating it", url.string().latin1().data());
// The resource does not exist. Create it.
resource = createResource(type, url, charset);
ASSERT(resource);
@@ -141,14 +148,18 @@ CachedResource* Cache::requestResource(CachedResourceLoader* cachedResourceLoade
}
}
- if (resource->type() != type)
+ if (resource->type() != type) {
+ LOG(ResourceLoading, "Cache::requestResource cannot use cached resource for '%s' due to type mismatch", url.string().latin1().data());
return 0;
+ }
if (!disabled()) {
// This will move the resource to the front of its LRU list and increase its access count.
resourceAccessed(resource);
}
+ LOG(ResourceLoading, "Cache::requestResource for '%s' returning resource %p\n", url.string().latin1().data(), resource);
+
return resource;
}
@@ -195,6 +206,7 @@ void Cache::revalidateResource(CachedResource* resource, CachedResourceLoader* c
}
const String& url = resource->url();
CachedResource* newResource = createResource(resource->type(), KURL(ParsedURLString, url), resource->encoding());
+ LOG(ResourceLoading, "Resource %p created to revalidate %p", newResource, resource);
newResource->setResourceToRevalidate(resource);
evict(resource);
m_resources.set(url, newResource);
@@ -231,6 +243,7 @@ void Cache::revalidationSucceeded(CachedResource* revalidatingResource, const Re
void Cache::revalidationFailed(CachedResource* revalidatingResource)
{
+ LOG(ResourceLoading, "Revalidation failed for %p", revalidatingResource);
ASSERT(revalidatingResource->resourceToRevalidate());
revalidatingResource->clearResourceToRevalidate();
}
@@ -424,6 +437,7 @@ bool Cache::makeResourcePurgeable(CachedResource* resource)
void Cache::evict(CachedResource* resource)
{
+ LOG(ResourceLoading, "Evicting resource %p for '%s' from cache", resource, resource->url().latin1().data());
// The resource may have already been removed by someone other than our caller,
// who needed a fresh copy for a reload. See <http://bugs.webkit.org/show_bug.cgi?id=12479#c6>.
if (resource->inCache()) {
diff --git a/WebCore/loader/CachedResource.cpp b/WebCore/loader/CachedResource.cpp
index 08aca20..e519c29 100644
--- a/WebCore/loader/CachedResource.cpp
+++ b/WebCore/loader/CachedResource.cpp
@@ -33,6 +33,7 @@
#include "Frame.h"
#include "FrameLoaderClient.h"
#include "KURL.h"
+#include "Logging.h"
#include "PurgeableBuffer.h"
#include "Request.h"
#include "ResourceHandle.h"
@@ -350,6 +351,8 @@ void CachedResource::setResourceToRevalidate(CachedResource* resource)
ASSERT(m_handlesToRevalidate.isEmpty());
ASSERT(resource->type() == type());
+ LOG(ResourceLoading, "CachedResource %p setResourceToRevalidate %p", this, resource);
+
// The following assert should be investigated whenever it occurs. Although it should never fire, it currently does in rare circumstances.
// https://bugs.webkit.org/show_bug.cgi?id=28604.
// So the code needs to be robust to this assert failing thus the "if (m_resourceToRevalidate->m_proxyResource == this)" in CachedResource::clearResourceToRevalidate.
@@ -378,6 +381,8 @@ void CachedResource::switchClientsToRevalidatedResource()
ASSERT(m_resourceToRevalidate->inCache());
ASSERT(!inCache());
+ LOG(ResourceLoading, "CachedResource %p switchClientsToRevalidatedResource %p", this, m_resourceToRevalidate);
+
HashSet<CachedResourceHandleBase*>::iterator end = m_handlesToRevalidate.end();
for (HashSet<CachedResourceHandleBase*>::iterator it = m_handlesToRevalidate.begin(); it != end; ++it) {
CachedResourceHandleBase* handle = *it;
@@ -462,19 +467,33 @@ bool CachedResource::canUseCacheValidator() const
bool CachedResource::mustRevalidate(CachePolicy cachePolicy) const
{
- if (m_errorOccurred)
+ if (m_errorOccurred) {
+ LOG(ResourceLoading, "CachedResource %p mustRevalidate because of m_errorOccurred\n", this);
return true;
+ }
if (m_loading)
return false;
- if (m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore())
+ if (m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()) {
+ LOG(ResourceLoading, "CachedResource %p mustRevalidate because of m_response.cacheControlContainsNoCache() || m_response.cacheControlContainsNoStore()\n", this);
return true;
+ }
- if (cachePolicy == CachePolicyCache)
- return m_response.cacheControlContainsMustRevalidate() && isExpired();
+ if (cachePolicy == CachePolicyCache) {
+ if (m_response.cacheControlContainsMustRevalidate() && isExpired()) {
+ LOG(ResourceLoading, "CachedResource %p mustRevalidate because of cachePolicy == CachePolicyCache and m_response.cacheControlContainsMustRevalidate() && isExpired()\n", this);
+ return true;
+ }
+ return false;
+ }
+
+ if (isExpired()) {
+ LOG(ResourceLoading, "CachedResource %p mustRevalidate because of isExpired()\n", this);
+ return true;
+ }
- return isExpired();
+ return false;
}
bool CachedResource::isSafeToMakePurgeable() const
diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp
index 2c8f3bd..81e91eb 100644
--- a/WebCore/loader/loader.cpp
+++ b/WebCore/loader/loader.cpp
@@ -32,6 +32,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "HTMLDocument.h"
+#include "Logging.h"
#include "Request.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
@@ -43,7 +44,6 @@
#include <wtf/Vector.h>
#define REQUEST_MANAGEMENT_ENABLED 1
-#define REQUEST_DEBUG 0
namespace WebCore {
@@ -123,6 +123,8 @@ Loader::Priority Loader::determinePriority(const CachedResource* resource) const
void Loader::load(CachedResourceLoader* cachedResourceLoader, CachedResource* resource, bool incremental, SecurityCheckPolicy securityCheck, bool sendResourceLoadCallbacks)
{
+ LOG(ResourceLoading, "Loader::load resource %p '%s'", resource, resource->url().latin1().data());
+
ASSERT(cachedResourceLoader);
Request* request = new Request(cachedResourceLoader, resource, incremental, securityCheck, sendResourceLoadCallbacks);
@@ -156,17 +158,20 @@ void Loader::load(CachedResourceLoader* cachedResourceLoader, CachedResource* re
void Loader::scheduleServePendingRequests()
{
+ LOG(ResourceLoading, "Loader::scheduleServePendingRequests, m_requestTimer.isActive()=%u", m_requestTimer.isActive());
if (!m_requestTimer.isActive())
m_requestTimer.startOneShot(0);
}
void Loader::requestTimerFired(Timer<Loader>*)
{
+ LOG(ResourceLoading, "Loader::requestTimerFired\n");
servePendingRequests();
}
void Loader::servePendingRequests(Priority minimumPriority)
{
+ LOG(ResourceLoading, "Loader::servePendingRequests. m_isSuspendingPendingRequests=%d", m_isSuspendingPendingRequests);
if (m_isSuspendingPendingRequests)
return;
@@ -308,8 +313,11 @@ bool Loader::Host::hasRequests() const
void Loader::Host::servePendingRequests(Loader::Priority minimumPriority)
{
- if (cache()->loader()->isSuspendingPendingRequests())
+ LOG(ResourceLoading, "Host::servePendingRequests '%s'", m_name.string().latin1().data());
+ if (cache()->loader()->isSuspendingPendingRequests()) {
+ LOG(ResourceLoading, "...isSuspendingPendingRequests");
return;
+ }
bool serveMore = true;
for (int priority = High; priority >= minimumPriority && serveMore; --priority)
@@ -368,13 +376,14 @@ void Loader::Host::servePendingRequests(RequestQueue& requestsPending, bool& ser
if (loader) {
m_requestsLoading.add(loader.release(), request);
request->cachedResource()->setRequestedFromNetworkingLayer();
-#if REQUEST_DEBUG
- printf("HOST %s COUNT %d LOADING %s\n", resourceRequest.url().host().latin1().data(), m_requestsLoading.size(), request->cachedResource()->url().latin1().data());
-#endif
- } else {
- cachedResourceLoader->decrementRequestCount(request->cachedResource());
+ LOG(ResourceLoading, "Host '%s' loading '%s'. Current count %d", m_name.string().latin1().data(), request->cachedResource()->url().latin1().data(), m_requestsLoading.size());
+ } else {
+ // FIXME: What if resources in other frames were waiting for this revalidation?
+ LOG(ResourceLoading, "Host '%s' cannot start loading '%s'", m_name.string().latin1().data(), request->cachedResource()->url().latin1().data());
+ CachedResource* resource = request->cachedResource();
+ cachedResourceLoader->decrementRequestCount(resource);
cachedResourceLoader->setLoadInProgress(true);
- request->cachedResource()->error();
+ resource->error();
cachedResourceLoader->setLoadInProgress(false);
delete request;
}
@@ -415,10 +424,8 @@ void Loader::Host::didFinishLoading(SubresourceLoader* loader)
cachedResourceLoader->checkForPendingPreloads();
-#if REQUEST_DEBUG
- KURL u(ParsedURLString, resource->url());
- printf("HOST %s COUNT %d RECEIVED %s\n", u.host().latin1().data(), m_requestsLoading.size(), resource->url().latin1().data());
-#endif
+ LOG(ResourceLoading, "Host '%s' received %s. Current count %d\n", m_name.string().latin1().data(), resource->url().latin1().data(), m_requestsLoading.size());
+
servePendingRequests();
}
@@ -464,6 +471,8 @@ void Loader::Host::didFail(SubresourceLoader* loader, bool cancelled)
cachedResourceLoader->checkForPendingPreloads();
+ LOG(ResourceLoading, "Host '%s' failed to load %s (cancelled=%d). Current count %d\n", m_name.string().latin1().data(), resource->url().latin1().data(), cancelled, m_requestsLoading.size());
+
servePendingRequests();
}
diff --git a/WebCore/platform/Logging.cpp b/WebCore/platform/Logging.cpp
index 7fb15b1..b383697 100644
--- a/WebCore/platform/Logging.cpp
+++ b/WebCore/platform/Logging.cpp
@@ -33,13 +33,11 @@ WTFLogChannel LogNotYetImplemented = { 0x00000001, "WebCoreLogLevel", WTFLogChan
WTFLogChannel LogFrames = { 0x00000010, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogLoading = { 0x00000020, "WebCoreLogLevel", WTFLogChannelOff };
-
WTFLogChannel LogPopupBlocking = { 0x00000040, "WebCoreLogLevel", WTFLogChannelOff };
-
WTFLogChannel LogEvents = { 0x00000080, "WebCoreLogLevel", WTFLogChannelOff };
+
WTFLogChannel LogEditing = { 0x00000100, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogLiveConnect = { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff };
-
WTFLogChannel LogIconDatabase = { 0x00000400, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogSQLDatabase = { 0x00000800, "WebCoreLogLevel", WTFLogChannelOff };
@@ -49,6 +47,7 @@ WTFLogChannel LogHistory = { 0x00004000, "WebCoreLogLevel", WTFLogChan
WTFLogChannel LogPageCache = { 0x00008000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogPlatformLeaks = { 0x00010000, "WebCoreLogLevel", WTFLogChannelOff };
+WTFLogChannel LogResourceLoading = { 0x00020000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogNetwork = { 0x00100000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogFTP = { 0x00200000, "WebCoreLogLevel", WTFLogChannelOff };
@@ -56,10 +55,10 @@ WTFLogChannel LogThreading = { 0x00400000, "WebCoreLogLevel", WTFLogChan
WTFLogChannel LogStorageAPI = { 0x00800000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogMedia = { 0x01000000, "WebCoreLogLevel", WTFLogChannelOff };
-
WTFLogChannel LogPlugins = { 0x02000000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogArchives = { 0x04000000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel LogProgress = { 0x08000000, "WebCoreLogLevel", WTFLogChannelOff };
+
WTFLogChannel LogFileAPI = { 0x10000000, "WebCoreLogLevel", WTFLogChannelOff };
WTFLogChannel* getChannelFromName(const String& channelName)
diff --git a/WebCore/platform/Logging.h b/WebCore/platform/Logging.h
index df3c6fd..11ad1db 100644
--- a/WebCore/platform/Logging.h
+++ b/WebCore/platform/Logging.h
@@ -49,6 +49,7 @@ namespace WebCore {
extern WTFLogChannel LogHistory;
extern WTFLogChannel LogPageCache;
extern WTFLogChannel LogPlatformLeaks;
+ extern WTFLogChannel LogResourceLoading;
extern WTFLogChannel LogNetwork;
extern WTFLogChannel LogFTP;
extern WTFLogChannel LogThreading;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list