Diff
Modified: trunk/Source/WebCore/ChangeLog (124451 => 124452)
--- trunk/Source/WebCore/ChangeLog 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/ChangeLog 2012-08-02 14:14:58 UTC (rev 124452)
@@ -1,5 +1,46 @@
2012-08-02 Alexei Filippov <[email protected]>
+ Web Inspector: count RenderStyle objects in the native memory profiler
+ https://bugs.webkit.org/show_bug.cgi?id=91759
+
+ Reviewed by Yury Semikhatsky.
+
+ The patch adds instrumentation to the following classes:
+ - RenderStyle
+ - StyleRareInheritedData
+ - StyleRareNonInheritedData
+
+ * bindings/js/ScriptWrappable.h:
+ * bindings/v8/ScriptWrappable.h:
+ * dom/MemoryInstrumentation.h:
+ (WebCore):
+ (WebCore::MemoryInstrumentation::OwningTraits::addObject):
+ (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
+ (WebCore::MemoryInstrumentation::addObjectImpl):
+ * dom/Node.cpp:
+ (WebCore::Node::reportMemoryUsage):
+ * dom/Node.h:
+ (WebCore):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::reportMemoryUsage):
+ (WebCore):
+ * rendering/style/RenderStyle.h:
+ (WebCore):
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::reportMemoryUsage):
+ (WebCore):
+ * rendering/style/StyleRareInheritedData.h:
+ (WebCore):
+ (StyleRareInheritedData):
+ * rendering/style/StyleRareNonInheritedData.cpp:
+ (WebCore::StyleRareNonInheritedData::reportMemoryUsage):
+ (WebCore):
+ * rendering/style/StyleRareNonInheritedData.h:
+ (WebCore):
+ (StyleRareNonInheritedData):
+
+2012-08-02 Alexei Filippov <[email protected]>
+
Web Inspector: rename host->origin in the inspector protocol DOMStorage entry
https://bugs.webkit.org/show_bug.cgi?id=92979
Modified: trunk/Source/WebCore/bindings/js/ScriptWrappable.h (124451 => 124452)
--- trunk/Source/WebCore/bindings/js/ScriptWrappable.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/bindings/js/ScriptWrappable.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -32,6 +32,7 @@
#define ScriptWrappable_h
#include "JSDOMWrapper.h"
+#include "MemoryInstrumentation.h"
#include <heap/Weak.h>
namespace WebCore {
Modified: trunk/Source/WebCore/bindings/v8/ScriptWrappable.h (124451 => 124452)
--- trunk/Source/WebCore/bindings/v8/ScriptWrappable.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/bindings/v8/ScriptWrappable.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -31,6 +31,7 @@
#ifndef ScriptWrappable_h
#define ScriptWrappable_h
+#include "MemoryInstrumentation.h"
#include <v8.h>
namespace WebCore {
Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (124451 => 124452)
--- trunk/Source/WebCore/dom/MemoryInstrumentation.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -39,6 +39,7 @@
namespace WebCore {
+template <typename T> class DataRef;
class MemoryObjectInfo;
class MemoryInstrumentation {
@@ -111,20 +112,22 @@
template <typename T>
struct OwningTraits { // Default byReference implementation.
static void addInstrumentedObject(MemoryInstrumentation* instrumentation, const T& t) { instrumentation->addInstrumentedObjectImpl(&t, byReference); }
- static void addObject(MemoryInstrumentation* instrumentation, const T& t, MemoryInstrumentation::ObjectType objectType) { instrumentation->addObjectImpl(&t, objectType, byReference); }
+ static void addObject(MemoryInstrumentation* instrumentation, const T& t, ObjectType objectType) { instrumentation->addObjectImpl(&t, objectType, byReference); }
};
template <typename T>
struct OwningTraits<T*> { // Custom byPointer implementation.
static void addInstrumentedObject(MemoryInstrumentation* instrumentation, const T* const& t) { instrumentation->addInstrumentedObjectImpl(t, byPointer); }
- static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryInstrumentation::ObjectType objectType) { instrumentation->addObjectImpl(t, objectType, byPointer); }
+ static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, ObjectType objectType) { instrumentation->addObjectImpl(t, objectType, byPointer); }
};
template <typename T> void addInstrumentedObjectImpl(const T* const&, OwningType);
+ template <typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, OwningType);
template <typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, OwningType);
template <typename T> void addInstrumentedObjectImpl(const RefPtr<T>* const&, OwningType);
template <typename T> void addObjectImpl(const T* const&, ObjectType, OwningType);
+ template <typename T> void addObjectImpl(const DataRef<T>* const&, ObjectType, OwningType);
template <typename T> void addObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
template <typename T> void addObjectImpl(const RefPtr<T>* const&, ObjectType, OwningType);
};
@@ -207,6 +210,12 @@
}
template <typename T>
+void MemoryInstrumentation::addInstrumentedObjectImpl(const DataRef<T>* const& object, OwningType)
+{
+ addInstrumentedObjectImpl(object->get(), byPointer);
+}
+
+template <typename T>
void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, OwningType)
{
addInstrumentedObjectImpl(object->get(), byPointer);
@@ -219,6 +228,12 @@
}
template <typename T>
+void MemoryInstrumentation::addObjectImpl(const DataRef<T>* const& object, ObjectType objectType, OwningType)
+{
+ addObjectImpl(object->get(), objectType, byPointer);
+}
+
+template <typename T>
void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, ObjectType objectType, OwningType)
{
addObjectImpl(object->get(), objectType, byPointer);
Modified: trunk/Source/WebCore/dom/Node.cpp (124451 => 124452)
--- trunk/Source/WebCore/dom/Node.cpp 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/dom/Node.cpp 2012-08-02 14:14:58 UTC (rev 124452)
@@ -67,6 +67,7 @@
#include "KeyboardEvent.h"
#include "LabelsNodeList.h"
#include "Logging.h"
+#include "MemoryInstrumentation.h"
#include "MouseEvent.h"
#include "MutationEvent.h"
#include "NameNodeList.h"
@@ -2819,6 +2820,8 @@
info.addInstrumentedMember(m_document);
info.addInstrumentedMember(m_next);
info.addInstrumentedMember(m_previous);
+ if (m_renderer)
+ info.addInstrumentedMember(m_renderer->style());
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/Node.h (124451 => 124452)
--- trunk/Source/WebCore/dom/Node.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/dom/Node.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -29,7 +29,6 @@
#include "EventTarget.h"
#include "KURLHash.h"
#include "LayoutTypes.h"
-#include "MemoryInstrumentation.h"
#include "MutationObserver.h"
#include "RenderStyleConstants.h"
#include "ScriptWrappable.h"
@@ -66,6 +65,7 @@
class HTMLInputElement;
class IntRect;
class KeyboardEvent;
+class MemoryObjectInfo;
class NSResolver;
class NamedNodeMap;
class NameNodeList;
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2012-08-02 14:14:58 UTC (rev 124452)
@@ -28,6 +28,7 @@
#include "CSSPropertyNames.h"
#include "CSSWrapShapes.h"
#include "FontSelector.h"
+#include "MemoryInstrumentation.h"
#include "QuotesData.h"
#include "RenderArena.h"
#include "RenderObject.h"
@@ -1486,4 +1487,24 @@
NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()));
}
+void RenderStyle::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<RenderStyle> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addMember(m_box);
+ info.addMember(visual);
+ // FIXME: m_background contains RefPtr<StyleImage> that might need to be instrumented.
+ info.addMember(m_background);
+ // FIXME: surrond contains some fields e.g. BorderData that might need to be instrumented.
+ info.addMember(surround);
+ info.addInstrumentedMember(rareNonInheritedData);
+ info.addInstrumentedMember(rareInheritedData);
+ // FIXME: inherited contains StyleImage and Font fields that might need to be instrumented.
+ info.addMember(inherited);
+ if (m_cachedPseudoStyles)
+ info.addVectorPtr(m_cachedPseudoStyles.get());
+#if ENABLE(SVG)
+ info.addMember(m_svgStyle);
+#endif
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -105,6 +105,7 @@
class CounterContent;
class CursorList;
class IntRect;
+class MemoryObjectInfo;
class Pair;
class ShadowData;
class StyleImage;
@@ -1528,6 +1529,8 @@
void setHasExplicitlyInheritedProperties() { m_bitfields.setExplicitInheritance(true); }
bool hasExplicitlyInheritedProperties() const { return m_bitfields.explicitInheritance(); }
+
+ void reportMemoryUsage(MemoryObjectInfo*) const;
// Initial values for all the properties
static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2012-08-02 14:14:58 UTC (rev 124452)
@@ -23,6 +23,7 @@
#include "StyleRareInheritedData.h"
#include "CursorList.h"
+#include "MemoryInstrumentation.h"
#include "QuotesData.h"
#include "RenderStyle.h"
#include "RenderStyleConstants.h"
@@ -261,4 +262,20 @@
return true;
}
+void StyleRareInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<StyleRareInheritedData> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ info.addMember(textShadow);
+ info.addString(highlight);
+ info.addMember(cursorData);
+ info.addString(hyphenationString);
+ info.addString(locale);
+ info.addString(textEmphasisCustomMark);
+ info.addMember(quotes);
+ info.addString(m_lineGrid);
+#if ENABLE(CSS_VARIABLES)
+ info.addMember(m_variables);
+#endif
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -39,6 +39,7 @@
namespace WebCore {
class CursorList;
+class MemoryObjectInfo;
class QuotesData;
class ShadowData;
@@ -58,6 +59,8 @@
}
bool shadowDataEquivalent(const StyleRareInheritedData&) const;
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
Color textStrokeColor;
float textStrokeWidth;
Color textFillColor;
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp 2012-08-02 14:14:58 UTC (rev 124452)
@@ -23,6 +23,7 @@
#include "StyleRareNonInheritedData.h"
#include "ContentData.h"
+#include "MemoryInstrumentation.h"
#include "RenderCounter.h"
#include "RenderStyle.h"
#include "ShadowData.h"
@@ -286,4 +287,32 @@
return true;
}
+void StyleRareNonInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo<StyleRareNonInheritedData> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+#if ENABLE(DASHBOARD_SUPPORT)
+ info.addVector(m_dashboardRegions);
+#endif
+ info.addMember(m_deprecatedFlexibleBox);
+ info.addMember(m_flexibleBox);
+ info.addMember(m_marquee);
+ info.addMember(m_multiCol);
+ info.addMember(m_transform);
+#if ENABLE(CSS_FILTERS)
+ info.addMember(m_filter);
+#endif
+ info.addMember(m_grid);
+ info.addMember(m_gridItem);
+ info.addMember(m_content);
+ info.addMember(m_counterDirectives);
+ info.addMember(m_boxShadow);
+ info.addMember(m_boxReflect);
+ info.addMember(m_animations);
+ info.addMember(m_transitions);
+ info.addMember(m_wrapShapeInside);
+ info.addMember(m_wrapShapeOutside);
+ info.addString(m_flowThread);
+ info.addString(m_regionThread);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (124451 => 124452)
--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h 2012-08-02 14:14:58 UTC (rev 124452)
@@ -39,6 +39,7 @@
namespace WebCore {
class AnimationList;
+class MemoryObjectInfo;
class ShadowData;
class StyleDeprecatedFlexibleBoxData;
#if ENABLE(CSS_FILTERS)
@@ -89,6 +90,8 @@
bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
float opacity; // Whether or not we're transparent.
float m_aspectRatioDenominator;
Modified: trunk/Source/WebKit/chromium/ChangeLog (124451 => 124452)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-08-02 14:14:58 UTC (rev 124452)
@@ -1,3 +1,17 @@
+2012-08-02 Alexei Filippov <[email protected]>
+
+ Web Inspector: count RenderStyle objects in the native memory profiler
+ https://bugs.webkit.org/show_bug.cgi?id=91759
+
+ Reviewed by Yury Semikhatsky.
+
+ Add a test for DataRef<T> wrapped member instrumentation.
+
+ * tests/MemoryInstrumentationTest.cpp:
+ (WebCore::InstrumentedRefPtr::create):
+ (WebCore::TEST):
+ (WebCore):
+
2012-08-02 Peter Beverloo <[email protected]>
Unreviewed. Rolled DEPS.
Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (124451 => 124452)
--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-08-02 14:10:10 UTC (rev 124451)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-08-02 14:14:58 UTC (rev 124452)
@@ -30,6 +30,7 @@
#include "config.h"
+#include "DataRef.h"
#include "MemoryInstrumentationImpl.h"
#include <gtest/gtest.h>
@@ -115,6 +116,7 @@
public:
InstrumentedRefPtr() : m_notInstrumented(new NotInstrumented) { }
virtual ~InstrumentedRefPtr() { delete m_notInstrumented; }
+ static PassRefPtr<InstrumentedRefPtr> create() { return adoptRef(new InstrumentedRefPtr()); }
virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
@@ -124,6 +126,17 @@
NotInstrumented* m_notInstrumented;
};
+TEST(MemoryInstrumentationTest, dataRef)
+{
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ DataRef<InstrumentedRefPtr> instrumentedRefPtr;
+ instrumentedRefPtr.init();
+ impl.addRootObject(instrumentedRefPtr);
+ EXPECT_EQ(sizeof(InstrumentedRefPtr) + sizeof(NotInstrumented), impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+}
+
TEST(MemoryInstrumentationTest, refPtr)
{
VisitedObjects visitedObjects;