Diff
Modified: trunk/Source/WTF/ChangeLog (131223 => 131224)
--- trunk/Source/WTF/ChangeLog 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WTF/ChangeLog 2012-10-12 21:25:57 UTC (rev 131224)
@@ -1,3 +1,18 @@
+2012-10-12 Anders Carlsson <[email protected]>
+
+ Move QDataStream functions into HistoryItemQt.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=99203
+
+ Reviewed by Andreas Kling.
+
+ It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+ inside WebCore, so move them there. If in the future they are required elsewhere, they should
+ be moved into a separate header instead of polluting headers unnecessarily.
+
+ * wtf/Vector.h:
+ * wtf/qt/StringQt.cpp:
+ * wtf/text/WTFString.h:
+
2012-10-11 Mark Toller <[email protected]>
Removed incorrect pthread_mutex_trylock code in an ASSERT in TCMalloc_PageHeap::signalScavenger. This
Modified: trunk/Source/WTF/wtf/Vector.h (131223 => 131224)
--- trunk/Source/WTF/wtf/Vector.h 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WTF/wtf/Vector.h 2012-10-12 21:25:57 UTC (rev 131224)
@@ -32,10 +32,6 @@
#include <limits>
#include <utility>
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
namespace WTF {
using std::min;
@@ -695,32 +691,6 @@
Buffer m_buffer;
};
-#if PLATFORM(QT)
- template<typename T>
- QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
- {
- stream << qint64(data.size());
- foreach (const T& i, data)
- stream << i;
- return stream;
- }
-
- template<typename T>
- QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
- {
- data.clear();
- qint64 count;
- T item;
- stream >> count;
- data.reserveCapacity(count);
- for (qint64 i = 0; i < count; ++i) {
- stream >> item;
- data.append(item);
- }
- return stream;
- }
-#endif
-
template<typename T, size_t inlineCapacity>
Vector<T, inlineCapacity>::Vector(const Vector& other)
: m_size(other.size())
Modified: trunk/Source/WTF/wtf/qt/StringQt.cpp (131223 => 131224)
--- trunk/Source/WTF/wtf/qt/StringQt.cpp 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WTF/wtf/qt/StringQt.cpp 2012-10-12 21:25:57 UTC (rev 131224)
@@ -70,22 +70,6 @@
return QString(reinterpret_cast<const QChar*>(characters()), length());
}
-QDataStream& operator<<(QDataStream& stream, const String& str)
-{
- // could be faster
- stream << QString(str);
- return stream;
}
-QDataStream& operator>>(QDataStream& stream, String& str)
-{
- // mabe not the fastest way, but really easy
- QString tmp;
- stream >> tmp;
- str = tmp;
- return stream;
-}
-
-}
-
// vim: ts=4 sw=4 et
Modified: trunk/Source/WTF/wtf/text/WTFString.h (131223 => 131224)
--- trunk/Source/WTF/wtf/text/WTFString.h 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2012-10-12 21:25:57 UTC (rev 131224)
@@ -40,7 +40,6 @@
QT_BEGIN_NAMESPACE
class QString;
QT_END_NAMESPACE
-#include <QDataStream>
#endif
#if PLATFORM(WX)
@@ -465,11 +464,6 @@
RefPtr<StringImpl> m_impl;
};
-#if PLATFORM(QT)
-QDataStream& operator<<(QDataStream& stream, const String& str);
-QDataStream& operator>>(QDataStream& stream, String& str);
-#endif
-
inline bool operator==(const String& a, const String& b) { return equal(a.impl(), b.impl()); }
inline bool operator==(const String& a, const LChar* b) { return equal(a.impl(), b); }
inline bool operator==(const String& a, const char* b) { return equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
Modified: trunk/Source/WebCore/ChangeLog (131223 => 131224)
--- trunk/Source/WebCore/ChangeLog 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WebCore/ChangeLog 2012-10-12 21:25:57 UTC (rev 131224)
@@ -1,3 +1,20 @@
+2012-10-12 Anders Carlsson <[email protected]>
+
+ Move QDataStream functions into HistoryItemQt.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=99203
+
+ Reviewed by Andreas Kling.
+
+ It seems like the QDataStream stream operators are only used from HistoryItemQt.cpp
+ inside WebCore, so move them there. If in the future they are required elsewhere, they should
+ be moved into a separate header instead of polluting headers unnecessarily.
+
+ * history/qt/HistoryItemQt.cpp:
+ (operator<<):
+ (operator>>):
+ * platform/FractionalLayoutUnit.h:
+ * platform/graphics/IntPoint.h:
+
2012-10-12 Beth Dakin <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=99204
Modified: trunk/Source/WebCore/history/qt/HistoryItemQt.cpp (131223 => 131224)
--- trunk/Source/WebCore/history/qt/HistoryItemQt.cpp 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WebCore/history/qt/HistoryItemQt.cpp 2012-10-12 21:25:57 UTC (rev 131224)
@@ -23,6 +23,79 @@
#include "FormData.h"
#include <wtf/text/CString.h>
+static QDataStream& operator<<(QDataStream& stream, const FractionalLayoutUnit& value)
+{
+ if (kFixedPointDenominator == 1)
+ stream << value.rawValue();
+ else
+ stream << QString::fromLatin1("%1").arg(value.toFloat(), 0, 'f', 2);
+
+ return stream;
+}
+
+static QDataStream& operator>>(QDataStream& stream, FractionalLayoutUnit& value)
+{
+ float v;
+ stream >> v;
+ value = v;
+ return stream;
+}
+
+static QDataStream& operator<<(QDataStream& stream, const IntPoint& point)
+{
+ stream << point.x() << point.y();
+ return stream;
+}
+
+static QDataStream& operator>>(QDataStream& stream, IntPoint& point)
+{
+ int x, y;
+ stream >> x >> y;
+ point.setX(x);
+ point.setY(y);
+ return stream;
+}
+
+static QDataStream& operator<<(QDataStream& stream, const String& str)
+{
+ // could be faster
+ stream << QString(str);
+ return stream;
+}
+
+static QDataStream& operator>>(QDataStream& stream, String& str)
+{
+ // mabe not the fastest way, but really easy
+ QString tmp;
+ stream >> tmp;
+ str = tmp;
+ return stream;
+}
+
+template<typename T>
+QDataStream& operator<<(QDataStream& stream, const Vector<T>& data)
+{
+ stream << qint64(data.size());
+ foreach (const T& i, data)
+ stream << i;
+ return stream;
+}
+
+template<typename T>
+QDataStream& operator>>(QDataStream& stream, Vector<T>& data)
+{
+ data.clear();
+ qint64 count;
+ T item;
+ stream >> count;
+ data.reserveCapacity(count);
+ for (qint64 i = 0; i < count; ++i) {
+ stream >> item;
+ data.append(item);
+ }
+ return stream;
+}
+
bool WebCore::HistoryItem::restoreState(QDataStream& in, int version)
{
// we only support version 1 for now
Modified: trunk/Source/WebCore/platform/FractionalLayoutUnit.h (131223 => 131224)
--- trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WebCore/platform/FractionalLayoutUnit.h 2012-10-12 21:25:57 UTC (rev 131224)
@@ -38,10 +38,6 @@
#include <wtf/MathExtras.h>
#include <wtf/SaturatedArithmetic.h>
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
namespace WebCore {
#ifdef NDEBUG
@@ -824,26 +820,6 @@
return (fraction + size).round() - fraction.round();
}
-#if PLATFORM(QT)
-inline QDataStream& operator<<(QDataStream& stream, const FractionalLayoutUnit& value)
-{
- if (kFixedPointDenominator == 1)
- stream << value.rawValue();
- else
- stream << QString::fromLatin1("%1").arg(value.toFloat(), 0, 'f', 2);
-
- return stream;
-}
-
-inline QDataStream& operator>>(QDataStream& stream, FractionalLayoutUnit& value)
-{
- float v;
- stream >> v;
- value = v;
- return stream;
-}
-#endif
-
} // namespace WebCore
#endif // FractionalLayoutUnit_h
Modified: trunk/Source/WebCore/platform/graphics/IntPoint.h (131223 => 131224)
--- trunk/Source/WebCore/platform/graphics/IntPoint.h 2012-10-12 21:01:31 UTC (rev 131223)
+++ trunk/Source/WebCore/platform/graphics/IntPoint.h 2012-10-12 21:25:57 UTC (rev 131224)
@@ -29,10 +29,6 @@
#include "IntSize.h"
#include <wtf/MathExtras.h>
-#if PLATFORM(QT)
-#include <QDataStream>
-#endif
-
#if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
typedef struct CGPoint CGPoint;
#endif
@@ -229,23 +225,6 @@
return ((*this) - point).diagonalLengthSquared();
}
-#if PLATFORM(QT)
-inline QDataStream& operator<<(QDataStream& stream, const IntPoint& point)
-{
- stream << point.x() << point.y();
- return stream;
-}
-
-inline QDataStream& operator>>(QDataStream& stream, IntPoint& point)
-{
- int x, y;
- stream >> x >> y;
- point.setX(x);
- point.setY(y);
- return stream;
-}
-#endif
-
} // namespace WebCore
#endif // IntPoint_h