Title: [87647] branches/safari-534-branch/Source/WebCore

Diff

Modified: branches/safari-534-branch/Source/WebCore/ChangeLog (87646 => 87647)


--- branches/safari-534-branch/Source/WebCore/ChangeLog	2011-05-29 20:54:10 UTC (rev 87646)
+++ branches/safari-534-branch/Source/WebCore/ChangeLog	2011-05-29 20:54:14 UTC (rev 87647)
@@ -1,3 +1,30 @@
+2011-05-29  Mark Rowe  <[email protected]>
+
+        Merge r87639.
+
+    2011-05-29  Beth Dakin  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        https://bugs.webkit.org/show_bug.cgi?id=61700
+        Need WebKit2 API to get the size of the render tree
+        -and corresponding-
+        <rdar://problem/9512733>
+
+        New member variable on RenderArena keeps track of the current amount of memory 
+        allocated in the arena. The new client function sends this piece of data to 
+        WebKit.
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::setRenderTreeSize):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::performPostLayoutTasks):
+        * rendering/RenderArena.cpp:
+        (WebCore::RenderArena::RenderArena):
+        (WebCore::RenderArena::allocate):
+        (WebCore::RenderArena::free):
+        * rendering/RenderArena.h:
+        (WebCore::RenderArena::totalRenderArenaSize):
+
 2011-05-28  Mark Rowe  <[email protected]>
 
         Merge r87622.

Modified: branches/safari-534-branch/Source/WebCore/page/ChromeClient.h (87646 => 87647)


--- branches/safari-534-branch/Source/WebCore/page/ChromeClient.h	2011-05-29 20:54:10 UTC (rev 87646)
+++ branches/safari-534-branch/Source/WebCore/page/ChromeClient.h	2011-05-29 20:54:14 UTC (rev 87647)
@@ -323,6 +323,8 @@
         virtual void willRunModalDialogDuringPageDismissal(const DialogType&) const { }
 
         virtual void numWheelEventHandlersChanged(unsigned) = 0;
+
+        virtual void setRenderTreeSize(size_t) { }
         
     protected:
         virtual ~ChromeClient() { }

Modified: branches/safari-534-branch/Source/WebCore/page/FrameView.cpp (87646 => 87647)


--- branches/safari-534-branch/Source/WebCore/page/FrameView.cpp	2011-05-29 20:54:10 UTC (rev 87646)
+++ branches/safari-534-branch/Source/WebCore/page/FrameView.cpp	2011-05-29 20:54:14 UTC (rev 87647)
@@ -50,6 +50,7 @@
 #include "HTMLPlugInImageElement.h"
 #include "InspectorInstrumentation.h"
 #include "OverflowEvent.h"
+#include "RenderArena.h"
 #include "RenderEmbeddedObject.h"
 #include "RenderFullScreen.h"
 #include "RenderLayer.h"
@@ -2059,6 +2060,11 @@
         m_lastZoomFactor = currentZoomFactor;
         if (resized)
             m_frame->eventHandler()->sendResizeEvent();
+
+        if (Page* page = m_frame->page()) {
+            if (m_frame->page()->mainFrame() == m_frame)
+                page->chrome()->client()->setRenderTreeSize(m_frame->document()->renderArena()->totalRenderArenaSize());
+        }
     }
 }
 

Modified: branches/safari-534-branch/Source/WebCore/rendering/RenderArena.cpp (87646 => 87647)


--- branches/safari-534-branch/Source/WebCore/rendering/RenderArena.cpp	2011-05-29 20:54:10 UTC (rev 87646)
+++ branches/safari-534-branch/Source/WebCore/rendering/RenderArena.cpp	2011-05-29 20:54:14 UTC (rev 87647)
@@ -66,6 +66,8 @@
 
     // Zero out the recyclers array
     memset(m_recyclers, 0, sizeof(m_recyclers));
+
+    m_totalSize = 0;
 }
 
 RenderArena::~RenderArena()
@@ -75,6 +77,8 @@
 
 void* RenderArena::allocate(size_t size)
 {
+    m_totalSize += size;
+
 #ifndef NDEBUG
     // Use standard malloc so that memory debugging tools work.
     ASSERT(this);
@@ -113,6 +117,8 @@
 
 void RenderArena::free(size_t size, void* ptr)
 {
+    m_totalSize -= size;
+
 #ifndef NDEBUG
     // Use standard free so that memory debugging tools work.
     void* block = static_cast<char*>(ptr) - debugHeaderSize;

Modified: branches/safari-534-branch/Source/WebCore/rendering/RenderArena.h (87646 => 87647)


--- branches/safari-534-branch/Source/WebCore/rendering/RenderArena.h	2011-05-29 20:54:10 UTC (rev 87646)
+++ branches/safari-534-branch/Source/WebCore/rendering/RenderArena.h	2011-05-29 20:54:14 UTC (rev 87647)
@@ -53,6 +53,8 @@
     void* allocate(size_t);
     void free(size_t, void*);
 
+    size_t totalRenderArenaSize() const { return m_totalSize; }
+
 private:
     // Underlying arena pool
     ArenaPool m_pool;
@@ -60,6 +62,8 @@
     // The recycler array is sparse with the indices being multiples of 4,
     // i.e., 0, 4, 8, 12, 16, 20, ...
     void* m_recyclers[gMaxRecycledSize >> 2];
+
+    size_t m_totalSize;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to