Commit edaac513 authored by andersca@apple.com's avatar andersca@apple.com

Remove Qt code from WTF

https://bugs.webkit.org/show_bug.cgi?id=122221

Reviewed by Antti Koivisto.

I'm keeping the PLATFORM(QT) defines in Platform.h for now so we can assess if there are any
Qt only features that we can remove later.

* WTF.pri: Removed.
* WTF.pro: Removed.
* wtf/Assertions.cpp:
* wtf/CurrentTime.cpp:
* wtf/DisallowCType.h:
* wtf/FastMalloc.cpp:
* wtf/FeatureDefines.h:
* wtf/qt/MainThreadQt.cpp: Removed.
* wtf/qt/StringQt.cpp: Removed.
* wtf/text/AtomicString.h:
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.cpp:
(WTF::String::format):
* wtf/text/WTFString.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156775 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 13f82f8a
2013-10-02 Anders Carlsson <andersca@apple.com>
Remove Qt code from WTF
https://bugs.webkit.org/show_bug.cgi?id=122221
Reviewed by Antti Koivisto.
I'm keeping the PLATFORM(QT) defines in Platform.h for now so we can assess if there are any
Qt only features that we can remove later.
* WTF.pri: Removed.
* WTF.pro: Removed.
* wtf/Assertions.cpp:
* wtf/CurrentTime.cpp:
* wtf/DisallowCType.h:
* wtf/FastMalloc.cpp:
* wtf/FeatureDefines.h:
* wtf/qt/MainThreadQt.cpp: Removed.
* wtf/qt/StringQt.cpp: Removed.
* wtf/text/AtomicString.h:
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.cpp:
(WTF::String::format):
* wtf/text/WTFString.h:
2013-09-30 Sam Weinig <sam@webkit.org>
Remove support for DOMFileSystem
......
# -------------------------------------------------------------------
# This file contains shared rules used both when building WTF itself
# and for targets that depend in some way on WTF.
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------
# All external modules should include WTF headers by prefixing with "wtf" (#include <wtf/some/thing.h>).
INCLUDEPATH += $$PWD
mac {
# Mac OS does ship libicu but not the associated header files.
# Therefore WebKit provides adequate header files.
INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/WTF/icu
LIBS += -licucore
} else {
contains(QT_CONFIG,icu) {
win32: LIBS += -licuin -licuuc -licudt
else: LIBS += -licui18n -licuuc -licudata
}
}
linux-*:use?(GSTREAMER) {
DEFINES += WTF_USE_GLIB=1
PKGCONFIG += glib-2.0 gio-2.0
}
win32-* {
LIBS += -lwinmm
LIBS += -lgdi32
} else {
LIBS += -lz
}
qnx {
# required for timegm
LIBS += -lnbutil
}
mac {
LIBS += -framework AppKit
}
# MSVC is lacking stdint.h as well as inttypes.h.
win32-msvc*|win32-icc|wince*: INCLUDEPATH += $$ROOT_WEBKIT_DIR/Source/JavaScriptCore/os-win32
# -------------------------------------------------------------------
# Project file for WTF
#
# See 'Tools/qmake/README' for an overview of the build system
# -------------------------------------------------------------------
TEMPLATE = lib
TARGET = WTF
include(WTF.pri)
CONFIG += staticlib
VPATH += $$PWD/wtf
INCLUDEPATH += $$PWD/wtf
wince* {
# for mt19937ar.c
INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/ThirdParty
}
HEADERS += \
ASCIICType.h \
Assertions.h \
Atomics.h \
AVLTree.h \
Bitmap.h \
BitArray.h \
BitVector.h \
BloomFilter.h \
BoundsCheckedPointer.h \
BumpPointerAllocator.h \
ByteOrder.h \
CheckedArithmetic.h \
Compiler.h \
Compression.h \
CryptographicallyRandomNumber.h \
CurrentTime.h \
DateMath.h \
DecimalNumber.h \
Decoder.h \
DataLog.h \
Deque.h \
DisallowCType.h \
dtoa.h \
dtoa/bignum-dtoa.h \
dtoa/bignum.h \
dtoa/cached-powers.h \
dtoa/diy-fp.h \
dtoa/double-conversion.h \
dtoa/double.h \
dtoa/fast-dtoa.h \
dtoa/fixed-dtoa.h \
dtoa/strtod.h \
dtoa/utils.h \
DynamicAnnotations.h \
Encoder.h \
EnumClass.h \
ExportMacros.h \
FastMalloc.h \
FeatureDefines.h \
FilePrintStream.h \
FixedArray.h \
Forward.h \
FunctionDispatcher.h \
Functional.h \
GetPtr.h \
GregorianDateTime.h \
HashCountedSet.h \
HashFunctions.h \
HashIterators.h \
HashMap.h \
HashSet.h \
HashTable.h \
HashTraits.h \
HexNumber.h \
ListHashSet.h \
Locker.h \
MainThread.h \
MallocPtr.h \
MathExtras.h \
MD5.h \
MediaTime.h \
MessageQueue.h \
MetaAllocator.h \
MetaAllocatorHandle.h \
Ref.h \
Noncopyable.h \
NumberOfCores.h \
RAMSize.h \
OSAllocator.h \
OSRandomSource.h \
OwnPtr.h \
OwnPtrCommon.h \
PackedIntVector.h \
PageAllocation.h \
PageAllocationAligned.h \
PageBlock.h \
PageReservation.h \
ParallelJobs.h \
ParallelJobsGeneric.h \
ParallelJobsLibdispatch.h \
ParallelJobsOpenMP.h \
PassOwnPtr.h \
PassRefPtr.h \
Platform.h \
PossiblyNull.h \
PrintStream.h \
ProcessID.h \
RandomNumber.h \
RandomNumberSeed.h \
RawPointer.h \
RedBlackTree.h \
RefCounted.h \
RefCountedLeakCounter.h \
RefPtr.h \
RefPtrHashMap.h \
RetainPtr.h \
SHA1.h \
SaturatedArithmetic.h \
Spectrum.h \
StackBounds.h \
StaticConstructors.h \
StdLibExtras.h \
StringExtras.h \
StringHasher.h \
StringPrintStream.h \
TCPackedCache.h \
TCSpinLock.h \
TCSystemAlloc.h \
text/ASCIIFastPath.h \
text/AtomicString.h \
text/AtomicStringHash.h \
text/AtomicStringImpl.h \
text/AtomicStringTable.h \
text/Base64.h \
text/CString.h \
text/IntegerToStringConversion.h \
text/StringBuffer.h \
text/StringBuilder.h \
text/StringConcatenate.h \
text/StringHash.h \
text/StringImpl.h \
text/StringOperators.h \
text/TextPosition.h \
text/WTFString.h \
threads/BinarySemaphore.h \
Threading.h \
ThreadingPrimitives.h \
ThreadRestrictionVerifier.h \
ThreadSafeRefCounted.h \
ThreadSpecific.h \
unicode/CharacterNames.h \
unicode/Collator.h \
unicode/icu/UnicodeIcu.h \
unicode/ScriptCodesFromICU.h \
unicode/Unicode.h \
unicode/UnicodeMacrosFromICU.h \
unicode/UTF8.h \
ValueCheck.h \
Vector.h \
VectorTraits.h \
VMTags.h \
WTFThreadData.h \
WeakPtr.h
unix: HEADERS += ThreadIdentifierDataPthreads.h
SOURCES += \
Assertions.cpp \
Atomics.cpp \
BitVector.cpp \
CompilationThread.cpp \
Compression.cpp \
CryptographicallyRandomNumber.cpp \
CurrentTime.cpp \
DateMath.cpp \
DataLog.cpp \
DecimalNumber.cpp \
dtoa.cpp \
dtoa/bignum-dtoa.cc \
dtoa/bignum.cc \
dtoa/cached-powers.cc \
dtoa/diy-fp.cc \
dtoa/double-conversion.cc \
dtoa/fast-dtoa.cc \
dtoa/fixed-dtoa.cc \
dtoa/strtod.cc \
FastMalloc.cpp \
FilePrintStream.cpp \
FunctionDispatcher.cpp \
GregorianDateTime.cpp \
gobject/GOwnPtr.cpp \
gobject/GRefPtr.cpp \
HashTable.cpp \
MD5.cpp \
MainThread.cpp \
MediaTime.cpp \
MetaAllocator.cpp \
NumberOfCores.cpp \
RAMSize.cpp \
OSRandomSource.cpp \
qt/MainThreadQt.cpp \
qt/StringQt.cpp \
PageAllocationAligned.cpp \
PageBlock.cpp \
ParallelJobsGeneric.cpp \
PrintStream.cpp \
RandomNumber.cpp \
RefCountedLeakCounter.cpp \
SHA1.cpp \
SixCharacterHash.cpp \
StackBounds.cpp \
StringPrintStream.cpp \
TCSystemAlloc.cpp \
Threading.cpp \
WTFThreadData.cpp \
text/AtomicString.cpp \
text/AtomicStringTable.cpp \
text/Base64.cpp \
text/CString.cpp \
text/StringBuilder.cpp \
text/StringImpl.cpp \
text/StringStatics.cpp \
text/WTFString.cpp \
unicode/CollatorDefault.cpp \
unicode/icu/CollatorICU.cpp \
unicode/UTF8.cpp
unix: SOURCES += \
OSAllocatorPosix.cpp \
ThreadIdentifierDataPthreads.cpp \
ThreadingPthreads.cpp
win*|wince*: SOURCES += \
OSAllocatorWin.cpp \
ThreadSpecificWin.cpp \
ThreadingWin.cpp
win32 {
SOURCES += \
threads/win/BinarySemaphoreWin.cpp
INCLUDEPATH += $$PWD/wtf/threads
} else {
SOURCES += \
threads/BinarySemaphore.cpp
}
QT += core
QT -= gui
*-g++*:QMAKE_CXXFLAGS_RELEASE -= -O2
*-g++*:QMAKE_CXXFLAGS_RELEASE += -O3
*sh4* {
QMAKE_CXXFLAGS += -mieee -w
QMAKE_CFLAGS += -mieee -w
}
*-g++*:lessThan(QT_GCC_MAJOR_VERSION, 5):lessThan(QT_GCC_MINOR_VERSION, 6) {
# For GCC 4.5 and before we disable C++0x mode in JSC for if enabled in Qt's mkspec
QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x -std=c++11 -std=gnu++11
}
......@@ -277,7 +277,7 @@ void WTFReportBacktrace()
}
#if OS(DARWIN) || OS(LINUX)
# if PLATFORM(QT) || PLATFORM(GTK)
# if PLATFORM(GTK)
# if defined(__GLIBC__) && !defined(__UCLIBC__)
# define WTF_USE_BACKTRACE_SYMBOLS 1
# endif
......
......@@ -59,10 +59,6 @@
#include <glib.h>
#endif
#if PLATFORM(QT)
#include <QElapsedTimer>
#endif
namespace WTF {
#if OS(WINDOWS)
......@@ -283,22 +279,13 @@ double monotonicallyIncreasingTime()
return ecore_time_get();
}
#elif USE(GLIB) && !PLATFORM(EFL) && !PLATFORM(QT)
#elif USE(GLIB) && !PLATFORM(EFL)
double monotonicallyIncreasingTime()
{
return static_cast<double>(g_get_monotonic_time() / 1000000.0);
}
#elif PLATFORM(QT)
double monotonicallyIncreasingTime()
{
ASSERT(QElapsedTimer::isMonotonic());
static QElapsedTimer timer;
return timer.nsecsElapsed() / 1.0e9;
}
#elif OS(QNX)
double monotonicallyIncreasingTime()
......
......@@ -41,7 +41,7 @@
// or <glib/gi18n-lib.h>, which in turn include <xlocale/_ctype.h> which uses
// isacii().
#include <wtf/Platform.h>
#if !PLATFORM(QT) && !(OS(DARWIN) && PLATFORM(GTK)) && !OS(QNX) && !defined(_LIBCPP_VERSION)
#if !(OS(DARWIN) && PLATFORM(GTK)) && !OS(QNX) && !defined(_LIBCPP_VERSION)
#include <ctype.h>
......
......@@ -107,9 +107,7 @@
#endif
// Harden the pointers stored in the TCMalloc linked lists
#if !PLATFORM(QT)
#define ENABLE_TCMALLOC_HARDENING 1
#endif
// Use a background thread to periodically scavenge memory to release back to the system
#if PLATFORM(IOS)
......
......@@ -299,17 +299,6 @@
#endif /* PLATFORM(GTK) */
/* --------- Qt port (Unix, Windows, Mac, WinCE) --------- */
#if PLATFORM(QT)
#if OS(UNIX)
#if !defined(ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH)
#define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
#endif
#endif
#endif /* PLATFORM(QT) */
/* --------- Blackberry port (QNX) --------- */
#if PLATFORM(BLACKBERRY)
......
/*
* Copyright (C) 2007 Staikos Computing Services Inc.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "MainThread.h"
#include <QCoreApplication>
#include <QEvent>
#include <QObject>
#include <QThread>
namespace WTF {
static int s_mainThreadInvokerEventType;
class MainThreadInvoker : public QObject {
Q_OBJECT
public:
MainThreadInvoker();
virtual bool event(QEvent*);
};
MainThreadInvoker::MainThreadInvoker()
{
s_mainThreadInvokerEventType = QEvent::registerEventType();
}
bool MainThreadInvoker::event(QEvent* e)
{
if (e->type() != s_mainThreadInvokerEventType)
return QObject::event(e);
dispatchFunctionsFromMainThread();
return true;
}
Q_GLOBAL_STATIC(MainThreadInvoker, webkit_main_thread_invoker)
void initializeMainThreadPlatform()
{
webkit_main_thread_invoker();
}
void scheduleDispatchFunctionsOnMainThread()
{
QCoreApplication::postEvent(webkit_main_thread_invoker(), new QEvent(static_cast<QEvent::Type>(s_mainThreadInvokerEventType)));
}
} // namespace WTF
#include "MainThreadQt.moc"
/*
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <wtf/StdLibExtras.h>
#include <wtf/text/WTFString.h>
#include <QString>
namespace WTF {
// String conversions
String::String(const QString& qstr)
{
if (qstr.isNull())
return;
m_impl = StringImpl::adopt(const_cast<QString&>(qstr).data_ptr());
}
String::String(const QStringRef& ref)
{
if (!ref.string())
return;
m_impl = StringImpl::create(reinterpret_cast_ptr<const UChar*>(ref.unicode()), ref.length());
}
String::operator QString() const
{
if (!m_impl)
return QString();
if (QStringData* qStringData = m_impl->qStringData()) {
// The WTF string was adopted from a QString at some point, so we
// can just adopt the QStringData like a regular QString copy.
qStringData->ref.ref();
QStringDataPtr qStringDataPointer = { qStringData };
return QString(qStringDataPointer);
}
if (is8Bit() && !m_impl->has16BitShadow()) {
// Asking for characters() of an 8-bit string will make a 16-bit copy internally
// in WTF::String. Since we're going to copy the data to QStringData anyways, we
// can do the conversion ourselves and save one copy.
return QString::fromLatin1(reinterpret_cast<const char*>(characters8()), length());
}
return QString(reinterpret_cast<const QChar*>(characters()), length());
}
}
// vim: ts=4 sw=4 et
......@@ -150,10 +150,6 @@ public:
AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { }
operator NSString*() const { return m_string; }
#endif
#if PLATFORM(QT)
AtomicString(const QString& s) : m_string(add(String(s).impl())) { }
operator QString() const { return m_string; }
#endif
#if PLATFORM(BLACKBERRY)
AtomicString(const BlackBerry::Platform::String& s) : m_string(add(String(s).impl())) { }
operator BlackBerry::Platform::String() const { return m_string; }
......
......@@ -137,13 +137,6 @@ StringImpl::~StringImpl()
fastFree(const_cast<LChar*>(m_data8));
return;
}
#if PLATFORM(QT)
if (ownership == BufferAdoptedQString) {
if (!m_qStringData->ref.deref())
QStringData::deallocate(m_qStringData);
return;
}
#endif
ASSERT(ownership == BufferSubstring);
ASSERT(m_substringBuffer);
......@@ -1932,18 +1925,6 @@ PassRefPtr<StringImpl> StringImpl::adopt(StringBuffer<UChar>& buffer)
return adoptRef(new StringImpl(buffer.release(), length));
}
#if PLATFORM(QT)
PassRefPtr<StringImpl> StringImpl::adopt(QStringData* qStringData)
{
ASSERT(qStringData);
if (!qStringData->size)
return empty();
return adoptRef(new StringImpl(qStringData, ConstructAdoptedQString));
}
#endif
size_t StringImpl::sizeInBytes() const
{
// FIXME: support substrings
......
......@@ -35,10 +35,6 @@
#include <wtf/text/ConversionMode.h>
#include <wtf/unicode/Unicode.h>
#if PLATFORM(QT)
#include <QString>
#endif
#if USE(CF)
typedef const struct __CFString * CFStringRef;
#endif
......@@ -159,10 +155,6 @@ private:
BufferInternal,
BufferOwned,
BufferSubstring,
#if PLATFORM(QT)
BufferAdoptedQString
#endif
// NOTE: Adding more ownership types needs to extend m_hashAndFlags as we're at capacity
};
// Used to construct static strings, which have an special refCount that can never hit zero.
......@@ -341,30 +333,6 @@ private:
STRING_STATS_ADD_16BIT_STRING(m_length);