Title: [138174] trunk/Source/WebCore
Revision
138174
Author
jap...@chromium.org
Date
2012-12-19 09:38:48 -0800 (Wed, 19 Dec 2012)

Log Message

REGRESSION(r137607): PluginDocument loads consume huge amounts of memory
https://bugs.webkit.org/show_bug.cgi?id=105359

Reviewed by Alexey Proskuryakov.

No new tests, verified manually that http://www.scb.se/statistik/_publikationer/NR0001_2012K02_TI_A28TI1203.pdf
no longer consumes several GB of memory.

* loader/ResourceLoader.cpp:
(WebCore::ResourceLoader::setShouldBufferData): shouldBufferData is an enum, not a boolean, so this is reversed.
* loader/cache/CachedRawResource.cpp:
(WebCore::CachedRawResource::data): If the dataReceived() callback tells us to stop buffering data, be sure to
    notify the ResourceLoader and clear the data buffer.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138173 => 138174)


--- trunk/Source/WebCore/ChangeLog	2012-12-19 17:23:03 UTC (rev 138173)
+++ trunk/Source/WebCore/ChangeLog	2012-12-19 17:38:48 UTC (rev 138174)
@@ -1,3 +1,19 @@
+2012-12-19  Nate Chapin  <jap...@chromium.org>
+
+        REGRESSION(r137607): PluginDocument loads consume huge amounts of memory
+        https://bugs.webkit.org/show_bug.cgi?id=105359
+
+        Reviewed by Alexey Proskuryakov.
+
+        No new tests, verified manually that http://www.scb.se/statistik/_publikationer/NR0001_2012K02_TI_A28TI1203.pdf
+        no longer consumes several GB of memory.
+
+        * loader/ResourceLoader.cpp:
+        (WebCore::ResourceLoader::setShouldBufferData): shouldBufferData is an enum, not a boolean, so this is reversed.
+        * loader/cache/CachedRawResource.cpp:
+        (WebCore::CachedRawResource::data): If the dataReceived() callback tells us to stop buffering data, be sure to
+            notify the ResourceLoader and clear the data buffer.
+
 2012-12-19  Gavin Peters  <gav...@chromium.org>
 
         [chromium] WebCore::Prerender::didStartPrerender depends on LinkLoader

Modified: trunk/Source/WebCore/loader/ResourceLoader.cpp (138173 => 138174)


--- trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-12-19 17:23:03 UTC (rev 138173)
+++ trunk/Source/WebCore/loader/ResourceLoader.cpp	2012-12-19 17:38:48 UTC (rev 138174)
@@ -194,7 +194,7 @@
     m_options.shouldBufferData = shouldBufferData; 
 
     // Reset any already buffered data
-    if (!shouldBufferData)
+    if (shouldBufferData == DoNotBufferData)
         m_resourceData = 0;
 }
     

Modified: trunk/Source/WebCore/loader/cache/CachedRawResource.cpp (138173 => 138174)


--- trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-12-19 17:23:03 UTC (rev 138173)
+++ trunk/Source/WebCore/loader/cache/CachedRawResource.cpp	2012-12-19 17:38:48 UTC (rev 138174)
@@ -56,19 +56,26 @@
         incrementalData = data->data() + previousDataLength;
         incrementalDataLength = data->size() - previousDataLength;
     }
-    
+
     if (m_options.shouldBufferData == BufferData) {
         if (data)
             setEncodedSize(data->size());
         m_data = data;
     }
-    
+
+    DataBufferingPolicy dataBufferingPolicy = m_options.shouldBufferData;
     if (incrementalDataLength) {
         CachedResourceClientWalker<CachedRawResourceClient> w(m_clients);
         while (CachedRawResourceClient* c = w.next())
             c->dataReceived(this, incrementalData, incrementalDataLength);
     }
     CachedResource::data(m_data, allDataReceived);
+
+    if (dataBufferingPolicy == BufferData && m_options.shouldBufferData == DoNotBufferData) {
+        if (m_loader)
+            m_loader->setShouldBufferData(DoNotBufferData);
+        clear();
+    }
 }
 
 void CachedRawResource::didAddClient(CachedResourceClient* c)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to