Changeset 87901 in webkit
- Timestamp:
- Jun 2, 2011 5:52:37 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87897 r87901 1 2011-06-02 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Brady Eidson. 4 5 DocumentLoader keeps a reference to all URL strings ever loaded leading to lots of memory waste 6 https://bugs.webkit.org/show_bug.cgi?id=61894 7 8 DocumentLoader::m_resourcesClientKnowsAbout is a set of all the URLs that have passed through 9 FrameLoader::dispatchWillSendRequest() and is used by FrameLoader::loadedResourceFromMemoryCached to decide 10 whether to inform the FrameLoader's m_client about this load. Unfortunately, this set holds a reference to the 11 URL string for every resource loaded, so on pages that use data URLs to "load" large amounts of data this leaks 12 lots of memory. 13 14 This set only has an effect on the Mac port, as the only two ports that implement 15 FrameLoaderClient::dispatchDidLoadResourceFromMemoryCache() are Chromium and Mac and the Chromium implementation 16 can correctly handle receiving multiple callbacks. This patch limits the set to only PLATFORM(MAC) so other 17 ports do not have to pay this memory cost. It's possible that a better fix exists specifically for the Mac port 18 implementation, but that would have to determined by someone who works on that port specifically. 19 20 * loader/DocumentLoader.h: 21 (WebCore::DocumentLoader::didTellClientAboutLoad): 22 (WebCore::DocumentLoader::haveToldClientAboutLoad): 23 1 24 2011-06-02 Aparna Nandyal <aparna.nand@wipro.com> 2 25 -
trunk/Source/WebCore/loader/DocumentLoader.h
r87189 r87901 225 225 bool deferMainResourceDataLoad() const { return m_deferMainResourceDataLoad; } 226 226 227 #if PLATFORM(MAC) 227 228 void didTellClientAboutLoad(const String& url) 228 { 229 { 229 230 if (!url.isEmpty()) 230 231 m_resourcesClientKnowsAbout.add(url); 231 232 } 232 bool haveToldClientAboutLoad(const String& url) { return m_resourcesClientKnowsAbout.contains(url); } 233 bool haveToldClientAboutLoad(const String& url) 234 { 235 return m_resourcesClientKnowsAbout.contains(url); 236 } 237 #endif 238 233 239 void recordMemoryCacheLoadForFutureClientNotification(const String& url); 234 240 void takeMemoryCacheLoadsForClientNotification(Vector<String>& loads); … … 329 335 #endif 330 336 337 #if PLATFORM(MAC) 331 338 HashSet<String> m_resourcesClientKnowsAbout; 339 #endif 332 340 Vector<String> m_resourcesLoadedFromMemoryCacheForClientNotification; 333 341 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r87634 r87901 3142 3142 return; 3143 3143 3144 if (!resource->sendResourceLoadCallbacks() || m_documentLoader->haveToldClientAboutLoad(resource->url())) 3145 return; 3144 if (!resource->sendResourceLoadCallbacks()) 3145 return; 3146 3147 #if PLATFORM(MAC) 3148 if (m_documentLoader->haveToldClientAboutLoad(resource->url())) 3149 return; 3150 #endif 3146 3151 3147 3152 if (!page->areMemoryCacheClientCallsEnabled()) { 3148 3153 InspectorInstrumentation::didLoadResourceFromMemoryCache(page, m_documentLoader.get(), resource); 3149 3154 m_documentLoader->recordMemoryCacheLoadForFutureClientNotification(resource->url()); 3155 #if PLATFORM(MAC) 3150 3156 m_documentLoader->didTellClientAboutLoad(resource->url()); 3157 #endif 3151 3158 return; 3152 3159 } … … 3155 3162 if (m_client->dispatchDidLoadResourceFromMemoryCache(m_documentLoader.get(), request, resource->response(), resource->encodedSize())) { 3156 3163 InspectorInstrumentation::didLoadResourceFromMemoryCache(page, m_documentLoader.get(), resource); 3164 #if PLATFORM(MAC) 3157 3165 m_documentLoader->didTellClientAboutLoad(resource->url()); 3166 #endif 3158 3167 return; 3159 3168 } -
trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp
r84260 r87901 108 108 void ResourceLoadNotifier::dispatchWillSendRequest(DocumentLoader* loader, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse) 109 109 { 110 #if PLATFORM(MAC) 110 111 StringImpl* oldRequestURL = request.url().string().impl(); 111 112 m_frame->loader()->documentLoader()->didTellClientAboutLoad(request.url()); 113 #endif 112 114 113 115 m_frame->loader()->client()->dispatchWillSendRequest(loader, identifier, request, redirectResponse); 114 116 117 #if PLATFORM(MAC) 115 118 // If the URL changed, then we want to put that new URL in the "did tell client" set too. 116 119 if (!request.isNull() && oldRequestURL != request.url().string().impl()) 117 120 m_frame->loader()->documentLoader()->didTellClientAboutLoad(request.url()); 121 #endif 118 122 119 123 InspectorInstrumentation::willSendRequest(m_frame, identifier, loader, request, redirectResponse);
Note: See TracChangeset
for help on using the changeset viewer.