Diff
Modified: trunk/Source/WTF/ChangeLog (149582 => 149583)
--- trunk/Source/WTF/ChangeLog 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WTF/ChangeLog 2013-05-06 04:10:14 UTC (rev 149583)
@@ -1,5 +1,22 @@
2013-05-05 Anders Carlsson <ander...@apple.com>
+ Remove Vector::prepend
+ https://bugs.webkit.org/show_bug.cgi?id=115618
+
+ Reviewed by Geoffrey Garen.
+
+ Given the performance characteristics of prepending something to a Vector, not having prepend
+ will hopefully make developers think about whether prepending is necessary at all. For example,
+ the functions in HexNumber.h were easily converted to using Vector::append and then Vector::reverse.
+
+ * wtf/HexNumber.h:
+ (WTF::appendUnsignedAsHex):
+ (WTF::appendUnsignedAsHexFixedSize):
+ * wtf/Vector.h:
+ (Vector):
+
+2013-05-05 Anders Carlsson <ander...@apple.com>
+
Remove the Vector::append overload that takes a Vector
https://bugs.webkit.org/show_bug.cgi?id=115535
Modified: trunk/Source/WTF/wtf/HexNumber.h (149582 => 149583)
--- trunk/Source/WTF/wtf/HexNumber.h 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WTF/wtf/HexNumber.h 2013-05-06 04:10:14 UTC (rev 149583)
@@ -71,10 +71,11 @@
const LChar* hexDigits = Internal::hexDigitsForMode(mode);
Vector<LChar, 8> result;
do {
- result.prepend(hexDigits[number % 16]);
+ result.append(hexDigits[number % 16]);
number >>= 4;
} while (number > 0);
+ result.reverse();
destination.append(result.data(), result.size());
}
@@ -87,11 +88,12 @@
const LChar* hexDigits = Internal::hexDigitsForMode(mode);
Vector<LChar, 8> result;
do {
- result.prepend(hexDigits[number % 16]);
+ result.append(hexDigits[number % 16]);
number >>= 4;
} while (result.size() < desiredDigits);
ASSERT(result.size() == desiredDigits);
+ result.reverse();
destination.append(result.data(), result.size());
}
Modified: trunk/Source/WTF/wtf/Vector.h (149582 => 149583)
--- trunk/Source/WTF/wtf/Vector.h 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WTF/wtf/Vector.h 2013-05-06 04:10:14 UTC (rev 149583)
@@ -627,10 +627,6 @@
template<typename U> void insert(size_t position, const U&);
template<typename U, size_t c> void insert(size_t position, const Vector<U, c>&);
- template<typename U> void prepend(const U*, size_t);
- template<typename U> void prepend(const U&);
- template<typename U, size_t c> void prepend(const Vector<U, c>&);
-
void remove(size_t position);
void remove(size_t position, size_t length);
@@ -1108,24 +1104,6 @@
insert(position, val.begin(), val.size());
}
- template<typename T, size_t inlineCapacity, typename OverflowHandler> template<typename U>
- void Vector<T, inlineCapacity, OverflowHandler>::prepend(const U* data, size_t dataSize)
- {
- insert(0, data, dataSize);
- }
-
- template<typename T, size_t inlineCapacity, typename OverflowHandler> template<typename U>
- inline void Vector<T, inlineCapacity, OverflowHandler>::prepend(const U& val)
- {
- insert(0, val);
- }
-
- template<typename T, size_t inlineCapacity, typename OverflowHandler> template<typename U, size_t c>
- inline void Vector<T, inlineCapacity, OverflowHandler>::prepend(const Vector<U, c>& val)
- {
- insert(0, val.begin(), val.size());
- }
-
template<typename T, size_t inlineCapacity, typename OverflowHandler>
inline void Vector<T, inlineCapacity, OverflowHandler>::remove(size_t position)
{
Modified: trunk/Source/WebCore/ChangeLog (149582 => 149583)
--- trunk/Source/WebCore/ChangeLog 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/ChangeLog 2013-05-06 04:10:14 UTC (rev 149583)
@@ -1,3 +1,34 @@
+2013-05-05 Anders Carlsson <ander...@apple.com>
+
+ Remove Vector::prepend
+ https://bugs.webkit.org/show_bug.cgi?id=115618
+
+ Reviewed by Geoffrey Garen.
+
+ Replace calls to Vector::prepend with either Vector::insert,
+ or a combination of Vector::append and Vector::reverse.
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::scrollToGlobalPoint):
+ * css/CSSGradientValue.cpp:
+ (WebCore::CSSGradientValue::addStops):
+ * css/CSSValueList.h:
+ (WebCore::CSSValueList::prepend):
+ * dom/Document.cpp:
+ (WebCore::Document::iconURLs):
+ * editing/TextIterator.cpp:
+ (WebCore::SearchBuffer::prependContext):
+ * editing/VisibleUnits.cpp:
+ (WebCore::previousBoundary):
+ (WebCore::nextBoundary):
+ * history/HistoryItem.cpp:
+ (WebCore::HistoryItem::padDailyCountsForNewVisit):
+ (WebCore::HistoryItem::collapseDailyVisitsToWeekly):
+ * inspector/InjectedScriptHost.cpp:
+ (WebCore::InjectedScriptHost::addInspectedObject):
+ * platform/graphics/SVGGlyph.cpp:
+ (WebCore::charactersWithArabicForm):
+
2013-05-05 Sam Weinig <s...@webkit.org>
Remove empty function SQLiteFileSystem::registerSQLiteVFS() and its callers
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (149582 => 149583)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -1768,13 +1768,15 @@
// Search up the parent chain and create a vector of all scrollable parent objects
// and ending with this object itself.
Vector<const AccessibilityObject*> objects;
- AccessibilityObject* parentObject;
- for (parentObject = this->parentObject(); parentObject; parentObject = parentObject->parentObject()) {
+
+ objects.append(this);
+ for (AccessibilityObject* parentObject = this->parentObject(); parentObject; parentObject = parentObject->parentObject()) {
if (parentObject->getScrollableAreaIfScrollable())
- objects.prepend(parentObject);
+ objects.append(parentObject);
}
- objects.append(this);
+ objects.reverse();
+
// Start with the outermost scrollable (the main window) and try to scroll the
// next innermost object to the given point.
int offsetX = 0, offsetY = 0;
Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (149582 => 149583)
--- trunk/Source/WebCore/css/CSSGradientValue.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -292,7 +292,7 @@
while (true) {
GradientStop newStop = stops[originalFirstStopIndex + srcStopOrdinal];
newStop.offset = currOffset;
- stops.prepend(newStop);
+ stops.insert(0, newStop);
++originalFirstStopIndex;
if (currOffset < 0)
break;
Modified: trunk/Source/WebCore/css/CSSValueList.h (149582 => 149583)
--- trunk/Source/WebCore/css/CSSValueList.h 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/css/CSSValueList.h 2013-05-06 04:10:14 UTC (rev 149583)
@@ -54,7 +54,7 @@
CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); }
void append(PassRefPtr<CSSValue> value) { m_values.append(value); }
- void prepend(PassRefPtr<CSSValue> value) { m_values.prepend(value); }
+ void prepend(PassRefPtr<CSSValue> value) { m_values.insert(0, value); }
bool removeAll(CSSValue*);
bool hasValue(CSSValue*) const;
PassRefPtr<CSSValueList> copy();
Modified: trunk/Source/WebCore/dom/Document.cpp (149582 => 149583)
--- trunk/Source/WebCore/dom/Document.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/dom/Document.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -4540,9 +4540,10 @@
// Put it at the front to ensure that icons seen later take precedence as required by the spec.
IconURL newURL(linkElement->href(), linkElement->iconSizes(), linkElement->type(), linkElement->iconType());
- m_iconURLs.prepend(newURL);
+ m_iconURLs.append(newURL);
}
+ m_iconURLs.reverse();
return m_iconURLs;
}
Modified: trunk/Source/WebCore/editing/TextIterator.cpp (149582 => 149583)
--- trunk/Source/WebCore/editing/TextIterator.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/editing/TextIterator.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -2035,7 +2035,7 @@
}
size_t usableLength = min(m_buffer.capacity() - m_prefixLength, length - wordBoundaryContextStart);
- m_buffer.prepend(characters + length - usableLength, usableLength);
+ m_buffer.insert(0, characters + length - usableLength, usableLength);
m_prefixLength += usableLength;
if (wordBoundaryContextStart || m_prefixLength == m_buffer.capacity())
Modified: trunk/Source/WebCore/editing/VisibleUnits.cpp (149582 => 149583)
--- trunk/Source/WebCore/editing/VisibleUnits.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/editing/VisibleUnits.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -491,12 +491,12 @@
while (!it.atEnd()) {
// iterate to get chunks until the searchFunction returns a non-zero value.
if (!inTextSecurityMode)
- string.prepend(it.characters(), it.length());
+ string.insert(0, it.characters(), it.length());
else {
// Treat bullets used in the text security mode as regular characters when looking for boundaries
String iteratorString(it.characters(), it.length());
iteratorString.fill('x');
- string.prepend(iteratorString.characters(), iteratorString.length());
+ string.insert(0, iteratorString.characters(), iteratorString.length());
}
next = searchFunction(string.data(), string.size(), string.size() - suffixLength, MayHaveMoreContext, needMoreContext);
if (next > 1) // FIXME: This is a work around for https://webkit.org/b/115070. We need to provide more contexts in general case.
@@ -547,7 +547,7 @@
const UChar* characters = backwardsIterator.characters();
int length = backwardsIterator.length();
int i = startOfLastWordBoundaryContext(characters, length);
- string.prepend(characters + i, length - i);
+ string.insert(0, characters + i, length - i);
prefixLength += length - i;
if (i > 0)
break;
Modified: trunk/Source/WebCore/history/HistoryItem.cpp (149582 => 149583)
--- trunk/Source/WebCore/history/HistoryItem.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/history/HistoryItem.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -327,7 +327,7 @@
void HistoryItem::padDailyCountsForNewVisit(double time)
{
if (m_dailyVisitCounts.isEmpty())
- m_dailyVisitCounts.prepend(m_visitCount);
+ m_dailyVisitCounts.insert(0, m_visitCount);
int daysElapsed = timeToDay(time) - timeToDay(m_lastVisitedTime);
@@ -336,7 +336,7 @@
Vector<int> padding;
padding.fill(0, daysElapsed);
- m_dailyVisitCounts.prepend(padding);
+ m_dailyVisitCounts.insert(0, padding);
}
static const size_t daysPerWeek = 7;
@@ -350,7 +350,7 @@
for (size_t i = 0; i < daysPerWeek; i++)
oldestWeekTotal += m_dailyVisitCounts[m_dailyVisitCounts.size() - daysPerWeek + i];
m_dailyVisitCounts.shrink(m_dailyVisitCounts.size() - daysPerWeek);
- m_weeklyVisitCounts.prepend(oldestWeekTotal);
+ m_weeklyVisitCounts.insert(0, oldestWeekTotal);
}
if (m_weeklyVisitCounts.size() > maxWeeklyCounts)
Modified: trunk/Source/WebCore/inspector/InjectedScriptHost.cpp (149582 => 149583)
--- trunk/Source/WebCore/inspector/InjectedScriptHost.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/inspector/InjectedScriptHost.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -130,7 +130,7 @@
void InjectedScriptHost::addInspectedObject(PassOwnPtr<InjectedScriptHost::InspectableObject> object)
{
- m_inspectedObjects.prepend(object);
+ m_inspectedObjects.insert(0, object);
while (m_inspectedObjects.size() > 5)
m_inspectedObjects.removeLast();
}
Modified: trunk/Source/WebCore/platform/graphics/SVGGlyph.cpp (149582 => 149583)
--- trunk/Source/WebCore/platform/graphics/SVGGlyph.cpp 2013-05-06 00:22:54 UTC (rev 149582)
+++ trunk/Source/WebCore/platform/graphics/SVGGlyph.cpp 2013-05-06 04:10:14 UTC (rev 149583)
@@ -101,7 +101,7 @@
// Start identifying arabic forms
if (rtl) {
for (int i = length - 1; i >= 0; --i)
- forms.prepend(processArabicFormDetection(input[i], lastCharShapesRight, forms.isEmpty() ? 0 : &forms.first()));
+ forms.insert(0, processArabicFormDetection(input[i], lastCharShapesRight, forms.isEmpty() ? 0 : &forms.first()));
} else {
for (unsigned i = 0; i < length; ++i)
forms.append(processArabicFormDetection(input[i], lastCharShapesRight, forms.isEmpty() ? 0 : &forms.last()));