diff options
author | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-18 08:35:59 (GMT) |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@nokia.com> | 2009-09-18 08:38:07 (GMT) |
commit | ef310719ef42cd09e2542fce96c529b5657bf167 (patch) | |
tree | c691bab10518e479ce40d4cac6c79daa312fce87 /src/3rdparty/webkit/JavaScriptCore/wtf | |
parent | 5b828316abb0ad1a33cdc11ebac0999d9b79576a (diff) | |
download | Qt-ef310719ef42cd09e2542fce96c529b5657bf167.zip Qt-ef310719ef42cd09e2542fce96c529b5657bf167.tar.gz Qt-ef310719ef42cd09e2542fce96c529b5657bf167.tar.bz2 |
Updated WebKit from /home/joce/dev/qtwebkit/ to qtwebkit-4.6-snapshot-18092009 ( 15c07fb8d7fa5e93c939aa7eb21c06e19c754cee )
Changes in WebKit/qt since the last update:
++ b/WebKit/qt/ChangeLog
2009-09-17 Janne Koskinen <janne.p.koskinen@digia.com>
Reviewed by Simon Hausmann.
Symbian build fix.
Moved the #ifdefs around _q_cleanupLeakMessages() into the function
definition.
QMake is not being able to distinguish between release and debug builds
in Symbian build. This is a Symbian toolchain issue.
* Api/qwebpage.cpp:
(QWebPagePrivate::_q_cleanupLeakMessages):
* Api/qwebpage.h:
* Api/qwebpage_p.h:
2009-09-17 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
Small cosmetic documentation fixlet in the QWebInspector.
* Api/qwebinspector.cpp:
2009-09-16 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
Reviewed by Eric Seidel.
Detect and add Windows7 properly to the user agent.
* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):
2009-09-16 Andras Becsi <andrewbecsi@yahoo.co.uk>
Rubberstamped by Kenneth Christiansen.
[Qt] Build fix for previous changes.
* QGVLauncher/main.cpp:
(MainView::flip):
2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
Unreviewed potential Qt < 4.6 build fix.
* QGVLauncher/main.cpp:
(MainView::flip):
2009-09-16 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Add a "Flip effect" to our GraphicsView based launcher.
* QGVLauncher/main.cpp:
(MainView::resizeEvent):
(MainView::flip):
(MainWindow::flip):
(MainWindow::buildUI):
2009-09-16 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
Rubber-stamped by Simon Hausmann.
[Qt] Typo fix. Pass the window object to the Format
menu. In this way Qt can free its internal graphical
objects during exit.
* QtLauncher/main.cpp:
(MainWindow::setupUI):
2009-09-16 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Tor Arne Vestbø.
[Qt] Build break fix on gcc ARM.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItemPrivate::_q_doLoadProgress):
2009-09-16 Warwick Allison <warwick.allison@nokia.com>
Reviewed by Simon Hausmann.
Fix a crash in QWebFrame::hasFocus() with a simple null pointer check
when the focused frame is null. We do the same check in other places
where we call kit().
* Api/qwebframe.cpp:
(QWebFrame::hasFocus):
2009-09-16 Jure Repinc <jlp@holodeck1.com>
Reviewed by Simon Hausmann.
Fixed a typo found during translation.
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::interruptForPolicyChangeError):
2009-09-14 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
[Qt] QWebGraphicsItem should check for null QWebPage.
https://bugs.webkit.org/show_bug.cgi?id=29185
Don't crash in QWebGraphicsItem when the page is still null, by
either checking if it's the case or constructing the default one.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItem::icon):
(QWebGraphicsItem::setZoomFactor):
(QWebGraphicsItem::zoomFactor):
(QWebGraphicsItem::setGeometry):
(QWebGraphicsItem::load):
(QWebGraphicsItem::setHtml):
(QWebGraphicsItem::toHtml):
(QWebGraphicsItem::setContent):
(QWebGraphicsItem::history):
(QWebGraphicsItem::settings):
2009-09-11 David Boddie <dboddie@trolltech.com>
Reviewed by Simon Hausmann.
Doc: Note that Netscape plugins are only available on desktop platforms.
* docs/qtwebkit.qdoc:
2009-09-11 Martin Smith <msmith@trolltech.com>
Reviewed by Simon Hausmann.
Adjust the name of the contentspage for the documentation
to the new name used in Qt 4.6.
* docs/qtwebkit.qdoc:
2009-09-11 Ariya Hidayat <ariya.hidayat@nokia.com>
Reviewed by Simon Hausmann.
Changed URLs from qtsoftware.com to qt.nokia.com, as part of a general
renaming.
* Api/qwebpluginfactory.cpp:
* docs/webkitsnippets/simple/main.cpp:
(main):
* docs/webkitsnippets/webpage/main.cpp:
(main):
2009-09-11 Volker Hilsheimer <volker.hilsheimer@nokia.com>
Reviewed by Simon Hausmann.
Restructure the documentation, both on a file and on a content level.
* Api/qwebdatabase.cpp:
* Api/qwebelement.cpp:
* Api/qwebframe.cpp:
* Api/qwebhistory.cpp:
* Api/qwebhistoryinterface.cpp:
* Api/qwebpage.cpp:
* Api/qwebpluginfactory.cpp:
* Api/qwebsecurityorigin.cpp:
* Api/qwebsettings.cpp:
* Api/qwebview.cpp:
* docs/qtwebkit.qdoc:
2009-09-11 Yongjun Zhang <yongjun.zhang@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29136
[Qt] emit microFocusChanged() signal when no QWidget-based view is present.
emit microFocusChange() signal regardless of view.
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::setInputMethodState):
2009-09-11 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=28806
[Qt] Make the WebInspector available as a QWidget.
* Api/headers.pri:
* Api/qwebelement.cpp:
(QWebElement::enclosingElement):
* Api/qwebelement.h:
* Api/qwebinspector.cpp: Added.
* Api/qwebinspector.h: Added.
* Api/qwebinspector_p.h: Added.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
(QWebPagePrivate::setInspector):
(QWebPagePrivate::getOrCreateInspector):
(QWebPagePrivate::inspectorController):
(QWebPage::~QWebPage):
(QWebPage::triggerAction):
* Api/qwebpage.h:
* Api/qwebpage_p.h:
* Api/qwebsettings.cpp:
* QtLauncher/main.cpp:
(MainWindow::MainWindow):
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientWebPage::InspectorClientWebPage):
(WebCore::InspectorClientWebPage::createWindow):
(WebCore::InspectorClientQt::createPage):
(WebCore::InspectorClientQt::showWindow):
(WebCore::InspectorClientQt::closeWindow):
(WebCore::InspectorClientQt::attachWindow):
(WebCore::InspectorClientQt::detachWindow):
(WebCore::InspectorClientQt::updateWindowTitle):
* WebCoreSupport/InspectorClientQt.h:
* docs/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp: Added.
2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Eric Seidel.
[Qt] Fix comparison between signed and unsigned integer warnings
https://bugs.webkit.org/show_bug.cgi?id=29162
No functional change.
* Api/qwebelement.cpp:
(QWebElement::findAll):
* Api/qwebhistory.cpp:
(QWebHistory::items):
(QWebHistory::backItems):
(QWebHistory::forwardItems):
(QWebHistory::saveState):
* Api/qwebplugindatabase.cpp:
(QWebPluginDatabase::setSearchPaths):
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::runOpenPanel):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::createPlugin):
2009-09-10 Simon Hausmann <hausmann@webkit.org>
Rubber-stamped by Ariya Hidayat.
Fix a bunch of qdoc warnings: Invalid references, non-standard
wording, etc.
* Api/qwebelement.cpp:
* Api/qwebgraphicsitem.cpp:
* Api/qwebsecurityorigin.cpp:
2009-09-10 Simon Hausmann <hausmann@webkit.org>
Reviewed by Ariya Hidayat.
Fix context menu event delivery with QWebGraphicsItem.
Re-implement the correct context menu virtual function using
a QGraphicsSceneContextMenuEvent and forward & handle it in
QWebPage.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItem::contextMenuEvent):
* Api/qwebgraphicsitem.h:
* Api/qwebpage.cpp:
(QWebPagePrivate::contextMenuEvent):
(QWebPage::event):
* Api/qwebpage_p.h:
2009-09-10 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Unreviewed.
Build fix for QtWebKit for Mac after r48219.
qevent and qstyleoption are QtGui interfaces.
* Api/qwebgraphicsitem.cpp:
* Api/qwebgraphicsitem.h:
2009-09-09 Simon Hausmann <hausmann@webkit.org>
Reviewed by Tor Arne Vestbø.
Call the right base class function QGraphicsWidget::event() instead
of skipping it and using QObject::event() instead.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItem::event):
2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>
Unreviewed.
Fix comment at Tor Arne Vestbø's request.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItem::sceneEvent):
(QWebGraphicsItem::event):
2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Tor Arne Vestbø.
Implement some virtual event methods so that we can fix
event-related bugs in Qt patch releases.
* Api/qwebgraphicsitem.cpp:
(QWebGraphicsItem::sceneEvent):
(QWebGraphicsItem::event):
* Api/qwebgraphicsitem.h:
2009-09-09 Kenneth Rohde Christiansen <kenneth@webkit.org>, Antonio Gomes <antonio.gomes@openbossa.org>
Reviewed by Simon Hausmann.
Add a new QGraphicsWidget based version of the "QWebView"
under the name "QWebGraphicsItem".
https://bugs.webkit.org/show_bug.cgi?id=28862
Includes an alternative Qt launcher using the QGraphicsView.
* Api/headers.pri:
* Api/qwebgraphicsitem.cpp: Added.
* Api/qwebgraphicsitem.h: Added.
* Api/qwebpage.h:
* QGVLauncher/QGVLauncher.pro: Copied from WebKit/qt/QtLauncher/QtLauncher.pro.
* QGVLauncher/main.cpp: Added.
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::repaint):
(WebCore::ChromeClientQt::scroll):
2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
Unreviewed build fix.
Potential build fix for Qt 4.5
* Api/qwebpage.cpp:
(QWebPagePrivate::mousePressEvent):
2009-09-08 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Simon Hausmann.
https://bugs.webkit.org/show_bug.cgi?id=29007
Add a test for the signal QWebFrame::javaScriptWindowObjectCleared()
* tests/qwebframe/tst_qwebframe.cpp:
2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Fix unused variable warnings
https://bugs.webkit.org/show_bug.cgi?id=29018
* Api/qwebpage.cpp:
(QWebPagePrivate::keyPressEvent):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::startDownload):
(WebCore::FrameLoaderClientQt::createFrame):
2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Ariya Hidayat.
[Qt] Use the declaration order in initializer lists
https://bugs.webkit.org/show_bug.cgi?id=29017
* Api/qwebframe_p.h:
2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
Add support for handling QGraphicsScene events.
* Api/qwebpage.cpp:
(QWebPagePrivate::mouseMoveEvent):
(QWebPagePrivate::mousePressEvent):
(QWebPagePrivate::mouseDoubleClickEvent):
(QWebPagePrivate::mouseTripleClickEvent):
(QWebPagePrivate::handleClipboard):
(QWebPagePrivate::mouseReleaseEvent):
(QWebPagePrivate::wheelEvent):
(QWebPagePrivate::dragEnterEvent):
(QWebPagePrivate::dragLeaveEvent):
(QWebPagePrivate::dragMoveEvent):
(QWebPagePrivate::dropEvent):
(QWebPage::event):
* Api/qwebpage_p.h:
2009-09-08 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Simon Hausmann.
[Qt] Make cursor set cleaner in QtWebKit Api: eliminate SetCursorEvent hack.
https://bugs.webkit.org/show_bug.cgi?id=28865
Clean up the unserCursor hack to use the QCursor set
as a property of the QWidget by WebCore::WidgetQt.
Remove all code that are no longer necessary for getting
cursor change events.
Patch by Kenneth Rohde Christiansen <kenneth@webkit.org> and
Antonio Gomes <antonio.gomes@openbossa.org> on 2009-09-07
* Api/qwebpage.cpp:
* Api/qwebpage_p.h:
* Api/qwebview.cpp:
(QWebViewPrivate::QWebViewPrivate):
(QWebView::event):
2009-09-08 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Simon Hausmann.
[Qt] QtWebKit single API to enable persistency
https://bugs.webkit.org/show_bug.cgi?id=28682
Disable LocalStorage, ApplicationCache, HTML5 offline storage by
default.
If persistency is enabled the default directory for LocalStorage and
ApplicationCache is now based on QDesktopServices::DataLocation and not
QDesktopServices::CacheLocation (as it is expected to keep this data
around after a reboot).
If persistency is enabled initialize HTML5 offline storage as well - this
fixed offline Storage for QtLauncher.
* Api/qwebpage.cpp:
(QWebPagePrivate::QWebPagePrivate):
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
(QWebSettings::enablePersistentStorage):
* Api/qwebsettings.h: Add a new API called enablePersistentStorage
* QtLauncher/main.cpp: Use the new enablePersistentStorage API
(main):
2009-09-07 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
Speed up the QWebPluginInfo::supportsMimeType() function.
https://bugs.webkit.org/show_bug.cgi?id=27651
Instead of going through the MIME types list constructed with
mimeTypes() function, look up the internal mimeToDescriptions map.
* Api/qwebplugindatabase.cpp:
(QWebPluginInfo::supportsMimeType):
2009-09-07 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
Speed up the QWebPluginInfo::mimeTypes() function.
https://bugs.webkit.org/show_bug.cgi?id=27651
Instead of constructing a list of MIME types every time it is called,
do this only once.
* Api/qwebplugindatabase.cpp:
(QWebPluginInfo::mimeTypes):
(QWebPluginInfo::operator=):
* Api/qwebplugindatabase.h:
* tests/qwebplugindatabase/tst_qwebplugindatabase.cpp:
(tst_QWebPluginDatabase::operatorassign_data):
(tst_QWebPluginDatabase::operatorassign):
2009-09-07 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
Remove the private classes from QWebPluginDatabase.
https://bugs.webkit.org/show_bug.cgi?id=27651
Instead, hold the PluginDatabase and PluginPackage objects as class
members and take care of refcounting on our own instead of using RefPtr.
This way we not only made the code cleaner but also got rid of
redundant allocations when constructing null QWebPluginInfo objects.
The private classes have been forward-declared and the d-pointers left
to be on the safe side.
* Api/qwebplugindatabase.cpp:
(QWebPluginInfo::QWebPluginInfo):
(QWebPluginInfo::~QWebPluginInfo):
(QWebPluginInfo::name):
(QWebPluginInfo::description):
(QWebPluginInfo::mimeTypes):
(QWebPluginInfo::path):
(QWebPluginInfo::isNull):
(QWebPluginInfo::setEnabled):
(QWebPluginInfo::isEnabled):
(QWebPluginInfo::operator==):
(QWebPluginInfo::operator!=):
(QWebPluginInfo::operator=):
(QWebPluginDatabase::QWebPluginDatabase):
(QWebPluginDatabase::~QWebPluginDatabase):
(QWebPluginDatabase::plugins):
(QWebPluginDatabase::searchPaths):
(QWebPluginDatabase::setSearchPaths):
(QWebPluginDatabase::addSearchPath):
(QWebPluginDatabase::refresh):
(QWebPluginDatabase::pluginForMimeType):
(QWebPluginDatabase::setPreferredPluginForMimeType):
* Api/qwebplugindatabase.h:
* Api/qwebplugindatabase_p.h: Removed.
2009-09-05 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Eric Seidel.
[Qt] r47424 broke binary compatibility
https://bugs.webkit.org/show_bug.cgi?id=28996
Append the new DnsPrefetchEnabled attribute at the end of the enum.
* Api/qwebsettings.h:
2009-09-04 Mark Mentovai <mark@chromium.org>
Reviewed by Dave Hyatt.
https://bugs.webkit.org/show_bug.cgi?id=28614
Account for scrollbar state changes that occur during layout.
* Api/qwebframe.cpp:
(QWebFrame::setScrollBarPolicy):
Eliminate duplicated (and incorrect) scrollbar mode tracking between
FrameView and ScrollView.
2009-09-04 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Eric Seidel.
[Qt] Fix tst_QWebPage::database autotest failure
https://bugs.webkit.org/show_bug.cgi?id=28961
Make sure that the test case enables the feature before
the feature gets tested
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::database):
2009-09-04 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
Reviewed by Eric Seidel.
Any QtWebKit application crashes on exit if the inspector is
used during the session rather then exiting.
If a QWebView has a QWebPage that is destroyed the QWebView
does not update its pointer and will crash the next time
it access the page pointers (such as in its destructor).
InspectorClientView should not call deleteLater when the page
is destroyed because it does not have a parent and is a top
level widget. close() needs to be called so that QApplication
can exit the application if quitOnLastWindowClosed is set
and a InspectorClientView is the last window, otherwise
the application will never exit.
* Api/qwebview.cpp:
(QWebViewPrivate::_q_pageDestroyed):
(QWebView::setPage):
* Api/qwebview.h:
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientView::InspectorClientView):
2009-09-03 Adam Barth <abarth@webkit.org>
Reviewed by eric@webkit.org.
https://bugs.webkit.org/show_bug.cgi?id=24696
Stub implementations of mixed content methods of FrameLoaderClient.
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::didDisplayInsecureContent):
(WebCore::FrameLoaderClientQt::didRunInsecureContent):
* WebCoreSupport/FrameLoaderClientQt.h:
2009-09-03 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Eric Seidel.
[Qt] Add a setting to turn SessionStorage on/off
https://bugs.webkit.org/show_bug.cgi?id=28836
* Api/qwebsettings.cpp:
(QWebSettingsPrivate::apply):
(QWebSettings::QWebSettings):
* Api/qwebsettings.h:
* tests/qwebpage/tst_qwebpage.cpp:
(testFlag):
(tst_QWebPage::testOptionalJSObjects):
2009-09-02 Richard Moore <rich@kde.org>
Reviewed by Tor Arne Vestbø.
[Qt] Make sure we relayout the page after evaluating JS
https://bugs.webkit.org/show_bug.cgi?id=28235
QtWebKit does not always seem to reflow the page when evaluating
javascript. This patch changes the way evaluateJavaScript works to
use the frameloader which ensures that this is done properly.
* Api/qwebframe.cpp:
(QWebFrame::evaluateJavaScript):
* tests/qwebframe/tst_qwebframe.cpp:
2009-08-28 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Reviewed by Holger Freyther.
https://bugs.webkit.org/show_bug.cgi?id=25889
[GTK] scrollbar policy for main frame is not implementable
Add empty implementation for new ChromeClient method.
* WebCoreSupport/ChromeClientQt.h:
(WebCore::ChromeClientQt::scrollbarsModeDidChange):
2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Ariya Hidayat.
QWebHistory::clear() modifications.
Clear() method was changed. If QWebHistory is empty (there is no
elements even current) clear() do nothing. If there at least one
element clear() will delete everything apart of current.
New autotests in QWebHistory
New autotests were added to QWebHistory. They should check some crashes
in save and restore state process and clear() method and general
behavior on where QWebHistory::count() == 0 or QWebHistory::count() == 1
Bugzilla: https://bugs.webkit.org/show_bug.cgi?id=28711
* Api/qwebhistory.cpp:
(QWebHistory::clear):
* tests/qwebhistory/tst_qwebhistory.cpp:
(tst_QWebHistory::back):
(tst_QWebHistory::forward):
(tst_QWebHistory::saveAndRestore_crash_1):
(tst_QWebHistory::saveAndRestore_crash_2):
(tst_QWebHistory::saveAndRestore_crash_3):
(tst_QWebHistory::clear):
2009-08-27 Jedrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed by Ariya Hidayat.
[Qt] Cleanup, old and commented part of source code was removed.
Fix some formatting problems.
https://bugs.webkit.org/show_bug.cgi?id=28712
* Api/qwebhistory_p.h:
(QWebHistoryPrivate::QWebHistoryPrivate):
2009-08-26 Adam Barth <abarth@webkit.org>
Reviewed by Oliver Hunt.
Don't let local files access web URLs
https://bugs.webkit.org/show_bug.cgi?id=28480
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
2009-08-25 Antonio Gomes <antonio.gomes@openbossa.org>
Reviewed by Ariya Hidayat.
Bug 28708 - Make possible to better use ResourceError in FrameLoaderClientQt class.
* Api/qwebframe.cpp:
(QWebFrame::requestedUrl):
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::FrameLoaderClientQt):
(WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
(WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
(WebCore::FrameLoaderClientQt::dispatchDidFailProvisionalLoad):
(WebCore::FrameLoaderClientQt::dispatchDidFailLoad):
* WebCoreSupport/FrameLoaderClientQt.h:
2009-08-22 Adam Barth <abarth@webkit.org>
Revert 47684. We're going to do this later once clients have had a
chance to opt into the setting they like.
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
2009-08-22 Adam Barth <abarth@webkit.org>
Reviewed by Eric Seidel.
Don't let local files access web URLs
https://bugs.webkit.org/show_bug.cgi?id=28480
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
2009-08-19 Aaron Boodman <aa@chromium.org>
Speculative build break fix for qt.
* Api/qwebsecurityorigin.cpp:
(QWebSecurityOrigin::whiteListAccessFromOrigin):
* Api/qwebsecurityorigin.h:
2009-08-19 Aaron Boodman <aa@chromium.org>
Reviewed by David Levin.
https://bugs.webkit.org/show_bug.cgi?id=24853: Provide a way for WebKit clients to
specify a more granular policy for cross-origin XHR access.
* Api/qwebsecurityorigin.cpp: Add API to manipulate origin access whitelists.
(QWebSecurityOrigin::whiteListAccessFromOrigin): Ditto.
(QWebSecurityOrigin::resetOriginAccessWhiteLists): Ditto.
* Api/qwebsecurityorigin.h: Ditto.
2009-08-18 Markus Goetz <Markus.Goetz@nokia.com>
Reviwed by Ariya Hidayat.
[Qt] For prefecthDNS, the pre-fetching has to be enabled in the
WebSettings.
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
* Api/qwebsettings.h:
2009-08-17 Darin Adler <darin@apple.com>
Try to fix Qt build again.
* WebCoreSupport/EditorClientQt.cpp: Move "using namespace".
2009-08-17 Darin Adler <darin@apple.com>
Try to fix Qt build.
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::shouldShowDeleteInterface):
Use getAttribute(classAttr) instead of className() function.
2009-08-14 Yongjun Zhang <yongjun.zhang@nokia.com>
Reviewed by Simon Hausmann.
RVCT elftran fails to resolve QPainter::staticMetaObject coming with
QWebView::RenderHints property.
This is a temporary fix and will be revereted when the right symbols
exported from Qt lib in S60.
https://bugs.webkit.org/show_bug.cgi?id=28181
* Api/qwebview.h:
2009-08-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Public API to configure the storage path for HTML5 localStorage
https://bugs.webkit.org/show_bug.cgi?id=28036
Disables LocalStorage for QtWebKit by default by setting
QWebSettings::LocalStorageEnabled to false.
Sets up a default for the LocalStorage path so that clients would only
need to enable the LocalStorageEnabled setting to turn on LocalStoragre
support.
Turn on LocalStorage support for QtLauncher and the relevant test
since LocalStorage is now disabled by default for QtWebkit.
* Api/qwebpage.cpp:
(defaultCachePath):
(initializeApplicationCachePathIfNecessary):
(QWebPagePrivate::QWebPagePrivate):
* Api/qwebsettings.cpp:
(QWebSettingsPrivate::apply):
(QWebSettings::QWebSettings):
(QWebSettings::setLocalStoragePath):
(QWebSettings::localStoragePath):
* Api/qwebsettings.h:
* QtLauncher/main.cpp:
(main):
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::multiplePageGroupsAndLocalStorage):
2009-08-14 Yael Aharon <yael.aharon@nokia.com>
Reviewed by Simon Hausmann.
[Qt] Allow applications to register their own local URL scheme.
https://bugs.webkit.org/show_bug.cgi?id=28240
* Api/qwebsecurityorigin.cpp:
(QWebSecurityOrigin::addLocalScheme):
(QWebSecurityOrigin::removeLocalScheme):
(QWebSecurityOrigin::localSchemes):
* Api/qwebsecurityorigin.h:
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::localURLSchemes):
2009-08-13 Mark Rowe <mrowe@apple.com>
Try and fix the Qt build.
* Api/qwebelement.cpp:
2009-08-13 Kavindra Devi Palaraja <kavindra.palaraja@nokia.com>
Reviewed by Simon Hausmann.
Doc - Some cleanup on the documentation of QWebElement
* Api/qwebelement.cpp:
2009-08-13 Norbert Leser <norbert.leser@nokia.com>
Reviewed by Simon Hausmann.
Symbian target components (library and executable files)
require Unique Identifiers (i.e., UID3).
These identifiers are defined in the respective project
files, conditionally for "symbian" platform.
* QtLauncher/QtLauncher.pro:
* tests/qwebelement/qwebelement.pro:
* tests/qwebframe/qwebframe.pro:
* tests/qwebhistory/qwebhistory.pro:
* tests/qwebhistoryinterface/qwebhistoryinterface.pro:
* tests/qwebpage/qwebpage.pro:
* tests/qwebview/qwebview.pro:
2009-08-12 George Wright <george.wright@torchmobile.com>
Reviewed by Adam Treat.
Initialise zoom levels independent of whether a URL is valid or not to
fix https://bugs.webkit.org/show_bug.cgi?id=28162
* QtLauncher/main.cpp:
(MainWindow::MainWindow):
2009-08-12 Joerg Bornemann <joerg.bornemann@trolltech.com>
Reviewed by Simon Hausmann.
QtWebKit compile fix for Windows CE
There's no getenv on Windows CE, use qgetenv instead.
* Api/qwebpage.cpp:
(qt_drt_overwritePluginDirectories):
2009-08-10 Kavindra Palaraja <kavindra.palaraja@nokia.com>
Reviewed by Simon Hausmann.
Various fixes and improvements to the QWebPluginInfo, QWebPluginDatabase and QWebSettings documentation.
* Api/qwebplugindatabase.cpp:
* Api/qwebsettings.cpp:
2009-08-08 Volker Hilsheimer <volker.hilsheimer@nokia.com>
Reviewed by Simon Hausmann.
Doc: there is no group of explicitly shared classes, only one class uses this.
Explain the implications in the QWebHistoryItem documentation, and get rid
of the "group".
* Api/qwebhistory.cpp:
2009-08-05 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
Reviewed by Simon Hausmann.
[Qt] Fix build error caused by http://trac.webkit.org/changeset/46763
* Api/qwebpluginfactory.h: Export macro added.
2009-08-04 Antonio Gomes <antonio.gomes@openbossa.org>
Reviewed by Simon Hausmann.
[Qt] QWebFrame::requestedUrl method can mis-behave in case of unhandled sslErrors.
https://bugs.webkit.org/show_bug.cgi?id=27804
* Api/qwebframe.cpp:
(QWebFrame::requestedUrl):
* tests/qwebframe/tst_qwebframe.cpp:
2009-08-04 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Tor Arne Vestbø.
Rename QWebPlugin to QWebPluginInfo, as discussed on IRC.
* Api/qwebplugindatabase.cpp:
(QWebPluginInfoPrivate::QWebPluginInfoPrivate):
(QWebPluginInfo::QWebPluginInfo):
(QWebPluginInfo::~QWebPluginInfo):
(QWebPluginInfo::name):
(QWebPluginInfo::description):
(QWebPluginInfo::mimeTypes):
(QWebPluginInfo::supportsMimeType):
(QWebPluginInfo::path):
(QWebPluginInfo::isNull):
(QWebPluginInfo::setEnabled):
(QWebPluginInfo::isEnabled):
(QWebPluginInfo::operator==):
(QWebPluginInfo::operator!=):
(QWebPluginInfo::operator=):
(QWebPluginDatabase::plugins):
(QWebPluginDatabase::pluginForMimeType):
(QWebPluginDatabase::setPreferredPluginForMimeType):
* Api/qwebplugindatabase.h:
* Api/qwebplugindatabase_p.h:
* tests/qwebplugindatabase/tst_qwebplugindatabase.cpp:
(tst_QWebPluginDatabase::installedPlugins):
(tst_QWebPluginDatabase::searchPaths):
(tst_QWebPluginDatabase::null_data):
(tst_QWebPluginDatabase::null):
(tst_QWebPluginDatabase::pluginForMimeType):
(tst_QWebPluginDatabase::enabled):
(tst_QWebPluginDatabase::operatorequal_data):
(tst_QWebPluginDatabase::operatorequal):
(tst_QWebPluginDatabase::preferredPlugin):
2009-08-04 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Adam Treat.
Replace QWebPlugin::MimeType with a typedef to
QWebPluginFactory::MimeType.
* Api/qwebplugindatabase.cpp:
* Api/qwebplugindatabase.h:
* Api/qwebpluginfactory.cpp:
(QWebPluginFactory::MimeType::operator==):
* Api/qwebpluginfactory.h:
2009-08-04 Jakub Wieczorek <faw217@gmail.com>
Reviewed by Simon Hausmann.
Add QWebPluginDatabase API to the Qt API.
https://bugs.webkit.org/show_bug.cgi?id=27651
* Api/headers.pri:
* Api/qwebplugindatabase.cpp: Added.
(QWebPluginPrivate::QWebPluginPrivate):
(QWebPluginDatabasePrivate::QWebPluginDatabasePrivate):
(QWebPlugin::MimeType::operator==):
(QWebPlugin::QWebPlugin):
(QWebPlugin::~QWebPlugin):
(QWebPlugin::name):
(QWebPlugin::description):
(QWebPlugin::mimeTypes):
(QWebPlugin::supportsMimeType):
(QWebPlugin::path):
(QWebPlugin::isNull):
(QWebPlugin::setEnabled):
(QWebPlugin::isEnabled):
(QWebPlugin::operator==):
(QWebPlugin::operator!=):
(QWebPlugin::operator=):
(QWebPluginDatabase::QWebPluginDatabase):
(QWebPluginDatabase::~QWebPluginDatabase):
(QWebPluginDatabase::plugins):
(QWebPluginDatabase::defaultSearchPaths):
(QWebPluginDatabase::searchPaths):
(QWebPluginDatabase::setSearchPaths):
(QWebPluginDatabase::addSearchPath):
(QWebPluginDatabase::refresh):
(QWebPluginDatabase::pluginForMimeType):
(QWebPluginDatabase::setPreferredPluginForMimeType):
* Api/qwebplugindatabase.h: Added.
* Api/qwebplugindatabase_p.h: Added.
* Api/qwebsettings.cpp:
(QWebSettings::pluginDatabase):
* Api/qwebsettings.h:
* tests/qwebplugindatabase/qwebplugindatabase.pro: Added.
* tests/qwebplugindatabase/tst_qwebplugindatabase.cpp: Added.
(tst_QWebPluginDatabase::installedPlugins):
(tst_QWebPluginDatabase::searchPaths):
(tst_QWebPluginDatabase::null_data):
(tst_QWebPluginDatabase::null):
(tst_QWebPluginDatabase::pluginForMimeType):
(tst_QWebPluginDatabase::enabled):
(tst_QWebPluginDatabase::operatorequal_data):
(tst_QWebPluginDatabase::operatorequal):
(tst_QWebPluginDatabase::preferredPlugin):
* tests/tests.pro:
2009-08-03 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu>
Reviewed by Simon Hausmann.
Do memory cleanup when running robotized QtLauncher in debug as well.
* QtLauncher/main.cpp:
(launcherMain):
(main):
2009-07-30 Laszlo Gombos <laszlo.1.gombos@nokia.com>
Reviewed by Tor Arne Vestbø.
[Qt] Initialize HTML5 Application Cache for QtWebKit to a sensible default
https://bugs.webkit.org/show_bug.cgi?id=27866
* Api/qwebpage.cpp:
(initializeApplicationCachePathIfNecessary):
(QWebPagePrivate::QWebPagePrivate):
2009-07-31 Jakob Petsovits <jakob.petsovits@torchmobile.com>
Reviewed by Adam Treat.
Build QtWebKit without benchmark tests for Qt < 4.5.
https://bugs.webkit.org/show_bug.cgi?id=27886
The QBENCHMARK macro is only available from 4.5 on,
so builds for Qt < 4.5 shouldn't try to build those.
* tests/tests.pro:
2009-07-31 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Adam Treat.
Fix warning by migrating use of QString.sprintf(...) to
QString.arg().arg()...
* WebCoreSupport/EditorClientQt.cpp:
(dumpRange):
2009-07-31 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Tor Arne Vestbø.
Expose the Offline Web Application Cache in the Qt API.
* Api/qwebsettings.cpp:
(QWebSettings::QWebSettings):
(QWebSettings::setOfflineWebApplicationCachePath):
(QWebSettings::offlineWebApplicationCachePath):
(QWebSettings::setOfflineWebApplicationCacheQuota):
(QWebSettings::offlineWebApplicationCacheQuota):
* Api/qwebsettings.h:
2009-07-30 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Adam Treat.
Add missing Q_OBJECT to class inheriting from QObject.
* tests/qwebframe/tst_qwebframe.cpp:
2009-07-30 Kenneth Rohde Christiansen <kenneth@webkit.org>
Reviewed by Adam Treat.
Fix indentation.
* tests/qwebframe/tst_qwebframe.cpp:
2009-07-30 Volker Hilsheimer <volker.hilsheimer@nokia.com>
Reviewed by Simon Hausmann.
Fix documentation links to examples.
* Api/qwebview.cpp:
2009-07-30 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu>
Reviewed by Simon Hausmann.
Allocate MainWindow on heap in robotized QtLauncher as well.
* QtLauncher/main.cpp:
(main):
2009-07-29 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin Adler.
Added foundation work to allow a testing infrastructure for the Web
Inspector.
* WebCoreSupport/InspectorClientQt.cpp:
(WebCore::InspectorClientQt::inspectorWindowObjectCleared):
* WebCoreSupport/InspectorClientQt.h:
2009-07-29 Zoltan Herczeg <zherczeg@inf.u-szeged.hu>
Reviewed by Simon Hausmann.
[Qt] In debug mode, this fix frees cached resources
and other unreferenced objects (by calling the
garbage collector) to remove the LEAK messages.
https://bugs.webkit.org/show_bug.cgi?id=27767
* Api/qwebframe.cpp:
(qt_drt_cache_clear):
* QtLauncher/main.cpp:
(main):
2009-07-28 Kenneth Rohde Christiansen <kenneth@webkit.org>
Fix the Qt build by adapting to the changes of ScriptObject.
* Api/qwebelement.cpp:
(setupScriptObject):
2009-07-28 Robert Hogan <robert@roberthogan.net>
Reviewed by Simon Hausmann.
Add WebKit version API to Qt.
Get the current version of WebKit from WebKit/mac/Configurations/Version.xcconfig
at compile time and make it available to Qt applications through
qWebKitVersion().
Also amend the User Agent string to place the Safari clause outside
the final bracket and to the end of the UA string.
https://bugs.webkit.org/show_bug.cgi?id=27158
Minor build tweak by Simon Hausmann (adding export macros to new functions).
* Api/headers.pri:
* Api/qwebkitversion.cpp: Added.
(webKitVersion):
(webKitMajorVersion):
(webKitMinorVersion):
* Api/qwebkitversion.h: Added.
* Api/qwebpage.cpp:
(QWebPage::userAgentForUrl):
* tests/qwebview/tst_qwebview.cpp:
(tst_QWebView::getWebKitVersion):
http://qt.nokia.com/developer/task-tracker/index_html?id=238391&method=entry
http://qt.nokia.com/developer/task-tracker/index_html?id=219344&method=entry
http://qt.nokia.com/developer/task-tracker/index_html?id=241144&method=entry
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf')
38 files changed, 1221 insertions, 362 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp index 54daf23..819ed9a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.cpp @@ -72,10 +72,7 @@ static void vprintf_stderr_common(const char* format, va_list args) CFRelease(cfFormat); } else #elif COMPILER(MSVC) && !defined(WINCEBASIC) -# if !defined(_WIN32_WCE) || (_WIN32_WCE >= 0x600) - if (IsDebuggerPresent()) -# endif - { + if (IsDebuggerPresent()) { size_t size = 1024; do { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h index d691357..59efd84 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Assertions.h @@ -144,11 +144,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann #if ASSERT_DISABLED #define ASSERT(assertion) ((void)0) -#if COMPILER(MSVC7) || COMPILER(WINSCW) -#define ASSERT_WITH_MESSAGE(assertion) ((void)0) -#else #define ASSERT_WITH_MESSAGE(assertion, ...) ((void)0) -#endif /* COMPILER(MSVC7) */ #define ASSERT_NOT_REACHED() ((void)0) #define ASSERT_UNUSED(variable, assertion) ((void)variable) @@ -160,7 +156,7 @@ void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChann CRASH(); \ } \ while (0) -#if COMPILER(MSVC7) || COMPILER(WINSCW) +#if COMPILER(MSVC7) #define ASSERT_WITH_MESSAGE(assertion) ((void)0) #else #define ASSERT_WITH_MESSAGE(assertion, ...) do \ @@ -203,7 +199,7 @@ while (0) /* FATAL */ -#if FATAL_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) +#if FATAL_DISABLED #define FATAL(...) ((void)0) #elif COMPILER(MSVC7) #define FATAL() ((void)0) @@ -216,9 +212,9 @@ while (0) /* LOG_ERROR */ -#if ERROR_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) +#if ERROR_DISABLED #define LOG_ERROR(...) ((void)0) -#elif COMPILER(MSVC7) || COMPILER(WINSCW) +#elif COMPILER(MSVC7) #define LOG_ERROR() ((void)0) #else #define LOG_ERROR(...) WTFReportError(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, __VA_ARGS__) @@ -226,9 +222,9 @@ while (0) /* LOG */ -#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) +#if LOG_DISABLED #define LOG(channel, ...) ((void)0) -#elif COMPILER(MSVC7) || COMPILER(WINSCW) +#elif COMPILER(MSVC7) #define LOG() ((void)0) #else #define LOG(channel, ...) WTFLog(&JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) @@ -238,9 +234,9 @@ while (0) /* LOG_VERBOSE */ -#if LOG_DISABLED && !COMPILER(MSVC7) && !COMPILER(WINSCW) +#if LOG_DISABLED #define LOG_VERBOSE(channel, ...) ((void)0) -#elif COMPILER(MSVC7) || COMPILER(WINSCW) +#elif COMPILER(MSVC7) #define LOG_VERBOSE(channel) ((void)0) #else #define LOG_VERBOSE(channel, ...) WTFLogVerbose(__FILE__, __LINE__, WTF_PRETTY_FUNCTION, &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, channel), __VA_ARGS__) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h index 96e9cc2..f5f5ded 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ByteArray.h @@ -45,6 +45,13 @@ namespace WTF { m_data[index] = static_cast<unsigned char>(value + 0.5); } + void set(unsigned index, unsigned char value) + { + if (index >= m_size) + return; + m_data[index] = value; + } + bool get(unsigned index, unsigned char& result) const { if (index >= m_size) @@ -53,6 +60,12 @@ namespace WTF { return true; } + unsigned char get(unsigned index) const + { + ASSERT(index < m_size); + return m_data[index]; + } + unsigned char* data() { return m_data; } void deref() diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp index 73c2c5c..a3d5290 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CurrentTime.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2008 Google Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -33,6 +34,7 @@ #include "CurrentTime.h" #if PLATFORM(WIN_OS) + // Windows is first since we want to use hires timers, despite PLATFORM(CF) // being defined. // If defined, WIN32_LEAN_AND_MEAN disables timeBeginPeriod/timeEndPeriod. @@ -40,13 +42,17 @@ #include <windows.h> #include <math.h> #include <stdint.h> -#if HAVE(SYS_TIMEB_H) +#include <time.h> + +#if USE(QUERY_PERFORMANCE_COUNTER) +#if PLATFORM(WINCE) +extern "C" time_t mktime(struct tm *t); +#else #include <sys/timeb.h> -#endif -#if !PLATFORM(WINCE) #include <sys/types.h> #endif -#include <time.h> +#endif + #elif PLATFORM(CF) #include <CoreFoundation/CFDate.h> #elif PLATFORM(GTK) @@ -63,6 +69,8 @@ const double msPerSecond = 1000.0; #if PLATFORM(WIN_OS) +#if USE(QUERY_PERFORMANCE_COUNTER) + static LARGE_INTEGER qpcFrequency; static bool syncedTime; @@ -188,6 +196,55 @@ double currentTime() return utc / 1000.0; } +#else + +static double currentSystemTime() +{ + FILETIME ft; + GetCurrentFT(&ft); + + // As per Windows documentation for FILETIME, copy the resulting FILETIME structure to a + // ULARGE_INTEGER structure using memcpy (using memcpy instead of direct assignment can + // prevent alignment faults on 64-bit Windows). + + ULARGE_INTEGER t; + memcpy(&t, &ft, sizeof(t)); + + // Windows file times are in 100s of nanoseconds. + // To convert to seconds, we have to divide by 10,000,000, which is more quickly + // done by multiplying by 0.0000001. + + // Between January 1, 1601 and January 1, 1970, there were 369 complete years, + // of which 89 were leap years (1700, 1800, and 1900 were not leap years). + // That is a total of 134774 days, which is 11644473600 seconds. + + return t.QuadPart * 0.0000001 - 11644473600.0; +} + +double currentTime() +{ + static bool init = false; + static double lastTime; + static DWORD lastTickCount; + if (!init) { + lastTime = currentSystemTime(); + lastTickCount = GetTickCount(); + init = true; + return lastTime; + } + + DWORD tickCountNow = GetTickCount(); + DWORD elapsed = tickCountNow - lastTickCount; + double timeNow = lastTime + (double)elapsed / 1000.; + if (elapsed >= 0x7FFFFFFF) { + lastTime = timeNow; + lastTickCount = tickCountNow; + } + return timeNow; +} + +#endif // USE(QUERY_PERFORMANCE_COUNTER) + #elif PLATFORM(CF) double currentTime() diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp index 0b76649..6a5b22f 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DateMath.cpp @@ -65,6 +65,11 @@ #include <notify.h> #endif +#if PLATFORM(WINCE) && !PLATFORM(QT) +extern "C" size_t strftime(char * const s, const size_t maxsize, const char * const format, const struct tm * const t); +extern "C" struct tm * localtime(const time_t *timer); +#endif + #if HAVE(SYS_TIME_H) #include <sys/time.h> #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h b/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h index 5dccb0e..436f7f2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/DisallowCType.h @@ -54,21 +54,21 @@ #undef tolower #undef toupper -#define isalnum WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isalpha WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isascii WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isblank WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define iscntrl WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isdigit WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isgraph WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define islower WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isprint WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define ispunct WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isspace WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isupper WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define isxdigit WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define toascii WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define tolower WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h -#define toupper WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isalnum isalnum_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isalpha isalpha_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isascii isascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isblank isblank_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define iscntrl iscntrl_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isdigit isdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isgraph isgraph_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define islower islower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isprint isprint_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define ispunct ispunct_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isspace isspace_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isupper isupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define isxdigit isxdigit_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define toascii toascii_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define tolower tolower_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h +#define toupper toupper_WTF_Please_use_ASCIICType_instead_of_ctype_see_comment_in_ASCIICType_h #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h index 9fcbbc1..81b1de0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastAllocBase.h @@ -301,6 +301,16 @@ namespace WTF { fastFree(p); } + template <typename T> + inline void fastDeleteSkippingDestructor(T* p) + { + if (!p) + return; + + fastMallocMatchValidateFree(p, Internal::AllocTypeFastNew); + fastFree(p); + } + namespace Internal { // This is a support template for fastDeleteArray. // This handles the case wherein T has a trivial dtor. @@ -397,7 +407,7 @@ namespace WTF { } // namespace WTF -// Using WTF::FastAllocBase to avoid using FastAllocBase's explicit qualification by WTF::. using WTF::FastAllocBase; +using WTF::fastDeleteSkippingDestructor; #endif // FastAllocBase_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp index c855a41..afb0220 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.cpp @@ -1,6 +1,6 @@ // Copyright (c) 2005, 2007, Google Inc. // All rights reserved. -// Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. +// Copyright (C) 2005, 2006, 2007, 2008, 2009 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 @@ -89,12 +89,20 @@ #endif #endif -#if !defined(USE_SYSTEM_MALLOC) && defined(NDEBUG) +#if !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) && defined(NDEBUG) #define FORCE_SYSTEM_MALLOC 0 #else #define FORCE_SYSTEM_MALLOC 1 #endif +// Use a background thread to periodically scavenge memory to release back to the system +// https://bugs.webkit.org/show_bug.cgi?id=27900: don't turn this on for Tiger until we have figured out why it caused a crash. +#if defined(BUILDING_ON_TIGER) +#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 0 +#else +#define USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY 1 +#endif + #ifndef NDEBUG namespace WTF { @@ -170,10 +178,10 @@ void* fastZeroedMalloc(size_t n) return result; } -void* tryFastZeroedMalloc(size_t n) +TryMallocReturnValue tryFastZeroedMalloc(size_t n) { - void* result = tryFastMalloc(n); - if (!result) + void* result; + if (!tryFastMalloc(n).getValue(result)) return 0; memset(result, 0, n); return result; @@ -192,7 +200,7 @@ void* tryFastZeroedMalloc(size_t n) namespace WTF { -void* tryFastMalloc(size_t n) +TryMallocReturnValue tryFastMalloc(size_t n) { ASSERT(!isForbidden()); @@ -218,7 +226,9 @@ void* fastMalloc(size_t n) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastMalloc(n); + TryMallocReturnValue returnValue = tryFastMalloc(n); + void* result; + returnValue.getValue(result); #else void* result = malloc(n); #endif @@ -228,7 +238,7 @@ void* fastMalloc(size_t n) return result; } -void* tryFastCalloc(size_t n_elements, size_t element_size) +TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size) { ASSERT(!isForbidden()); @@ -256,7 +266,9 @@ void* fastCalloc(size_t n_elements, size_t element_size) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastCalloc(n_elements, element_size); + TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size); + void* result; + returnValue.getValue(result); #else void* result = calloc(n_elements, element_size); #endif @@ -283,7 +295,7 @@ void fastFree(void* p) #endif } -void* tryFastRealloc(void* p, size_t n) +TryMallocReturnValue tryFastRealloc(void* p, size_t n) { ASSERT(!isForbidden()); @@ -315,7 +327,9 @@ void* fastRealloc(void* p, size_t n) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastRealloc(p, n); + TryMallocReturnValue returnValue = tryFastRealloc(p, n); + void* result; + returnValue.getValue(result); #else void* result = realloc(p, n); #endif @@ -531,7 +545,7 @@ static const size_t kNumClasses = 68; static const size_t kPageMapBigAllocationThreshold = 128 << 20; // Minimum number of pages to fetch from system at a time. Must be -// significantly bigger than kBlockSize to amortize system-call +// significantly bigger than kPageSize to amortize system-call // overhead, and also to reduce external fragementation. Also, we // should keep this value big because various incarnations of Linux // have small limits on the number of mmap() regions per @@ -1187,6 +1201,32 @@ template <> class MapSelector<32> { // contiguous runs of pages (called a "span"). // ------------------------------------------------------------------------- +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY +// The central page heap collects spans of memory that have been deleted but are still committed until they are released +// back to the system. We use a background thread to periodically scan the list of free spans and release some back to the +// system. Every 5 seconds, the background thread wakes up and does the following: +// - Check if we needed to commit memory in the last 5 seconds. If so, skip this scavenge because it's a sign that we are short +// of free committed pages and so we should not release them back to the system yet. +// - Otherwise, go through the list of free spans (from largest to smallest) and release up to a fraction of the free committed pages +// back to the system. +// - If the number of free committed pages reaches kMinimumFreeCommittedPageCount, we can stop the scavenging and block the +// scavenging thread until the number of free committed pages goes above kMinimumFreeCommittedPageCount. + +// Background thread wakes up every 5 seconds to scavenge as long as there is memory available to return to the system. +static const int kScavengeTimerDelayInSeconds = 5; + +// Number of free committed pages that we want to keep around. +static const size_t kMinimumFreeCommittedPageCount = 512; + +// During a scavenge, we'll release up to a fraction of the free committed pages. +#if PLATFORM(WIN) +// We are slightly less aggressive in releasing memory on Windows due to performance reasons. +static const int kMaxScavengeAmountFactor = 3; +#else +static const int kMaxScavengeAmountFactor = 2; +#endif +#endif + class TCMalloc_PageHeap { public: void init(); @@ -1286,6 +1326,14 @@ class TCMalloc_PageHeap { // Bytes allocated from system uint64_t system_bytes_; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + // Number of pages kept in free lists that are still committed. + Length free_committed_pages_; + + // Number of pages that we committed in the last scavenge wait interval. + Length pages_committed_since_last_scavenge_; +#endif + bool GrowHeap(Length n); // REQUIRES span->length >= n @@ -1308,9 +1356,11 @@ class TCMalloc_PageHeap { // span of exactly the specified length. Else, returns NULL. Span* AllocLarge(Length n); +#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY // Incrementally release some memory to the system. // IncrementalScavenge(n) is called whenever n pages are freed. void IncrementalScavenge(Length n); +#endif // Number of pages to deallocate before doing more scavenging int64_t scavenge_counter_; @@ -1321,6 +1371,24 @@ class TCMalloc_PageHeap { #if defined(WTF_CHANGES) && PLATFORM(DARWIN) friend class FastMallocZone; #endif + +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + static NO_RETURN void* runScavengerThread(void*); + + NO_RETURN void scavengerThread(); + + void scavenge(); + + inline bool shouldContinueScavenging() const; + + pthread_mutex_t m_scavengeMutex; + + pthread_cond_t m_scavengeCondition; + + // Keeps track of whether the background thread is actively scavenging memory every kScavengeTimerDelayInSeconds, or + // it's blocked waiting for more pages to be deleted. + bool m_scavengeThreadActive; +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY }; void TCMalloc_PageHeap::init() @@ -1329,6 +1397,12 @@ void TCMalloc_PageHeap::init() pagemap_cache_ = PageMapCache(0); free_pages_ = 0; system_bytes_ = 0; + +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + free_committed_pages_ = 0; + pages_committed_since_last_scavenge_ = 0; +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + scavenge_counter_ = 0; // Start scavenging at kMaxPages list scavenge_index_ = kMaxPages-1; @@ -1339,8 +1413,68 @@ void TCMalloc_PageHeap::init() DLL_Init(&free_[i].normal); DLL_Init(&free_[i].returned); } + +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + pthread_mutex_init(&m_scavengeMutex, 0); + pthread_cond_init(&m_scavengeCondition, 0); + m_scavengeThreadActive = true; + pthread_t thread; + pthread_create(&thread, 0, runScavengerThread, this); +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY +} + +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY +void* TCMalloc_PageHeap::runScavengerThread(void* context) +{ + static_cast<TCMalloc_PageHeap*>(context)->scavengerThread(); +#if COMPILER(MSVC) + // Without this, Visual Studio will complain that this method does not return a value. + return 0; +#endif } +void TCMalloc_PageHeap::scavenge() +{ + // If we have to commit memory in the last 5 seconds, it means we don't have enough free committed pages + // for the amount of allocations that we do. So hold off on releasing memory back to the system. + if (pages_committed_since_last_scavenge_ > 0) { + pages_committed_since_last_scavenge_ = 0; + return; + } + Length pagesDecommitted = 0; + for (int i = kMaxPages; i >= 0; i--) { + SpanList* slist = (static_cast<size_t>(i) == kMaxPages) ? &large_ : &free_[i]; + if (!DLL_IsEmpty(&slist->normal)) { + // Release the last span on the normal portion of this list + Span* s = slist->normal.prev; + // Only decommit up to a fraction of the free committed pages if pages_allocated_since_last_scavenge_ > 0. + if ((pagesDecommitted + s->length) * kMaxScavengeAmountFactor > free_committed_pages_) + continue; + DLL_Remove(s); + TCMalloc_SystemRelease(reinterpret_cast<void*>(s->start << kPageShift), + static_cast<size_t>(s->length << kPageShift)); + if (!s->decommitted) { + pagesDecommitted += s->length; + s->decommitted = true; + } + DLL_Prepend(&slist->returned, s); + // We can stop scavenging if the number of free committed pages left is less than or equal to the minimum number we want to keep around. + if (free_committed_pages_ <= kMinimumFreeCommittedPageCount + pagesDecommitted) + break; + } + } + pages_committed_since_last_scavenge_ = 0; + ASSERT(free_committed_pages_ >= pagesDecommitted); + free_committed_pages_ -= pagesDecommitted; +} + +inline bool TCMalloc_PageHeap::shouldContinueScavenging() const +{ + return free_committed_pages_ > kMinimumFreeCommittedPageCount; +} + +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + inline Span* TCMalloc_PageHeap::New(Length n) { ASSERT(Check()); ASSERT(n > 0); @@ -1366,7 +1500,18 @@ inline Span* TCMalloc_PageHeap::New(Length n) { if (result->decommitted) { TCMalloc_SystemCommit(reinterpret_cast<void*>(result->start << kPageShift), static_cast<size_t>(n << kPageShift)); result->decommitted = false; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + pages_committed_since_last_scavenge_ += n; +#endif + } +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + else { + // The newly allocated memory is from a span that's in the normal span list (already committed). Update the + // free committed pages count. + ASSERT(free_committed_pages_ >= n); + free_committed_pages_ -= n; } +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY ASSERT(Check()); free_pages_ -= n; return result; @@ -1426,7 +1571,18 @@ Span* TCMalloc_PageHeap::AllocLarge(Length n) { if (best->decommitted) { TCMalloc_SystemCommit(reinterpret_cast<void*>(best->start << kPageShift), static_cast<size_t>(n << kPageShift)); best->decommitted = false; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + pages_committed_since_last_scavenge_ += n; +#endif + } +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + else { + // The newly allocated memory is from a span that's in the normal span list (already committed). Update the + // free committed pages count. + ASSERT(free_committed_pages_ >= n); + free_committed_pages_ -= n; } +#endif // USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY ASSERT(Check()); free_pages_ -= n; return best; @@ -1508,6 +1664,10 @@ inline void TCMalloc_PageHeap::Delete(Span* span) { // necessary. We do not bother resetting the stale pagemap // entries for the pieces we are merging together because we only // care about the pagemap entries for the boundaries. +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + // Track the total size of the neighboring free spans that are committed. + Length neighboringCommittedSpansLength = 0; +#endif const PageID p = span->start; const Length n = span->length; Span* prev = GetDescriptor(p-1); @@ -1515,6 +1675,10 @@ inline void TCMalloc_PageHeap::Delete(Span* span) { // Merge preceding span into this span ASSERT(prev->start + prev->length == p); const Length len = prev->length; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + if (!prev->decommitted) + neighboringCommittedSpansLength += len; +#endif mergeDecommittedStates(span, prev); DLL_Remove(prev); DeleteSpan(prev); @@ -1528,6 +1692,10 @@ inline void TCMalloc_PageHeap::Delete(Span* span) { // Merge next span into this span ASSERT(next->start == p+n); const Length len = next->length; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + if (!next->decommitted) + neighboringCommittedSpansLength += len; +#endif mergeDecommittedStates(span, next); DLL_Remove(next); DeleteSpan(next); @@ -1551,10 +1719,27 @@ inline void TCMalloc_PageHeap::Delete(Span* span) { } free_pages_ += n; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + if (span->decommitted) { + // If the merged span is decommitted, that means we decommitted any neighboring spans that were + // committed. Update the free committed pages count. + free_committed_pages_ -= neighboringCommittedSpansLength; + } else { + // If the merged span remains committed, add the deleted span's size to the free committed pages count. + free_committed_pages_ += n; + } + + // Make sure the scavenge thread becomes active if we have enough freed pages to release some back to the system. + if (!m_scavengeThreadActive && shouldContinueScavenging()) + pthread_cond_signal(&m_scavengeCondition); +#else IncrementalScavenge(n); +#endif + ASSERT(Check()); } +#if !USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY void TCMalloc_PageHeap::IncrementalScavenge(Length n) { // Fast path; not yet time to release memory scavenge_counter_ -= n; @@ -1592,6 +1777,7 @@ void TCMalloc_PageHeap::IncrementalScavenge(Length n) { // Nothing to scavenge, delay for a while scavenge_counter_ = kDefaultReleaseDelay; } +#endif void TCMalloc_PageHeap::RegisterSizeClass(Span* span, size_t sc) { // Associate span object with all interior pages as well @@ -1703,6 +1889,10 @@ bool TCMalloc_PageHeap::GrowHeap(Length n) { } ask = actual_size >> kPageShift; +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY + pages_committed_since_last_scavenge_ += ask; +#endif + uint64_t old_system_bytes = system_bytes_; system_bytes_ += (ask << kPageShift); const PageID p = reinterpret_cast<uintptr_t>(ptr) >> kPageShift; @@ -2083,6 +2273,34 @@ static inline TCMalloc_PageHeap* getPageHeap() #define pageheap getPageHeap() +#if USE_BACKGROUND_THREAD_TO_SCAVENGE_MEMORY +#if PLATFORM(WIN) +static void sleep(unsigned seconds) +{ + ::Sleep(seconds * 1000); +} +#endif + +void TCMalloc_PageHeap::scavengerThread() +{ + while (1) { + if (!shouldContinueScavenging()) { + pthread_mutex_lock(&m_scavengeMutex); + m_scavengeThreadActive = false; + // Block until there are enough freed pages to release back to the system. + pthread_cond_wait(&m_scavengeCondition, &m_scavengeMutex); + m_scavengeThreadActive = true; + pthread_mutex_unlock(&m_scavengeMutex); + } + sleep(kScavengeTimerDelayInSeconds); + { + SpinLockHolder h(&pageheap_lock); + pageheap->scavenge(); + } + } +} +#endif + // If TLS is available, we also store a copy // of the per-thread object in a __thread variable // since __thread variables are faster to read @@ -3364,7 +3582,7 @@ void* fastMalloc(size_t size) return malloc<true>(size); } -void* tryFastMalloc(size_t size) +TryMallocReturnValue tryFastMalloc(size_t size) { return malloc<false>(size); } @@ -3425,7 +3643,7 @@ void* fastCalloc(size_t n, size_t elem_size) return calloc<true>(n, elem_size); } -void* tryFastCalloc(size_t n, size_t elem_size) +TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size) { return calloc<false>(n, elem_size); } @@ -3489,7 +3707,7 @@ void* fastRealloc(void* old_ptr, size_t new_size) return realloc<true>(old_ptr, new_size); } -void* tryFastRealloc(void* old_ptr, size_t new_size) +TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size) { return realloc<false>(old_ptr, new_size); } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h index 61ebe32..b23e7b0 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/FastMalloc.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,24 +22,56 @@ #define WTF_FastMalloc_h #include "Platform.h" +#include "PossiblyNull.h" #include <stdlib.h> #include <new> namespace WTF { // These functions call CRASH() if an allocation fails. - void* fastMalloc(size_t n); - void* fastZeroedMalloc(size_t n); - void* fastCalloc(size_t n_elements, size_t element_size); - void* fastRealloc(void* p, size_t n); + void* fastMalloc(size_t); + void* fastZeroedMalloc(size_t); + void* fastCalloc(size_t numElements, size_t elementSize); + void* fastRealloc(void*, size_t); + + struct TryMallocReturnValue { + TryMallocReturnValue(void* data) + : m_data(data) + { + } + TryMallocReturnValue(const TryMallocReturnValue& source) + : m_data(source.m_data) + { + source.m_data = 0; + } + ~TryMallocReturnValue() { ASSERT(!m_data); } + template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN; + template <typename T> operator PossiblyNull<T>() + { + T value; + getValue(value); + return PossiblyNull<T>(value); + } + private: + mutable void* m_data; + }; + + template <typename T> bool TryMallocReturnValue::getValue(T& data) + { + union u { void* data; T target; } res; + res.data = m_data; + data = res.target; + bool returnValue = !!m_data; + m_data = 0; + return returnValue; + } - // These functions return NULL if an allocation fails. - void* tryFastMalloc(size_t n); - void* tryFastZeroedMalloc(size_t n); - void* tryFastCalloc(size_t n_elements, size_t element_size); - void* tryFastRealloc(void* p, size_t n); + TryMallocReturnValue tryFastMalloc(size_t n); + TryMallocReturnValue tryFastZeroedMalloc(size_t n); + TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size); + TryMallocReturnValue tryFastRealloc(void* p, size_t n); - void fastFree(void* p); + void fastFree(void*); #ifndef NDEBUG void fastMallocForbid(); @@ -172,22 +204,24 @@ using WTF::fastMallocAllow; #define WTF_PRIVATE_INLINE inline #endif -#ifndef _CRTDBG_MAP_ALLOC +#if !defined(_CRTDBG_MAP_ALLOC) && !(defined(USE_SYSTEM_MALLOC) && USE_SYSTEM_MALLOC) -#if !defined(USE_SYSTEM_MALLOC) || !(USE_SYSTEM_MALLOC) -WTF_PRIVATE_INLINE void* operator new(size_t s) { return fastMalloc(s); } -WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); } -WTF_PRIVATE_INLINE void* operator new[](size_t s) { return fastMalloc(s); } -WTF_PRIVATE_INLINE void operator delete[](void* p) { fastFree(p); } +// The nothrow functions here are actually not all that helpful, because fastMalloc will +// call CRASH() rather than returning 0, and returning 0 is what nothrow is all about. +// But since WebKit code never uses exceptions or nothrow at all, this is probably OK. +// Long term we will adopt FastAllocBase.h everywhere, and and replace this with +// debug-only code to make sure we don't use the system malloc via the default operator +// new by accident. -#if PLATFORM(WINCE) -WTF_PRIVATE_INLINE void* operator new(size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); } +WTF_PRIVATE_INLINE void* operator new(size_t size) { return fastMalloc(size); } +WTF_PRIVATE_INLINE void* operator new(size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } +WTF_PRIVATE_INLINE void operator delete(void* p) { fastFree(p); } WTF_PRIVATE_INLINE void operator delete(void* p, const std::nothrow_t&) throw() { fastFree(p); } -WTF_PRIVATE_INLINE void* operator new[](size_t s, const std::nothrow_t&) throw() { return fastMalloc(s); } +WTF_PRIVATE_INLINE void* operator new[](size_t size) { return fastMalloc(size); } +WTF_PRIVATE_INLINE void* operator new[](size_t size, const std::nothrow_t&) throw() { return fastMalloc(size); } +WTF_PRIVATE_INLINE void operator delete[](void* p) { fastFree(p); } WTF_PRIVATE_INLINE void operator delete[](void* p, const std::nothrow_t&) throw() { fastFree(p); } -#endif -#endif -#endif // _CRTDBG_MAP_ALLOC +#endif #endif /* WTF_FastMalloc_h */ diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h index 8ff9170..3de5ee6 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashMap.h @@ -178,10 +178,7 @@ namespace WTF { HashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); - typename HashMap<T, U, V, W, X>::iterator temp = p.first; - return make_pair<typename HashMap<T, U, V, W, X>::iterator, bool>(temp, p.second); -// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h index ec809e5..f4e2cf7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/HashSet.h @@ -29,6 +29,8 @@ namespace WTF { template<typename Value, typename HashFunctions, typename Traits> class HashSet; template<typename Value, typename HashFunctions, typename Traits> void deleteAllValues(const HashSet<Value, HashFunctions, Traits>&); + template<typename Value, typename HashFunctions, typename Traits> + void fastDeleteAllValues(const HashSet<Value, HashFunctions, Traits>&); template<typename T> struct IdentityExtractor; @@ -91,6 +93,7 @@ namespace WTF { private: friend void deleteAllValues<>(const HashSet&); + friend void fastDeleteAllValues<>(const HashSet&); HashTableType m_impl; }; @@ -204,12 +207,7 @@ namespace WTF { template<typename T, typename U, typename V> pair<typename HashSet<T, U, V>::iterator, bool> HashSet<T, U, V>::add(const ValueType& value) { - pair<typename HashTable<T, T, IdentityExtractor<T>, U, V, V>::iterator, bool> p = m_impl.add(value); - typename HashSet<T, U, V>::iterator temp = p.first; - pair<typename HashSet<T, U, V>::iterator, bool> p2 = make_pair<typename HashSet<T, U, V>::iterator, bool>(temp, p.second); - // p2.first = p.first; - // p2.second = p.second; - return p2; + return m_impl.add(value); } template<typename Value, typename HashFunctions, typename Traits> @@ -218,8 +216,7 @@ namespace WTF { HashSet<Value, HashFunctions, Traits>::add(const T& value) { typedef HashSetTranslatorAdapter<ValueType, ValueTraits, T, HashTranslator> Adapter; - pair<typename HashTableType::iterator, bool> p = m_impl.template addPassingHashCode<T, T, Adapter>(value, value); - return make_pair<iterator, bool>(p.first, p.second); + return m_impl.template addPassingHashCode<T, T, Adapter>(value, value); } template<typename T, typename U, typename V> @@ -257,6 +254,21 @@ namespace WTF { { deleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl); } + + template<typename ValueType, typename HashTableType> + void fastDeleteAllValues(HashTableType& collection) + { + typedef typename HashTableType::const_iterator iterator; + iterator end = collection.end(); + for (iterator it = collection.begin(); it != end; ++it) + fastDelete(*it); + } + + template<typename T, typename U, typename V> + inline void fastDeleteAllValues(const HashSet<T, U, V>& collection) + { + fastDeleteAllValues<typename HashSet<T, U, V>::ValueType>(collection.m_impl); + } template<typename T, typename U, typename V, typename W> inline void copyToVector(const HashSet<T, U, V>& collection, W& vector) diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp index 3c19b7a..e999094 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.cpp @@ -29,9 +29,9 @@ #include "config.h" #include "MainThread.h" +#include "StdLibExtras.h" #include "CurrentTime.h" #include "Deque.h" -#include "StdLibExtras.h" #include "Threading.h" namespace WTF { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h index b8305b5..01ce804 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MainThread.h @@ -34,9 +34,7 @@ namespace WTF { class Mutex; -extern "C" { - typedef void MainThreadFunction(void*); -} +typedef void MainThreadFunction(void*); void callOnMainThread(MainThreadFunction*, void* context); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h index 070b76c..12291cc 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/MessageQueue.h @@ -41,7 +41,7 @@ namespace WTF { enum MessageQueueWaitResult { MessageQueueTerminated, // Queue was destroyed while waiting for message. MessageQueueTimeout, // Timeout was specified and it expired. - MessageQueueMessageReceived // A message was successfully received and returned. + MessageQueueMessageReceived, // A message was successfully received and returned. }; template<typename DataType> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h index c50c9d8..60a46e2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Noncopyable.h @@ -28,7 +28,7 @@ namespace WTFNoncopyable { - class Noncopyable { + class Noncopyable : public FastAllocBase { Noncopyable(const Noncopyable&); Noncopyable& operator=(const Noncopyable&); protected: diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h index d80ed62..ae398d3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PassRefPtr.h @@ -28,11 +28,34 @@ namespace WTF { template<typename T> class RefPtr; template<typename T> class PassRefPtr; template <typename T> PassRefPtr<T> adoptRef(T*); + + // Remove inline for winscw compiler to prevent the compiler agressively resolving + // T::deref(), which will fail compiling when PassRefPtr<T> is used as class member + // or function arguments before T is defined. + template<typename T> +#if !COMPILER(WINSCW) + inline +#endif + void derefIfNotNull(T* ptr) + { + if (UNLIKELY(ptr != 0)) + ptr->deref(); + } + + template<typename T> +#if !COMPILER(WINSCW) + inline +#endif + void refIfNotNull(T* ptr) + { + if (UNLIKELY(ptr != 0)) + ptr->ref(); + } template<typename T> class PassRefPtr { public: PassRefPtr() : m_ptr(0) {} - PassRefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); } + PassRefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } // It somewhat breaks the type system to allow transfer of ownership out of // a const PassRefPtr. However, it makes it much easier to work with PassRefPtr // temporaries, and we don't really have a need to use real const PassRefPtrs @@ -40,14 +63,14 @@ namespace WTF { PassRefPtr(const PassRefPtr& o) : m_ptr(o.releaseRef()) {} template <typename U> PassRefPtr(const PassRefPtr<U>& o) : m_ptr(o.releaseRef()) { } - ALWAYS_INLINE ~PassRefPtr() { if (UNLIKELY(m_ptr != 0)) m_ptr->deref(); } - + ALWAYS_INLINE ~PassRefPtr() { derefIfNotNull(m_ptr); } + template <class U> - PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } + PassRefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { T* ptr = m_ptr; refIfNotNull(ptr); } T* get() const { return m_ptr; } - void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; } + void clear() { T* ptr = m_ptr; derefIfNotNull(ptr); m_ptr = 0; } T* releaseRef() const { T* tmp = m_ptr; m_ptr = 0; return tmp; } T& operator*() const { return *m_ptr; } @@ -56,12 +79,10 @@ namespace WTF { bool operator!() const { return !m_ptr; } // This conversion operator allows implicit conversion to bool but not to other integer types. -#if COMPILER(WINSCW) - operator bool() const { return m_ptr; } -#else - typedef T* PassRefPtr::*UnspecifiedBoolType; + // Parenthesis is needed for winscw compiler to resolve class qualifier in this case. + typedef T* (PassRefPtr::*UnspecifiedBoolType); operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::m_ptr : 0; } -#endif + PassRefPtr& operator=(T*); PassRefPtr& operator=(const PassRefPtr&); template <typename U> PassRefPtr& operator=(const PassRefPtr<U>&); @@ -77,23 +98,19 @@ namespace WTF { template <typename T> template <typename U> inline PassRefPtr<T>& PassRefPtr<T>::operator=(const RefPtr<U>& o) { T* optr = o.get(); - if (optr) - optr->ref(); + refIfNotNull(optr); T* ptr = m_ptr; m_ptr = optr; - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } template <typename T> inline PassRefPtr<T>& PassRefPtr<T>::operator=(T* optr) { - if (optr) - optr->ref(); + refIfNotNull(optr); T* ptr = m_ptr; m_ptr = optr; - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } @@ -101,8 +118,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = ref.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } @@ -110,8 +126,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = ref.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h index fa37d55..65b1570 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Platform.h @@ -94,23 +94,6 @@ #define WTF_PLATFORM_SOLARIS 1 #endif -/* PLATFORM(AIX) */ -/* Operating system level dependencies for AIX that should be used */ -/* regardless of operating environment */ -#if defined(_AIX) -#define WTF_PLATFORM_AIX 1 -#endif - -/* PLATFORM(HPUX) */ -/* Operating system level dependencies for HP-UX that should be used */ -/* regardless of operating environment */ -#if defined(hpux) || defined(__hpux) -#define WTF_PLATFORM_HPUX 1 -#ifndef MAP_ANON -#define MAP_ANON MAP_ANONYMOUS -#endif -#endif - #if defined (__SYMBIAN32__) /* we are cross-compiling, it is not really windows */ #undef WTF_PLATFORM_WIN_OS @@ -140,12 +123,11 @@ || PLATFORM(FREEBSD) \ || PLATFORM(SYMBIAN) \ || PLATFORM(NETBSD) \ - || PLATFORM(SOLARIS) \ - || PLATFORM(HPUX) \ || defined(unix) \ || defined(__unix) \ || defined(__unix__) \ - || PLATFORM(AIX) \ + || defined(_AIX) \ + || defined(__HAIKU__) \ || defined(__QNXNTO__) #define WTF_PLATFORM_UNIX 1 #endif @@ -171,6 +153,8 @@ #define WTF_PLATFORM_WX 1 #elif defined(BUILDING_GTK__) #define WTF_PLATFORM_GTK 1 +#elif defined(BUILDING_HAIKU__) +#define WTF_PLATFORM_HAIKU 1 #elif PLATFORM(DARWIN) #define WTF_PLATFORM_MAC 1 #elif PLATFORM(WIN_OS) @@ -217,7 +201,7 @@ /* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */ /* FIXME: This should be changed from a blacklist to a whitelist */ -#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) +#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) && !PLATFORM(HAIKU) #define WTF_PLATFORM_CAIRO 1 #endif @@ -248,12 +232,9 @@ #define WTF_PLATFORM_ARM 1 #if defined(__ARMEB__) #define WTF_PLATFORM_BIG_ENDIAN 1 -#elif !defined(__ARM_EABI__) && !defined(__ARMEB__) && !defined(__VFP_FP__) +#elif !defined(__ARM_EABI__) && !defined(__EABI__) && !defined(__VFP_FP__) #define WTF_PLATFORM_MIDDLE_ENDIAN 1 #endif -#if !defined(__ARM_EABI__) -#define WTF_PLATFORM_FORCE_PACK 1 -#endif #define ARM_ARCH_VERSION 3 #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) #undef ARM_ARCH_VERSION @@ -299,35 +280,11 @@ #endif /* PLATFORM(SPARC64) */ -#if defined(__sparc64__) +#if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) #define WTF_PLATFORM_SPARC64 1 #define WTF_PLATFORM_BIG_ENDIAN 1 #endif -/* PLATFORM(HPPA) */ -/* a.k.a. PA-RISC */ -#if defined(__hppa) || defined(__hppa__) -#define WTF_PLATFORM_HPPA 1 -#define WTF_PLATFORM_BIG_ENDIAN 1 -#endif - -/* PLATFORM(IA64) */ -/* a.k.a. Itanium Processor Family, IPF */ -#if defined(__ia64) || defined(__ia64__) || defined(_M_IA64) -#define WTF_PLATFORM_IA64 1 - -/* Itanium can be both big- and little-endian - we need to determine at compile time which one it is. - - HP's aCC compiler only compiles big-endian (so HP-UXi is always big-endian) - - GCC defines __BIG_ENDIAN__ for us (default on HP-UX) - - Linux is usually little-endian - - I've never seen AIX or Windows on IA-64, but they should be little-endian too -*/ -#if defined(__BIG_ENDIAN__) || defined(__HP_aCC) -# define WTF_PLATFORM_BIG_ENDIAN 1 -#endif -#endif - /* PLATFORM(WINCE) && PLATFORM(QT) We can not determine the endianess at compile time. For Qt for Windows CE the endianess is specified in the @@ -386,28 +343,15 @@ #define WTF_COMPILER_WINSCW 1 #endif -/* COMPILER(SUNCC) */ -/* This is the Sun CC compiler, also known as Sun Studio or Sun Pro */ -#if defined(__SUNPRO_CC) || defined(__SUNPRO_C) -#define WTF_COMPILER_SUNCC 1 -#endif - -/* COMPILER(XLC) */ -/* IBM Visual Age C/C++ compiler, a.k.a. xlC */ -#if defined(__xlC__) -#define WTF_COMPILER_XLC 1 -#endif - -/* COMPILER(ACC) */ -/* HP's aC++/ANSI C compiler, a.k.a. aCC */ -#if defined(__HP_aCC) -#define WTF_COMPILER_ACC -#endif - #if (PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN)) && !defined(ENABLE_JSC_MULTIPLE_THREADS) #define ENABLE_JSC_MULTIPLE_THREADS 1 #endif +/* On Windows, use QueryPerformanceCounter by default */ +#if PLATFORM(WIN_OS) +#define WTF_USE_QUERY_PERFORMANCE_COUNTER 1 +#endif + #if PLATFORM(WINCE) && !PLATFORM(QT) #undef ENABLE_JSC_MULTIPLE_THREADS #define ENABLE_JSC_MULTIPLE_THREADS 0 @@ -438,6 +382,8 @@ /* for Unicode, KDE uses Qt */ #if PLATFORM(KDE) || PLATFORM(QT) #define WTF_USE_QT4_UNICODE 1 +#elif PLATFORM(WINCE) +#define WTF_USE_WINCE_UNICODE 1 #elif PLATFORM(GTK) /* The GTK+ Unicode backend is configurable */ #else @@ -465,7 +411,10 @@ #if PLATFORM(IPHONE) #define WTF_PLATFORM_CF 1 #define WTF_USE_PTHREADS 1 +#define ENABLE_CONTEXT_MENUS 0 +#define ENABLE_DRAG_SUPPORT 0 #define ENABLE_FTPDIR 1 +#define ENABLE_INSPECTOR 0 #define ENABLE_MAC_JAVA_BRIDGE 0 #define ENABLE_ICONDATABASE 0 #define ENABLE_GEOLOCATION 1 @@ -480,8 +429,6 @@ #if PLATFORM(WX) #define ENABLE_ASSEMBLER 1 -#define WTF_USE_CURL 1 -#define WTF_USE_PTHREADS 1 #endif #if PLATFORM(GTK) @@ -490,6 +437,14 @@ #endif #endif +#if PLATFORM(HAIKU) +#define HAVE_POSIX_MEMALIGN 1 +#define WTF_USE_CURL 1 +#define WTF_USE_PTHREADS 1 +#define USE_SYSTEM_MALLOC 1 +#define ENABLE_NETSCAPE_PLUGIN_API 0 +#endif + #if !defined(HAVE_ACCESSIBILITY) #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) #define HAVE_ACCESSIBILITY 1 @@ -501,7 +456,7 @@ #endif #if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ - && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(AIX) && !PLATFORM(HPUX) + && !PLATFORM(SYMBIAN) && !PLATFORM(HAIKU) && !COMPILER(RVCT) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 @@ -565,7 +520,10 @@ /* FIXME: is this actually used or do other platforms generate their own config.h? */ #define HAVE_ERRNO_H 1 +/* As long as Haiku doesn't have a complete support of locale this will be disabled. */ +#if !PLATFORM(HAIKU) #define HAVE_LANGINFO_H 1 +#endif #define HAVE_MMAP 1 #define HAVE_SBRK 1 #define HAVE_STRINGS_H 1 @@ -598,10 +556,22 @@ #define ENABLE_FTPDIR 1 #endif +#if !defined(ENABLE_CONTEXT_MENUS) +#define ENABLE_CONTEXT_MENUS 1 +#endif + +#if !defined(ENABLE_DRAG_SUPPORT) +#define ENABLE_DRAG_SUPPORT 1 +#endif + #if !defined(ENABLE_DASHBOARD_SUPPORT) #define ENABLE_DASHBOARD_SUPPORT 0 #endif +#if !defined(ENABLE_INSPECTOR) +#define ENABLE_INSPECTOR 1 +#endif + #if !defined(ENABLE_MAC_JAVA_BRIDGE) #define ENABLE_MAC_JAVA_BRIDGE 0 #endif @@ -629,6 +599,10 @@ #define ENABLE_GEOLOCATION 0 #endif +#if !defined(ENABLE_NOTIFICATIONS) +#define ENABLE_NOTIFICATIONS 0 +#endif + #if !defined(ENABLE_TEXT_CARET) #define ENABLE_TEXT_CARET 1 #endif @@ -637,9 +611,19 @@ #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0 #endif -#if !defined(WTF_USE_ALTERNATE_JSIMMEDIATE) && PLATFORM(X86_64) && PLATFORM(MAC) -#define WTF_USE_ALTERNATE_JSIMMEDIATE 1 +#if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) +#if PLATFORM(X86_64) && (PLATFORM(DARWIN) || PLATFORM(LINUX)) +#define WTF_USE_JSVALUE64 1 +#elif PLATFORM(ARM) || PLATFORM(PPC64) +#define WTF_USE_JSVALUE32 1 +#elif PLATFORM(WIN_OS) && COMPILER(MINGW) +/* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg +on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */ +#define WTF_USE_JSVALUE32 1 +#else +#define WTF_USE_JSVALUE32_64 1 #endif +#endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */ #if !defined(ENABLE_REPAINT_THROTTLING) #define ENABLE_REPAINT_THROTTLING 0 @@ -663,18 +647,20 @@ #define ENABLE_JIT 1 #endif -#if PLATFORM(X86) && PLATFORM(QT) -#if PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100 +#if PLATFORM(QT) +#if PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(WIN_OS) && COMPILER(MSVC) +#elif PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 -#elif PLATFORM(LINUX) && GCC_VERSION >= 40100 +#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 +#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX) + #define ENABLE_JIT 1 #endif -#endif /* PLATFORM(QT) && PLATFORM(X86) */ +#endif /* PLATFORM(QT) */ #endif /* !defined(ENABLE_JIT) */ @@ -688,9 +674,6 @@ #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1 #endif -#ifndef ENABLE_JIT_OPTIMIZE_ARITHMETIC -#define ENABLE_JIT_OPTIMIZE_ARITHMETIC 1 -#endif #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1 #endif @@ -727,10 +710,11 @@ #define ENABLE_YARR_JIT 1 #endif -#if PLATFORM(X86) && PLATFORM(QT) -#if (PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ - || (PLATFORM(WIN_OS) && COMPILER(MSVC)) \ - || (PLATFORM(LINUX) && GCC_VERSION >= 40100) +#if PLATFORM(QT) +#if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ + || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \ + || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \ + || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif @@ -748,7 +732,7 @@ #endif /* Setting this flag prevents the assembler from using RWX memory; this may improve security but currectly comes at a significant performance cost. */ -#if PLATFORM(ARM) +#if PLATFORM(IPHONE) #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1 #else #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0 @@ -758,10 +742,6 @@ #define ENABLE_PAN_SCROLLING 1 #endif -#if !defined(ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER) -#define ENABLE_ACTIVEX_TYPE_CONVERSION_WMPLAYER 1 -#endif - /* Use the QtXmlStreamReader implementation for XMLTokenizer */ #if PLATFORM(QT) #if !ENABLE(XSLT) @@ -784,4 +764,13 @@ #define WTF_USE_ACCELERATED_COMPOSITING 1 #endif +#if COMPILER(GCC) +#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result)) +#else +#define WARN_UNUSED_RETURN +#endif + +/* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */ +#define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK + #endif /* WTF_Platform_h */ diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h new file mode 100644 index 0000000..79c4d82 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PossiblyNull.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 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. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#ifndef PossiblyNull_h +#define PossiblyNull_h + +#include "Assertions.h" + +namespace WTF { + +template <typename T> struct PossiblyNull { + PossiblyNull(T data) + : m_data(data) + { + } + PossiblyNull(const PossiblyNull<T>& source) + : m_data(source.m_data) + { + source.m_data = 0; + } + ~PossiblyNull() { ASSERT(!m_data); } + bool getValue(T& out) WARN_UNUSED_RETURN; +private: + mutable T m_data; +}; + +template <typename T> bool PossiblyNull<T>::getValue(T& out) +{ + out = m_data; + bool result = !!m_data; + m_data = 0; + return result; +} + +} + +#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h index f4527df..5d0bd2a 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h @@ -34,10 +34,8 @@ #include <wtf/Assertions.h> namespace WTF { - template<class T, typename FlagEnum> class PtrAndFlags { + template<class T, typename FlagEnum> class PtrAndFlagsBase { public: - PtrAndFlags() : m_ptrAndFlags(0) {} - bool isFlagSet(FlagEnum flagNumber) const { ASSERT(flagNumber < 2); return m_ptrAndFlags & (1 << flagNumber); } void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);} void clearFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags &= ~(1 << flagNumber);} @@ -51,14 +49,31 @@ namespace WTF { #endif } - private: + bool operator!() const { return !get(); } + T* operator->() const { return reinterpret_cast<T*>(m_ptrAndFlags & ~3); } + + protected: intptr_t m_ptrAndFlags; #ifndef NDEBUG void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced. #endif }; + + template<class T, typename FlagEnum> class PtrAndFlags : public PtrAndFlagsBase<T, FlagEnum> { + public: + PtrAndFlags() + { + PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0; + } + PtrAndFlags(T* ptr) + { + PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0; + set(ptr); + } + }; } // namespace WTF +using WTF::PtrAndFlagsBase; using WTF::PtrAndFlags; #endif // PtrAndFlags_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h index 74cd0ea..77835ad 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtr.h @@ -36,8 +36,8 @@ namespace WTF { template <typename T> class RefPtr : public FastAllocBase { public: RefPtr() : m_ptr(0) { } - RefPtr(T* ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); } - RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T* ptr = m_ptr) ptr->ref(); } + RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } + RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { T* ptr = m_ptr; refIfNotNull(ptr); } // see comment in PassRefPtr.h for why this takes const reference template <typename U> RefPtr(const PassRefPtr<U>&); @@ -48,13 +48,13 @@ namespace WTF { RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { } bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); } - ~RefPtr() { if (T* ptr = m_ptr) ptr->deref(); } + ~RefPtr() { T* ptr = m_ptr; derefIfNotNull(ptr); } template <typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { if (T* ptr = m_ptr) ptr->ref(); } T* get() const { return m_ptr; } - void clear() { if (T* ptr = m_ptr) ptr->deref(); m_ptr = 0; } + void clear() { T* ptr = m_ptr; derefIfNotNull(ptr); m_ptr = 0; } PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; } T& operator*() const { return *m_ptr; } @@ -92,35 +92,29 @@ namespace WTF { template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<T>& o) { T* optr = o.get(); - if (optr) - optr->ref(); + refIfNotNull(optr); T* ptr = m_ptr; m_ptr = optr; - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } template <typename T> template <typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o) { T* optr = o.get(); - if (optr) - optr->ref(); + refIfNotNull(optr); T* ptr = m_ptr; m_ptr = optr; - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } template <typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr) { - if (optr) - optr->ref(); + refIfNotNull(optr); T* ptr = m_ptr; m_ptr = optr; - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } @@ -128,8 +122,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = o.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } @@ -137,8 +130,7 @@ namespace WTF { { T* ptr = m_ptr; m_ptr = o.releaseRef(); - if (ptr) - ptr->deref(); + derefIfNotNull(ptr); return *this; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h index b3ccd3a..9433025 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/RefPtrHashMap.h @@ -42,7 +42,7 @@ namespace WTF { }; template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class RefPtrHashMap { + class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : public FastAllocBase { private: typedef KeyTraitsArg KeyTraits; typedef MappedTraitsArg MappedTraits; @@ -67,7 +67,7 @@ namespace WTF { typedef HashTableIteratorAdapter<HashTableType, ValueType> iterator; typedef HashTableConstIteratorAdapter<HashTableType, ValueType> const_iterator; - void swap(RefPtrHashMap&); + void swap(HashMap&); int size() const; int capacity() const; @@ -115,123 +115,109 @@ namespace WTF { HashTableType m_impl; }; - template<typename T, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> - class HashMap<RefPtr<T>, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> : - public RefPtrHashMap<T, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> - { - }; template<typename T, typename U, typename V, typename W, typename X> - inline void RefPtrHashMap<T, U, V, W, X>::swap(RefPtrHashMap& other) + inline void HashMap<RefPtr<T>, U, V, W, X>::swap(HashMap& other) { m_impl.swap(other.m_impl); } template<typename T, typename U, typename V, typename W, typename X> - inline int RefPtrHashMap<T, U, V, W, X>::size() const + inline int HashMap<RefPtr<T>, U, V, W, X>::size() const { return m_impl.size(); } template<typename T, typename U, typename V, typename W, typename X> - inline int RefPtrHashMap<T, U, V, W, X>::capacity() const + inline int HashMap<RefPtr<T>, U, V, W, X>::capacity() const { return m_impl.capacity(); } template<typename T, typename U, typename V, typename W, typename X> - inline bool RefPtrHashMap<T, U, V, W, X>::isEmpty() const + inline bool HashMap<RefPtr<T>, U, V, W, X>::isEmpty() const { return m_impl.isEmpty(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::begin() + inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::begin() { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::end() + inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::end() { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::begin() const + inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::begin() const { return m_impl.begin(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::end() const + inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::end() const { return m_impl.end(); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) + inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) + inline typename HashMap<RefPtr<T>, U, V, W, X>::iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(const KeyType& key) const + inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(const KeyType& key) const { return m_impl.find(key); } template<typename T, typename U, typename V, typename W, typename X> - inline typename RefPtrHashMap<T, U, V, W, X>::const_iterator RefPtrHashMap<T, U, V, W, X>::find(RawKeyType key) const + inline typename HashMap<RefPtr<T>, U, V, W, X>::const_iterator HashMap<RefPtr<T>, U, V, W, X>::find(RawKeyType key) const { return m_impl.template find<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool RefPtrHashMap<T, U, V, W, X>::contains(const KeyType& key) const + inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(const KeyType& key) const { return m_impl.contains(key); } template<typename T, typename U, typename V, typename W, typename X> - inline bool RefPtrHashMap<T, U, V, W, X>::contains(RawKeyType key) const + inline bool HashMap<RefPtr<T>, U, V, W, X>::contains(RawKeyType key) const { return m_impl.template contains<RawKeyType, RawKeyTranslator>(key); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) + inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(const KeyType& key, const MappedType& mapped) { typedef HashMapTranslator<ValueType, ValueTraits, HashFunctions> TranslatorType; - pair<typename HashTableType::iterator, bool> p = m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); -// typename RefPtrHashMap<T, U, V, W, X>::iterator temp = p.first; - return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( - typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); - -// return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); + return m_impl.template add<KeyType, MappedType, TranslatorType>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - inline pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) + inline pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::inlineAdd(RawKeyType key, const MappedType& mapped) { - pair<typename HashTableType::iterator, bool> p = m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); - return make_pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool>( - typename RefPtrHashMap<T, U, V, W, X>::iterator(p.first), p.second); - - // return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); + return m_impl.template add<RawKeyType, MappedType, RawKeyTranslator>(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) + pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::set(const KeyType& key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -242,8 +228,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) + pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::set(RawKeyType key, const MappedType& mapped) { pair<iterator, bool> result = inlineAdd(key, mapped); if (!result.second) { @@ -254,22 +240,22 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) + pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::add(const KeyType& key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename X> - pair<typename RefPtrHashMap<T, U, V, W, X>::iterator, bool> - RefPtrHashMap<T, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) + pair<typename HashMap<RefPtr<T>, U, V, W, X>::iterator, bool> + HashMap<RefPtr<T>, U, V, W, X>::add(RawKeyType key, const MappedType& mapped) { return inlineAdd(key, mapped); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType - RefPtrHashMap<T, U, V, W, MappedTraits>::get(const KeyType& key) const + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType + HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(const KeyType& key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).lookup(key); if (!entry) @@ -278,8 +264,8 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType - inline RefPtrHashMap<T, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType + inline HashMap<RefPtr<T>, U, V, W, MappedTraits>::inlineGet(RawKeyType key) const { ValueType* entry = const_cast<HashTableType&>(m_impl).template lookup<RawKeyType, RawKeyTranslator>(key); if (!entry) @@ -288,14 +274,14 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType - RefPtrHashMap<T, U, V, W, MappedTraits>::get(RawKeyType key) const + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType + HashMap<RefPtr<T>, U, V, W, MappedTraits>::get(RawKeyType key) const { return inlineGet(key); } template<typename T, typename U, typename V, typename W, typename X> - inline void RefPtrHashMap<T, U, V, W, X>::remove(iterator it) + inline void HashMap<RefPtr<T>, U, V, W, X>::remove(iterator it) { if (it.m_impl == m_impl.end()) return; @@ -304,45 +290,45 @@ namespace WTF { } template<typename T, typename U, typename V, typename W, typename X> - inline void RefPtrHashMap<T, U, V, W, X>::remove(const KeyType& key) + inline void HashMap<RefPtr<T>, U, V, W, X>::remove(const KeyType& key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void RefPtrHashMap<T, U, V, W, X>::remove(RawKeyType key) + inline void HashMap<RefPtr<T>, U, V, W, X>::remove(RawKeyType key) { remove(find(key)); } template<typename T, typename U, typename V, typename W, typename X> - inline void RefPtrHashMap<T, U, V, W, X>::clear() + inline void HashMap<RefPtr<T>, U, V, W, X>::clear() { m_impl.clear(); } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType - RefPtrHashMap<T, U, V, W, MappedTraits>::take(const KeyType& key) + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType + HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(const KeyType& key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } template<typename T, typename U, typename V, typename W, typename MappedTraits> - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType - RefPtrHashMap<T, U, V, W, MappedTraits>::take(RawKeyType key) + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType + HashMap<RefPtr<T>, U, V, W, MappedTraits>::take(RawKeyType key) { // This can probably be made more efficient to avoid ref/deref churn. iterator it = find(key); if (it == end()) return MappedTraits::emptyValue(); - typename RefPtrHashMap<T, U, V, W, MappedTraits>::MappedType result = it->second; + typename HashMap<RefPtr<T>, U, V, W, MappedTraits>::MappedType result = it->second; remove(it); return result; } diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h index 065c19c..b1cbc4d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/SegmentedVector.h @@ -116,6 +116,7 @@ namespace WTF { } size_t size() const { return m_size; } + bool isEmpty() const { return !size(); } T& at(size_t index) { @@ -249,4 +250,6 @@ namespace WTF { } // namespace WTF +using WTF::SegmentedVector; + #endif // SegmentedVector_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h index afc5e8a..d21d1ff 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StdLibExtras.h @@ -41,6 +41,11 @@ static type& name = *new type arguments #endif +// OBJECT_OFFSETOF: Like the C++ offsetof macro, but you can use it with classes. +// The magic number 0x4000 is insignificant. We use it to avoid using NULL, since +// NULL can cause compiler problems, especially in cases of multiple inheritance. +#define OBJECT_OFFSETOF(class, field) (reinterpret_cast<ptrdiff_t>(&(reinterpret_cast<class*>(0x4000)->field)) - 0x4000) + namespace WTF { /* diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h index 1c23390..559e3f2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/StringExtras.h @@ -85,4 +85,20 @@ inline int strcasecmp(const char* s1, const char* s2) #endif +#if PLATFORM(WIN_OS) || PLATFORM(LINUX) + +inline char* strnstr(const char* buffer, const char* target, size_t bufferLength) +{ + size_t targetLength = strlen(target); + if (targetLength == 0) + return const_cast<char*>(buffer); + for (const char* start = buffer; *start && start + targetLength <= buffer + bufferLength; start++) { + if (*start == *target && strncmp(start + 1, target + 1, targetLength - 1) == 0) + return const_cast<char*>(start); + } + return 0; +} + +#endif + #endif // WTF_StringExtras_h diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp index 478ce63..659bb0e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.cpp @@ -31,6 +31,14 @@ // Author: Sanjay Ghemawat #include "config.h" +#include "TCSystemAlloc.h" + +#include <algorithm> +#include <fcntl.h> +#include "Assertions.h" +#include "TCSpinLock.h" +#include "UnusedParam.h" + #if HAVE(STDINT_H) #include <stdint.h> #elif HAVE(INTTYPES_H) @@ -38,6 +46,7 @@ #else #include <sys/types.h> #endif + #if PLATFORM(WIN_OS) #include "windows.h" #else @@ -45,16 +54,13 @@ #include <unistd.h> #include <sys/mman.h> #endif -#include <fcntl.h> -#include "Assertions.h" -#include "TCSystemAlloc.h" -#include "TCSpinLock.h" -#include "UnusedParam.h" #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif +using namespace std; + // Structure for discovering alignment union MemoryAligner { void* p; @@ -441,6 +447,32 @@ void TCMalloc_SystemRelease(void* start, size_t length) ASSERT_UNUSED(newAddress, newAddress == start || newAddress == reinterpret_cast<void*>(MAP_FAILED)); } +#elif HAVE(VIRTUALALLOC) + +void TCMalloc_SystemRelease(void* start, size_t length) +{ + if (VirtualFree(start, length, MEM_DECOMMIT)) + return; + + // The decommit may fail if the memory region consists of allocations + // from more than one call to VirtualAlloc. In this case, fall back to + // using VirtualQuery to retrieve the allocation boundaries and decommit + // them each individually. + + char* ptr = static_cast<char*>(start); + char* end = ptr + length; + MEMORY_BASIC_INFORMATION info; + while (ptr < end) { + size_t resultSize = VirtualQuery(ptr, &info, sizeof(info)); + ASSERT_UNUSED(resultSize, resultSize == sizeof(info)); + + size_t decommitSize = min<size_t>(info.RegionSize, end - ptr); + BOOL success = VirtualFree(ptr, decommitSize, MEM_DECOMMIT); + ASSERT_UNUSED(success, success); + ptr += decommitSize; + } +} + #else // Platforms that don't support returning memory use an empty inline version of TCMalloc_SystemRelease @@ -457,8 +489,28 @@ void TCMalloc_SystemCommit(void* start, size_t length) #elif HAVE(VIRTUALALLOC) -void TCMalloc_SystemCommit(void*, size_t) +void TCMalloc_SystemCommit(void* start, size_t length) { + if (VirtualAlloc(start, length, MEM_COMMIT, PAGE_READWRITE) == start) + return; + + // The commit may fail if the memory region consists of allocations + // from more than one call to VirtualAlloc. In this case, fall back to + // using VirtualQuery to retrieve the allocation boundaries and commit them + // each individually. + + char* ptr = static_cast<char*>(start); + char* end = ptr + length; + MEMORY_BASIC_INFORMATION info; + while (ptr < end) { + size_t resultSize = VirtualQuery(ptr, &info, sizeof(info)); + ASSERT_UNUSED(resultSize, resultSize == sizeof(info)); + + size_t commitSize = min<size_t>(info.RegionSize, end - ptr); + void* newAddress = VirtualAlloc(ptr, commitSize, MEM_COMMIT, PAGE_READWRITE); + ASSERT_UNUSED(newAddress, newAddress == ptr); + ptr += commitSize; + } } #else diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h index 8e3a01a..1c67788 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TCSystemAlloc.h @@ -64,7 +64,7 @@ extern void TCMalloc_SystemRelease(void* start, size_t length); extern void TCMalloc_SystemCommit(void* start, size_t length); -#if !HAVE(MADV_FREE_REUSE) && !HAVE(MADV_DONTNEED) && !HAVE(MMAP) +#if !HAVE(MADV_FREE_REUSE) && !HAVE(MADV_DONTNEED) && !HAVE(MMAP) && !HAVE(VIRTUALALLOC) inline void TCMalloc_SystemRelease(void*, size_t) { } #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h index 4d5d2f7..b6f5fd3 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadSpecific.h @@ -79,10 +79,13 @@ private: #if USE(PTHREADS) || PLATFORM(QT) || PLATFORM(WIN_OS) struct Data : Noncopyable { Data(T* value, ThreadSpecific<T>* owner) : value(value), owner(owner) {} +#if PLATFORM(QT) + ~Data() { owner->destroy(this); } +#endif T* value; ThreadSpecific<T>* owner; -#if !USE(PTHREADS) +#if !USE(PTHREADS) && !PLATFORM(QT) void (*destructor)(void*); #endif }; @@ -136,9 +139,7 @@ inline ThreadSpecific<T>::ThreadSpecific() template<typename T> inline ThreadSpecific<T>::~ThreadSpecific() { - Data* data = static_cast<Data*>(m_key.localData()); - if (data) - data->destructor(data); + // Does not invoke destructor functions. QThreadStorage will do it } template<typename T> @@ -153,7 +154,6 @@ inline void ThreadSpecific<T>::set(T* ptr) { ASSERT(!get()); Data* data = new Data(ptr, this); - data->destructor = &ThreadSpecific<T>::destroy; m_key.setLocalData(data); } @@ -218,21 +218,27 @@ inline void ThreadSpecific<T>::destroy(void* ptr) // Some pthreads implementations zero out the pointer before calling destroy(), so we temporarily reset it. pthread_setspecific(data->owner->m_key, ptr); #endif - +#if PLATFORM(QT) + // See comment as above + data->owner->m_key.setLocalData(data); +#endif + data->value->~T(); fastFree(data->value); #if USE(PTHREADS) pthread_setspecific(data->owner->m_key, 0); #elif PLATFORM(QT) - data->owner->m_key.setLocalData(0); + // Do nothing here #elif PLATFORM(WIN_OS) TlsSetValue(tlsKeys()[data->owner->m_index], 0); #else #error ThreadSpecific is not implemented for this platform. #endif +#if !PLATFORM(QT) delete data; +#endif } template<typename T> diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h index 6578151..5154545 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Threading.h @@ -59,6 +59,8 @@ #ifndef Threading_h #define Threading_h +#include "Platform.h" + #if PLATFORM(WINCE) #include <windows.h> #endif @@ -213,23 +215,23 @@ private: #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 #if COMPILER(MINGW) || COMPILER(MSVC7) || PLATFORM(WINCE) -inline void atomicIncrement(int* addend) { InterlockedIncrement(reinterpret_cast<long*>(addend)); } +inline int atomicIncrement(int* addend) { return InterlockedIncrement(reinterpret_cast<long*>(addend)); } inline int atomicDecrement(int* addend) { return InterlockedDecrement(reinterpret_cast<long*>(addend)); } #else -inline void atomicIncrement(int volatile* addend) { InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); } +inline int atomicIncrement(int volatile* addend) { return InterlockedIncrement(reinterpret_cast<long volatile*>(addend)); } inline int atomicDecrement(int volatile* addend) { return InterlockedDecrement(reinterpret_cast<long volatile*>(addend)); } #endif #elif PLATFORM(DARWIN) #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 -inline void atomicIncrement(int volatile* addend) { OSAtomicIncrement32Barrier(const_cast<int*>(addend)); } +inline int atomicIncrement(int volatile* addend) { return OSAtomicIncrement32Barrier(const_cast<int*>(addend)); } inline int atomicDecrement(int volatile* addend) { return OSAtomicDecrement32Barrier(const_cast<int*>(addend)); } -#elif COMPILER(GCC) +#elif COMPILER(GCC) && !PLATFORM(SPARC64) // sizeof(_Atomic_word) != sizeof(int) on sparc64 gcc #define WTF_USE_LOCKFREE_THREADSAFESHARED 1 -inline void atomicIncrement(int volatile* addend) { __gnu_cxx::__atomic_add(addend, 1); } +inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; } inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; } #endif @@ -323,6 +325,11 @@ using WTF::ThreadCondition; using WTF::ThreadIdentifier; using WTF::ThreadSafeShared; +#if USE(LOCKFREE_THREADSAFESHARED) +using WTF::atomicDecrement; +using WTF::atomicIncrement; +#endif + using WTF::createThread; using WTF::currentThread; using WTF::isMainThread; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp index d0e6df8..c241bd9 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/ThreadingPthreads.cpp @@ -39,8 +39,11 @@ #include "StdLibExtras.h" #include "UnusedParam.h" #include <errno.h> + +#if !COMPILER(MSVC) #include <limits.h> #include <sys/time.h> +#endif #if PLATFORM(ANDROID) #include "jni_utility.h" diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h index 56659a8..6ce6a3e 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/TypeTraits.h @@ -70,30 +70,30 @@ namespace WTF { template <> struct IsPod<long double> { static const bool value = true; }; template <typename P> struct IsPod<P*> { static const bool value = true; }; - // Avoid "possible loss of data" warning when using Microsoft's C++ compiler - // by not converting int's to doubles. - template<bool performCheck, typename U> class CheckedIsConvertibleToDouble; - template<typename U> class CheckedIsConvertibleToDouble<false, U> { - public: - static const bool value = false; - }; - - template<typename U> class CheckedIsConvertibleToDouble<true, U> { - typedef char YesType; - struct NoType { - char padding[8]; + template<typename T> class IsConvertibleToInteger { + // Avoid "possible loss of data" warning when using Microsoft's C++ compiler + // by not converting int's to doubles. + template<bool performCheck, typename U> class IsConvertibleToDouble; + template<typename U> class IsConvertibleToDouble<false, U> { + public: + static const bool value = false; }; - static YesType floatCheck(long double); - static NoType floatCheck(...); - static U& t; - public: - static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); - }; + template<typename U> class IsConvertibleToDouble<true, U> { + typedef char YesType; + struct NoType { + char padding[8]; + }; + + static YesType floatCheck(long double); + static NoType floatCheck(...); + static T& t; + public: + static const bool value = sizeof(floatCheck(t)) == sizeof(YesType); + }; - template<typename T> class IsConvertibleToInteger { public: - static const bool value = IsInteger<T>::value || CheckedIsConvertibleToDouble<!IsInteger<T>::value, T>::value; + static const bool value = IsInteger<T>::value || IsConvertibleToDouble<!IsInteger<T>::value, T>::value; }; template <typename T, typename U> struct IsSameType { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h index 7decc4a..7cba4e4 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/Vector.h @@ -45,7 +45,7 @@ namespace WTF { #define WTF_ALIGN_OF(type) __alignof(type) #define WTF_ALIGNED(variable_type, variable, n) __declspec(align(n)) variable_type variable #else - #define WTF_ALIGN_OF(type) 0 + #error WTF_ALIGN macros need alignment control. #endif #if COMPILER(GCC) && (((__GNUC__ * 100) + __GNUC_MINOR__) >= 303) @@ -54,7 +54,6 @@ namespace WTF { typedef char AlignedBufferChar; #endif - #ifdef WTF_ALIGNED template <size_t size, size_t alignment> struct AlignedBuffer; template <size_t size> struct AlignedBuffer<size, 1> { AlignedBufferChar buffer[size]; }; template <size_t size> struct AlignedBuffer<size, 2> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 2); }; @@ -63,18 +62,6 @@ namespace WTF { template <size_t size> struct AlignedBuffer<size, 16> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 16); }; template <size_t size> struct AlignedBuffer<size, 32> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 32); }; template <size_t size> struct AlignedBuffer<size, 64> { WTF_ALIGNED(AlignedBufferChar, buffer[size], 64); }; - #else - template <size_t size, size_t> struct AlignedBuffer - { - AlignedBufferChar oversizebuffer[size + 64]; - AlignedBufferChar *buffer() - { - AlignedBufferChar *ptr = oversizebuffer; - ptr += 64 - (reinterpret_cast<size_t>(ptr) & 0x3f); - return ptr; - } - }; - #endif template <bool needsDestruction, typename T> class VectorDestructor; @@ -129,7 +116,7 @@ namespace WTF { template<typename T> struct VectorMover<false, T> { - static void move(T* src, const T* srcEnd, T* dst) + static void move(const T* src, const T* srcEnd, T* dst) { while (src != srcEnd) { new (dst) T(*src); @@ -138,7 +125,7 @@ namespace WTF { ++src; } } - static void moveOverlapping(T* src, const T* srcEnd, T* dst) + static void moveOverlapping(const T* src, const T* srcEnd, T* dst) { if (src > dst) move(src, srcEnd, dst); @@ -157,11 +144,11 @@ namespace WTF { template<typename T> struct VectorMover<true, T> { - static void move(T* src, const T* srcEnd, T* dst) + static void move(const T* src, const T* srcEnd, T* dst) { memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } - static void moveOverlapping(T* src, const T* srcEnd, T* dst) + static void moveOverlapping(const T* src, const T* srcEnd, T* dst) { memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); } @@ -254,12 +241,12 @@ namespace WTF { VectorInitializer<VectorTraits<T>::needsInitialization, VectorTraits<T>::canInitializeWithMemset, T>::initialize(begin, end); } - static void move(T* src, const T* srcEnd, T* dst) + static void move(const T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::move(src, srcEnd, dst); } - static void moveOverlapping(T* src, const T* srcEnd, T* dst) + static void moveOverlapping(const T* src, const T* srcEnd, T* dst) { VectorMover<VectorTraits<T>::canMoveWithMemcpy, T>::moveOverlapping(src, srcEnd, dst); } @@ -441,11 +428,7 @@ namespace WTF { using Base::m_capacity; static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); - #ifdef WTF_ALIGNED T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer); } - #else - T* inlineBuffer() { return reinterpret_cast<T*>(m_inlineBuffer.buffer()); } - #endif AlignedBuffer<m_inlineBufferSize, WTF_ALIGN_OF(T)> m_inlineBuffer; }; @@ -585,7 +568,6 @@ namespace WTF { }; #if PLATFORM(QT) - QT_USE_NAMESPACE template<typename T> QDataStream& operator<<(QDataStream& stream, const Vector<T>& data) { diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h b/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h index 7974b9a..eb4c279 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/VectorTraits.h @@ -21,6 +21,7 @@ #ifndef WTF_VectorTraits_h #define WTF_VectorTraits_h +#include "OwnPtr.h" #include "RefPtr.h" #include "TypeTraits.h" #include <utility> @@ -71,11 +72,14 @@ namespace WTF { static const bool canCompareWithMemcmp = true; }; - // we know RefPtr is simple enough that initializing to 0 and moving with memcpy + // we know OwnPtr and RefPtr are simple enough that initializing to 0 and moving with memcpy // (and then not destructing the original) will totally work template<typename P> struct VectorTraits<RefPtr<P> > : SimpleClassVectorTraits { }; - + + template<typename P> + struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits { }; + template<typename P> struct VectorTraits<std::auto_ptr<P> > : SimpleClassVectorTraits { }; diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp index 0ac2717..7b2d0f2 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/MainThreadQt.cpp @@ -37,8 +37,6 @@ namespace WTF { -QT_USE_NAMESPACE - class MainThreadInvoker : public QObject { Q_OBJECT public: diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp index 5a84764..1fdd2bb 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/qt/ThreadingQt.cpp @@ -41,8 +41,6 @@ namespace WTF { -QT_USE_NAMESPACE - class ThreadPrivate : public QThread { public: ThreadPrivate(ThreadFunction entryPoint, void* data); diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h index f86a9b7..d59439d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 George Staikos <staikos@kde.org> * Copyright (C) 2006, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -30,6 +31,8 @@ #include <wtf/unicode/icu/UnicodeIcu.h> #elif USE(GLIB_UNICODE) #include <wtf/unicode/glib/UnicodeGLib.h> +#elif USE(WINCE_UNICODE) +#include <wtf/unicode/wince/UnicodeWince.h> #else #error "Unknown Unicode implementation" #endif diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h index 65b3e79..bdf2028 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h @@ -58,7 +58,7 @@ QT_END_NAMESPACE #endif // ugly hack to make UChar compatible with JSChar in API/JSStringRef.h -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) || COMPILER(WINSCW) typedef wchar_t UChar; #else typedef uint16_t UChar; @@ -108,8 +108,6 @@ typedef uint32_t UChar32; namespace WTF { namespace Unicode { -QT_USE_NAMESPACE - enum Direction { LeftToRight = QChar::DirL, RightToLeft = QChar::DirR, diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp new file mode 100644 index 0000000..966f2a1 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.cpp @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "UnicodeWince.h" + +#include <wchar.h> + +namespace WTF { +namespace Unicode { + +wchar_t toLower(wchar_t c) +{ + return towlower(c); +} + +wchar_t toUpper(wchar_t c) +{ + return towupper(c); +} + +wchar_t foldCase(wchar_t c) +{ + return towlower(c); +} + +bool isPrintableChar(wchar_t c) +{ + return !!iswprint(c); +} + +bool isSpace(wchar_t c) +{ + return !!iswspace(c); +} + +bool isLetter(wchar_t c) +{ + return !!iswalpha(c); +} + +bool isUpper(wchar_t c) +{ + return !!iswupper(c); +} + +bool isLower(wchar_t c) +{ + return !!iswlower(c); +} + +bool isDigit(wchar_t c) +{ + return !!iswdigit(c); +} + +bool isPunct(wchar_t c) +{ + return !!iswpunct(c); +} + +int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError) +{ + const UChar* sourceIterator = source; + const UChar* sourceEnd = source + sourceLength; + UChar* resultIterator = result; + UChar* resultEnd = result + resultLength; + + int remainingCharacters = 0; + if (sourceLength <= resultLength) + while (sourceIterator < sourceEnd) + *resultIterator++ = towlower(*sourceIterator++); + else + while (resultIterator < resultEnd) + *resultIterator++ = towlower(*sourceIterator++); + + if (sourceIterator < sourceEnd) + remainingCharacters += sourceEnd - sourceIterator; + *isError = (remainingCharacters != 0); + if (resultIterator < resultEnd) + *resultIterator = 0; + + return (resultIterator - result) + remainingCharacters; +} + +int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError) +{ + const UChar* sourceIterator = source; + const UChar* sourceEnd = source + sourceLength; + UChar* resultIterator = result; + UChar* resultEnd = result + resultLength; + + int remainingCharacters = 0; + if (sourceLength <= resultLength) + while (sourceIterator < sourceEnd) + *resultIterator++ = towupper(*sourceIterator++); + else + while (resultIterator < resultEnd) + *resultIterator++ = towupper(*sourceIterator++); + + if (sourceIterator < sourceEnd) + remainingCharacters += sourceEnd - sourceIterator; + *isError = (remainingCharacters != 0); + if (resultIterator < resultEnd) + *resultIterator = 0; + + return (resultIterator - result) + remainingCharacters; +} + +int foldCase(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError) +{ + *isError = false; + if (resultLength < sourceLength) { + *isError = true; + return sourceLength; + } + for (int i = 0; i < sourceLength; ++i) + result[i] = foldCase(source[i]); + return sourceLength; +} + +wchar_t toTitleCase(wchar_t c) +{ + return towupper(c); +} + +Direction direction(UChar32 c) +{ + return static_cast<Direction>(UnicodeCE::direction(c)); +} + +CharCategory category(unsigned int c) +{ + return static_cast<CharCategory>(TO_MASK((__int8) UnicodeCE::category(c))); +} + +DecompositionType decompositionType(UChar32 c) +{ + return static_cast<DecompositionType>(UnicodeCE::decompositionType(c)); +} + +unsigned char combiningClass(UChar32 c) +{ + return UnicodeCE::combiningClass(c); +} + +wchar_t mirroredChar(UChar32 c) +{ + return UnicodeCE::mirroredChar(c); +} + +int digitValue(wchar_t c) +{ + return UnicodeCE::digitValue(c); +} + +} // namespace Unicode +} // namespace WTF diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h new file mode 100644 index 0000000..db656ec --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/wince/UnicodeWince.h @@ -0,0 +1,216 @@ +/* + * Copyright (C) 2006 George Staikos <staikos@kde.org> + * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> + * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef UNICODE_WINCE_H +#define UNICODE_WINCE_H + +#include "ce_unicode.h" + +#define TO_MASK(x) (1 << (x)) + +// some defines from ICU needed one or two places + +#define U16_IS_LEAD(c) (((c) & 0xfffffc00) == 0xd800) +#define U16_IS_TRAIL(c) (((c) & 0xfffffc00) == 0xdc00) +#define U16_SURROGATE_OFFSET ((0xd800 << 10UL) + 0xdc00 - 0x10000) +#define U16_GET_SUPPLEMENTARY(lead, trail) \ + (((UChar32)(lead) << 10UL) + (UChar32)(trail) - U16_SURROGATE_OFFSET) + +#define U16_LEAD(supplementary) (UChar)(((supplementary) >> 10) + 0xd7c0) +#define U16_TRAIL(supplementary) (UChar)(((supplementary) & 0x3ff) | 0xdc00) + +#define U_IS_SURROGATE(c) (((c) & 0xfffff800) == 0xd800) +#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) +#define U16_IS_SURROGATE_LEAD(c) (((c) & 0x400) == 0) + +#define U16_NEXT(s, i, length, c) { \ + (c)=(s)[(i)++]; \ + if (U16_IS_LEAD(c)) { \ + uint16_t __c2; \ + if ((i) < (length) && U16_IS_TRAIL(__c2 = (s)[(i)])) { \ + ++(i); \ + (c) = U16_GET_SUPPLEMENTARY((c), __c2); \ + } \ + } \ +} + +#define U16_PREV(s, start, i, c) { \ + (c)=(s)[--(i)]; \ + if (U16_IS_TRAIL(c)) { \ + uint16_t __c2; \ + if ((i) > (start) && U16_IS_LEAD(__c2 = (s)[(i) - 1])) { \ + --(i); \ + (c) = U16_GET_SUPPLEMENTARY(__c2, (c)); \ + } \ + } \ +} + +#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) + +namespace WTF { + + namespace Unicode { + + enum Direction { + LeftToRight = UnicodeCE::U_LEFT_TO_RIGHT, + RightToLeft = UnicodeCE::U_RIGHT_TO_LEFT, + EuropeanNumber = UnicodeCE::U_EUROPEAN_NUMBER, + EuropeanNumberSeparator = UnicodeCE::U_EUROPEAN_NUMBER_SEPARATOR, + EuropeanNumberTerminator = UnicodeCE::U_EUROPEAN_NUMBER_TERMINATOR, + ArabicNumber = UnicodeCE::U_ARABIC_NUMBER, + CommonNumberSeparator = UnicodeCE::U_COMMON_NUMBER_SEPARATOR, + BlockSeparator = UnicodeCE::U_BLOCK_SEPARATOR, + SegmentSeparator = UnicodeCE::U_SEGMENT_SEPARATOR, + WhiteSpaceNeutral = UnicodeCE::U_WHITE_SPACE_NEUTRAL, + OtherNeutral = UnicodeCE::U_OTHER_NEUTRAL, + LeftToRightEmbedding = UnicodeCE::U_LEFT_TO_RIGHT_EMBEDDING, + LeftToRightOverride = UnicodeCE::U_LEFT_TO_RIGHT_OVERRIDE, + RightToLeftArabic = UnicodeCE::U_RIGHT_TO_LEFT_ARABIC, + RightToLeftEmbedding = UnicodeCE::U_RIGHT_TO_LEFT_EMBEDDING, + RightToLeftOverride = UnicodeCE::U_RIGHT_TO_LEFT_OVERRIDE, + PopDirectionalFormat = UnicodeCE::U_POP_DIRECTIONAL_FORMAT, + NonSpacingMark = UnicodeCE::U_DIR_NON_SPACING_MARK, + BoundaryNeutral = UnicodeCE::U_BOUNDARY_NEUTRAL + }; + + enum DecompositionType { + DecompositionNone = UnicodeCE::U_DT_NONE, + DecompositionCanonical = UnicodeCE::U_DT_CANONICAL, + DecompositionCompat = UnicodeCE::U_DT_COMPAT, + DecompositionCircle = UnicodeCE::U_DT_CIRCLE, + DecompositionFinal = UnicodeCE::U_DT_FINAL, + DecompositionFont = UnicodeCE::U_DT_FONT, + DecompositionFraction = UnicodeCE::U_DT_FRACTION, + DecompositionInitial = UnicodeCE::U_DT_INITIAL, + DecompositionIsolated = UnicodeCE::U_DT_ISOLATED, + DecompositionMedial = UnicodeCE::U_DT_MEDIAL, + DecompositionNarrow = UnicodeCE::U_DT_NARROW, + DecompositionNoBreak = UnicodeCE::U_DT_NOBREAK, + DecompositionSmall = UnicodeCE::U_DT_SMALL, + DecompositionSquare = UnicodeCE::U_DT_SQUARE, + DecompositionSub = UnicodeCE::U_DT_SUB, + DecompositionSuper = UnicodeCE::U_DT_SUPER, + DecompositionVertical = UnicodeCE::U_DT_VERTICAL, + DecompositionWide = UnicodeCE::U_DT_WIDE, + }; + + enum CharCategory { + NoCategory = 0, + Other_NotAssigned = TO_MASK(UnicodeCE::U_GENERAL_OTHER_TYPES), + Letter_Uppercase = TO_MASK(UnicodeCE::U_UPPERCASE_LETTER), + Letter_Lowercase = TO_MASK(UnicodeCE::U_LOWERCASE_LETTER), + Letter_Titlecase = TO_MASK(UnicodeCE::U_TITLECASE_LETTER), + Letter_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_LETTER), + Letter_Other = TO_MASK(UnicodeCE::U_OTHER_LETTER), + + Mark_NonSpacing = TO_MASK(UnicodeCE::U_NON_SPACING_MARK), + Mark_Enclosing = TO_MASK(UnicodeCE::U_ENCLOSING_MARK), + Mark_SpacingCombining = TO_MASK(UnicodeCE::U_COMBINING_SPACING_MARK), + + Number_DecimalDigit = TO_MASK(UnicodeCE::U_DECIMAL_DIGIT_NUMBER), + Number_Letter = TO_MASK(UnicodeCE::U_LETTER_NUMBER), + Number_Other = TO_MASK(UnicodeCE::U_OTHER_NUMBER), + + Separator_Space = TO_MASK(UnicodeCE::U_SPACE_SEPARATOR), + Separator_Line = TO_MASK(UnicodeCE::U_LINE_SEPARATOR), + Separator_Paragraph = TO_MASK(UnicodeCE::U_PARAGRAPH_SEPARATOR), + + Other_Control = TO_MASK(UnicodeCE::U_CONTROL_CHAR), + Other_Format = TO_MASK(UnicodeCE::U_FORMAT_CHAR), + Other_PrivateUse = TO_MASK(UnicodeCE::U_PRIVATE_USE_CHAR), + Other_Surrogate = TO_MASK(UnicodeCE::U_SURROGATE), + + Punctuation_Dash = TO_MASK(UnicodeCE::U_DASH_PUNCTUATION), + Punctuation_Open = TO_MASK(UnicodeCE::U_START_PUNCTUATION), + Punctuation_Close = TO_MASK(UnicodeCE::U_END_PUNCTUATION), + Punctuation_Connector = TO_MASK(UnicodeCE::U_CONNECTOR_PUNCTUATION), + Punctuation_Other = TO_MASK(UnicodeCE::U_OTHER_PUNCTUATION), + + Symbol_Math = TO_MASK(UnicodeCE::U_MATH_SYMBOL), + Symbol_Currency = TO_MASK(UnicodeCE::U_CURRENCY_SYMBOL), + Symbol_Modifier = TO_MASK(UnicodeCE::U_MODIFIER_SYMBOL), + Symbol_Other = TO_MASK(UnicodeCE::U_OTHER_SYMBOL), + + Punctuation_InitialQuote = TO_MASK(UnicodeCE::U_INITIAL_PUNCTUATION), + Punctuation_FinalQuote = TO_MASK(UnicodeCE::U_FINAL_PUNCTUATION) + }; + + CharCategory category(unsigned int); + + bool isSpace(wchar_t); + bool isLetter(wchar_t); + bool isPrintableChar(wchar_t); + bool isUpper(wchar_t); + bool isLower(wchar_t); + bool isPunct(wchar_t); + bool isDigit(wchar_t); + inline bool isSeparatorSpace(wchar_t c) { return category(c) == Separator_Space; } + inline bool isHighSurrogate(wchar_t c) { return (c & 0xfc00) == 0xd800; } + inline bool isLowSurrogate(wchar_t c) { return (c & 0xfc00) == 0xdc00; } + + wchar_t toLower(wchar_t); + wchar_t toUpper(wchar_t); + wchar_t foldCase(wchar_t); + wchar_t toTitleCase(wchar_t); + int toLower(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); + int toUpper(wchar_t* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); + int foldCase(UChar* result, int resultLength, const wchar_t* source, int sourceLength, bool* isError); + + int digitValue(wchar_t); + + wchar_t mirroredChar(UChar32); + unsigned char combiningClass(UChar32); + DecompositionType decompositionType(UChar32); + Direction direction(UChar32); + inline bool isArabicChar(UChar32) + { + return false; // FIXME: implement! + } + + inline bool hasLineBreakingPropertyComplexContext(UChar32) + { + return false; // FIXME: implement! + } + + inline int umemcasecmp(const wchar_t* a, const wchar_t* b, int len) + { + for (int i = 0; i < len; ++i) { + wchar_t c1 = foldCase(a[i]); + wchar_t c2 = foldCase(b[i]); + if (c1 != c2) + return c1 - c2; + } + return 0; + } + + inline UChar32 surrogateToUcs4(wchar_t high, wchar_t low) + { + return (UChar32(high) << 10) + low - 0x35fdc00; + } + + } // namespace Unicode + +} // namespace WTF + +#endif +// vim: ts=2 sw=2 et |