Title: [124006] trunk/Source
- Revision
- 124006
- Author
- yu...@chromium.org
- Date
- 2012-07-30 02:05:11 -0700 (Mon, 30 Jul 2012)
Log Message
Web Inspector: move StringImpl size calculation to StringImpl
https://bugs.webkit.org/show_bug.cgi?id=92359
Reviewed by Pavel Feldman.
Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to
StringImpl::sizeInBytes();
Source/WebCore:
* inspector/InspectorMemoryAgent.cpp:
(WebCore):
Source/WTF:
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::sizeInBytes):
(WTF):
* wtf/text/StringImpl.h:
(StringImpl):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (124005 => 124006)
--- trunk/Source/WTF/ChangeLog 2012-07-30 08:57:44 UTC (rev 124005)
+++ trunk/Source/WTF/ChangeLog 2012-07-30 09:05:11 UTC (rev 124006)
@@ -1,3 +1,19 @@
+2012-07-26 Yury Semikhatsky <yu...@chromium.org>
+
+ Web Inspector: move StringImpl size calculation to StringImpl
+ https://bugs.webkit.org/show_bug.cgi?id=92359
+
+ Reviewed by Pavel Feldman.
+
+ Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to
+ StringImpl::sizeInBytes();
+
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::sizeInBytes):
+ (WTF):
+ * wtf/text/StringImpl.h:
+ (StringImpl):
+
2012-07-28 Patrick Gansterer <par...@webkit.org>
[WIN] Add missing export macro to friend decleration.
Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (124005 => 124006)
--- trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-07-30 08:57:44 UTC (rev 124005)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-07-30 09:05:11 UTC (rev 124006)
@@ -1693,4 +1693,19 @@
return terminatedString.release();
}
+size_t StringImpl::sizeInBytes() const
+{
+ // FIXME: support substrings
+ size_t size = length();
+ if (is8Bit()) {
+ if (has16BitShadow()) {
+ size += 2 * size;
+ if (hasTerminatingNullCharacter())
+ size += 2;
+ }
+ } else
+ size *= 2;
+ return size + sizeof(*this);
+}
+
} // namespace WTF
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (124005 => 124006)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2012-07-30 08:57:44 UTC (rev 124005)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2012-07-30 09:05:11 UTC (rev 124006)
@@ -385,6 +385,8 @@
return m_length;
}
+ WTF_EXPORT_PRIVATE size_t sizeInBytes() const;
+
bool has16BitShadow() const { return m_hashAndFlags & s_hashFlagHas16BitShadow; }
WTF_EXPORT_PRIVATE void upconvertCharacters(unsigned, unsigned) const;
bool isIdentifier() const { return m_hashAndFlags & s_hashFlagIsIdentifier; }
Modified: trunk/Source/WebCore/ChangeLog (124005 => 124006)
--- trunk/Source/WebCore/ChangeLog 2012-07-30 08:57:44 UTC (rev 124005)
+++ trunk/Source/WebCore/ChangeLog 2012-07-30 09:05:11 UTC (rev 124006)
@@ -1,3 +1,16 @@
+2012-07-26 Yury Semikhatsky <yu...@chromium.org>
+
+ Web Inspector: move StringImpl size calculation to StringImpl
+ https://bugs.webkit.org/show_bug.cgi?id=92359
+
+ Reviewed by Pavel Feldman.
+
+ Moved stringSize(StringImpl*) implementation from InspectorMemoryAgent to
+ StringImpl::sizeInBytes();
+
+ * inspector/InspectorMemoryAgent.cpp:
+ (WebCore):
+
2012-07-30 Pavel Feldman <pfeld...@chromium.org>
Web Inspector: workers inspector is broken in the remote debugging mode
Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (124005 => 124006)
--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-07-30 08:57:44 UTC (rev 124005)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-07-30 09:05:11 UTC (rev 124006)
@@ -110,21 +110,6 @@
return node->nodeName().lower();
}
-size_t stringSize(StringImpl* string)
-{
- // FIXME: support substrings
- size_t size = string->length();
- if (string->is8Bit()) {
- if (string->has16BitShadow()) {
- size += 2 * size;
- if (string->hasTerminatingNullCharacter())
- size += 2;
- }
- } else
- size *= 2;
- return size + sizeof(*string);
-}
-
typedef HashSet<StringImpl*, PtrHash<StringImpl*> > StringImplIdentitySet;
class CharacterDataStatistics {
@@ -143,7 +128,7 @@
return;
m_domStringImplSet.add(dataImpl);
- m_characterDataSize += stringSize(dataImpl);
+ m_characterDataSize += dataImpl->sizeInBytes();
}
bool contains(StringImpl* s) { return m_domStringImplSet.contains(s); }
@@ -288,7 +273,7 @@
virtual void visitJSExternalString(StringImpl* string)
{
- int size = stringSize(string);
+ int size = string->sizeInBytes();
m_jsExternalStringSize += size;
if (m_characterDataStatistics.contains(string))
m_sharedStringSize += size;
@@ -352,7 +337,7 @@
virtual void visitJSExternalString(StringImpl* string)
{
if (m_visitedObjects.add(string).isNewEntry)
- m_jsExternalStringSize += stringSize(string);
+ m_jsExternalStringSize += string->sizeInBytes();
}
VisitedObjects& m_visitedObjects;
@@ -504,7 +489,7 @@
{
if (string.isNull() || visited(string.impl()))
return;
- countObjectSize(objectType, stringSize(string.impl()));
+ countObjectSize(objectType, string.impl()->sizeInBytes());
}
virtual void countObjectSize(ObjectType objectType, size_t size) OVERRIDE
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes