Title: [159279] trunk/Source
- Revision
- 159279
- Author
- [email protected]
- Date
- 2013-11-14 03:01:42 -0800 (Thu, 14 Nov 2013)
Log Message
FontDescription copies should share families list, not duplicate it.
<https://webkit.org/b/124338>
Source/WebCore:
Turn FontDescription::m_families into a RefCountedArray<AtomicString>
instead of a Vector<AtomicString, 1>. This allows FontDescription to
share the families list between copies, instead of each object having
its own Vector.
Also, FontDescription itself shrinks by 16 bytes.
Reviewed by Antti Koivisto.
Source/WTF:
Add RefCountedArray::operator==.
Reviewed by Antti Koivisto.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (159278 => 159279)
--- trunk/Source/WTF/ChangeLog 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WTF/ChangeLog 2013-11-14 11:01:42 UTC (rev 159279)
@@ -1,3 +1,12 @@
+2013-11-14 Andreas Kling <[email protected]>
+
+ FontDescription copies should share families list, not duplicate it.
+ <https://webkit.org/b/124338>
+
+ Add RefCountedArray::operator==.
+
+ Reviewed by Antti Koivisto.
+
2013-11-13 Anders Carlsson <[email protected]>
Add a Vector constructor that takes an std::initializer_list
Modified: trunk/Source/WTF/wtf/RefCountedArray.h (159278 => 159279)
--- trunk/Source/WTF/wtf/RefCountedArray.h 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WTF/wtf/RefCountedArray.h 2013-11-14 11:01:42 UTC (rev 159279)
@@ -155,6 +155,22 @@
T& operator[](size_t i) { return at(i); }
const T& operator[](size_t i) const { return at(i); }
+
+ bool operator==(const RefCountedArray& other) const
+ {
+ if (m_data == other.m_data)
+ return true;
+ if (!m_data || !other.m_data)
+ return false;
+ unsigned length = Header::fromPayload(m_data)->length;
+ if (length != Header::fromPayload(other.m_data)->length)
+ return false;
+ for (unsigned i = 0; i < length; ++i) {
+ if (m_data[i] != other.m_data[i])
+ return false;
+ }
+ return true;
+ }
private:
struct Header {
Modified: trunk/Source/WebCore/ChangeLog (159278 => 159279)
--- trunk/Source/WebCore/ChangeLog 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WebCore/ChangeLog 2013-11-14 11:01:42 UTC (rev 159279)
@@ -1,3 +1,17 @@
+2013-11-14 Andreas Kling <[email protected]>
+
+ FontDescription copies should share families list, not duplicate it.
+ <https://webkit.org/b/124338>
+
+ Turn FontDescription::m_families into a RefCountedArray<AtomicString>
+ instead of a Vector<AtomicString, 1>. This allows FontDescription to
+ share the families list between copies, instead of each object having
+ its own Vector.
+
+ Also, FontDescription itself shrinks by 16 bytes.
+
+ Reviewed by Antti Koivisto.
+
2013-11-14 Gyuyoung Kim <[email protected]>
Introduce FILTER_TYPE_CASTS for child filter class
Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (159278 => 159279)
--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp 2013-11-14 11:01:42 UTC (rev 159279)
@@ -710,7 +710,7 @@
bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
fontDescription.setGenericFamily(FontDescription::NoFamily);
- Vector<AtomicString, 1> families;
+ Vector<AtomicString> families;
families.reserveInitialCapacity(valueList.length());
for (unsigned i = 0; i < valueList.length(); ++i) {
@@ -764,7 +764,7 @@
if (families.isEmpty())
return;
- fontDescription.adoptFamilies(families);
+ fontDescription.setFamilies(families);
if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
styleResolver->setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, !oldFamilyUsedFixedDefaultSize, styleResolver->document()));
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.cpp (159278 => 159279)
--- trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2013-11-14 11:01:42 UTC (rev 159279)
@@ -33,8 +33,7 @@
namespace WebCore {
struct SameSizeAsFontDescription {
- Vector<AtomicString, 1> families;
- RefPtr<FontFeatureSettings> m_featureSettings;
+ void* pointers[2];
float sizes[2];
// FXIME: Make them fit into one word.
uint32_t bitfields;
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (159278 => 159279)
--- trunk/Source/WebCore/platform/graphics/FontDescription.h 2013-11-14 09:12:12 UTC (rev 159278)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h 2013-11-14 11:01:42 UTC (rev 159279)
@@ -35,7 +35,7 @@
#include "TextRenderingMode.h"
#include "WebKitFontFamilyNames.h"
#include <wtf/MathExtras.h>
-
+#include <wtf/RefCountedArray.h>
#include <wtf/RefPtr.h>
namespace WebCore {
@@ -107,7 +107,7 @@
unsigned familyCount() const { return m_families.size(); }
const AtomicString& firstFamily() const { return familyAt(0); }
const AtomicString& familyAt(unsigned i) const { return m_families[i]; }
- const Vector<AtomicString, 1>& families() const { return m_families; }
+ const RefCountedArray<AtomicString>& families() const { return m_families; }
float specifiedSize() const { return m_specifiedSize; }
float computedSize() const { return m_computedSize; }
@@ -141,8 +141,8 @@
FontDescription makeNormalFeatureSettings() const;
void setOneFamily(const AtomicString& family) { ASSERT(m_families.size() == 1); m_families[0] = family; }
- void setFamilies(const Vector<AtomicString, 1>& families) { m_families = families; }
- void adoptFamilies(Vector<AtomicString, 1>& families) { m_families.swap(families); }
+ void setFamilies(const Vector<AtomicString>& families) { m_families = RefCountedArray<AtomicString>(families); }
+ void setFamilies(const RefCountedArray<AtomicString>& families) { m_families = families; }
void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
void setSpecifiedSize(float s) { m_specifiedSize = clampToFloat(s); }
void setItalic(FontItalic i) { m_italic = i; }
@@ -183,7 +183,7 @@
#endif
private:
- Vector<AtomicString, 1> m_families;
+ RefCountedArray<AtomicString> m_families;
RefPtr<FontFeatureSettings> m_featureSettings;
float m_specifiedSize; // Specified CSS value. Independent of rendering issues such as integer
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes