Commit a52f4e12 authored by darin's avatar darin
Browse files

Reviewed by Hyatt.

        - use Timer for everything, kill timer features of QObject, QTimer, QTimerEvent

        * ForwardingHeaders/kxmlcore/Noncopyable.h: Added.
        * ForwardingHeaders/kxmlcore/OwnArrayPtr.h: Added.
        * ForwardingHeaders/kxmlcore/OwnPtr.h: Added.
        * ForwardingHeaders/qtimer.h: Removed.
        * kwq/KWQTimer.cpp: Removed.
        * kwq/KWQTimer.h: Removed.

        * kwq/KWQObject.h:
        * kwq/KWQObject.cpp: Remove timer-related features.

        * kwq/KWQEvent.h: Remove QTimerEvent.

        * WebCore.xcodeproj/project.pbxproj: Updated for file changes.
        * WebCore.vcproj/WebCore/WebCore.vcproj: Ditto.

        * platform/Timer.h: Change to use nextFireInterval rather than nextFireTime.
        More convenient and also no need to define what the epoch is. Change TimerBase
        to use a virtual function rather than a function pointer. Added setDeferringTimers
        function to ensure timers don't fire while handling an event.
        * platform/mac/Timer.cpp:
        (WebCore::timerFired): Added deferral support.
        (WebCore::fireDeferred): Added.
        (WebCore::TimerBase::TimerBase): Simplify to remove function pointer.
        (WebCore::TimerBase::~TimerBase): Put in here, no longer inline.
        (WebCore::TimerBase::start): Change to use interval.
        (WebCore::TimerBase::startRepeating): Change since we use interval now.
        (WebCore::TimerBase::startOneShot): Ditto.
        (WebCore::TimerBase::stop): Added deferral support.
        (WebCore::TimerBase::nextFireInterval): Added.
        (WebCore::TimerBase::fire): Added.
        (WebCore::isDeferringTimers): Added.
        (WebCore::setDeferringTimers): Added.

        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::startRedirectionTimer): Update for change to Timer class.
        (WebCore::MacFrame::passMouseDownEventToWidget): Update to use setDeferringTimers
        instead of QObject::setDefersTimers.

        * khtml/ecma/kjs_window.h:
        * khtml/ecma/kjs_window.cpp:
        (KJS::DOMWindowTimer): Added. Class for JavaScript "timeout".
        (KJS::WindowQObject::parentDestroyed): Update to use DOMWindowTimer.
        (KJS::WindowQObject::installTimeout): Ditto.
        (KJS::WindowQObject::pauseTimeouts): Ditto.
        (KJS::WindowQObject::resumeTimeouts): Ditto.
        (KJS::WindowQObject::clearTimeout): Ditto.
        (KJS::WindowQObject::timerFired): Ditto.
        (KJS::DOMWindowTimer::fired): Added.

        * khtml/html/htmltokenizer.h:
        * khtml/html/htmltokenizer.cpp:
        (WebCore::HTMLTokenizer::HTMLTokenizer): Use Timer instead of timer ID.
        (WebCore::HTMLTokenizer::reset): Ditto.
        (WebCore::HTMLTokenizer::continueProcessing): Ditto.
        (WebCore::HTMLTokenizer::write): Ditto.
        (WebCore::HTMLTokenizer::stopParsing): Ditto.
        (WebCore::HTMLTokenizer::processingData): Ditto.
        (WebCore::HTMLTokenizer::timerFired): Ditto.
        (WebCore::HTMLTokenizer::end): Ditto.
        (WebCore::HTMLTokenizer::finish): Ditto.

        * khtml/xml/DocumentImpl.h:
        * khtml/xml/DocumentImpl.cpp:
        (WebCore::DocumentImpl::DocumentImpl): Updated for changes to use RefPtr
        more cases, and not use it for m_svgExtensions.
        (WebCore::DocumentImpl::~DocumentImpl): Delete m_svgExtensions instead of
        just deref'ing it since it's no longer shared.
        (WebCore::DocumentImpl::implementation): Update for RefPtr.
        (WebCore::DocumentImpl::elementSheet): Ditto.
        (WebCore::DocumentImpl::styleSheets): Ditto.
        (WebCore::DocumentImpl::recalcStyleSelector): Ditto.
        (WebCore::DocumentImpl::dispatchImageLoadEventSoon): Update to use new style timer.
        (WebCore::DocumentImpl::removeImage): Ditto.
        (WebCore::DocumentImpl::dispatchImageLoadEventsNow): Ditto.
        (WebCore::DocumentImpl::imageLoadEventTimerFired): Ditto.
        (WebCore::DocumentImpl::svgExtensions): Update for RefPtr.
        (WebCore::DocumentImpl::accessSVGExtensions): Ditto.

        * ksvg2/misc/KSVGTimeScheduler.h:
        (WebCore::TimeScheduler::document):
        * ksvg2/misc/KSVGTimeScheduler.cpp:
        (WebCore::SVGTimer::downcast):
        (WebCore::SVGTimer::SVGTimer):
        (WebCore::SVGTimer::start):
        (WebCore::SVGTimer::calculateTimePercentage):
        (WebCore::SVGTimer::notifyAll):
        (WebCore::SVGTimer::addNotify):
        (WebCore::SVGTimer::removeNotify):
        (WebCore::TimeScheduler::TimeScheduler):
        (WebCore::TimeScheduler::~TimeScheduler):
        (WebCore::TimeScheduler::addTimer):
        (WebCore::TimeScheduler::connectIntervalTimer):
        (WebCore::TimeScheduler::disconnectIntervalTimer):
        (WebCore::TimeScheduler::startAnimations):
        (WebCore::TimeScheduler::toggleAnimations):
        (WebCore::TimeScheduler::timerFired):
        Rework to use new timer.

        * ksvg2/misc/SVGDocumentExtensions.h:
        * ksvg2/misc/SVGDocumentExtensions.cpp:
        Make SVGDocumentExtensions no longer be shared, be solely owned by the document.

        * ksvg2/svg/SVGDocumentImpl.cpp:
        (WebCore::SVGDocumentImpl::createStyleSelector): Update for RefPtr use.

        * kwq/KWQSlot.cpp: Remove endLifeSupport and timerNotify slots.

        * page/Frame.h:
        * page/Frame.cpp:
        (WebCore::Frame::selectionLayoutChanged): Update to use new style timer.
        (WebCore::Frame::caretBlinkTimerFired): Ditto.
        * page/FramePrivate.h: (WebCore::FramePrivate::FramePrivate): Ditto.

        * page/FrameView.h:
        * page/FrameView.cpp:
        (WebCore::FrameViewPrivate::FrameViewPrivate): Update to use new style timer.
        (WebCore::FrameView::clear): Ditto.
        (WebCore::FrameView::layout): Ditto.
        (WebCore::FrameView::layoutTimerFired): Ditto.
        (WebCore::FrameView::scheduleRelayout): Ditto.
        (WebCore::FrameView::layoutPending): Ditto.
        (WebCore::FrameView::haveDelayedLayoutScheduled): Ditto.
        (WebCore::FrameView::unscheduleRelayout): Ditto.

        * page/ObjectContents.h: Remove unneeded includes.

        * rendering/render_frames.cpp: Removed include of <qtimer.h>.

        * rendering/render_layer.h:
        * rendering/render_layer.cpp:
        (WebCore::Marquee::Marquee): Use new style timers.
        (WebCore::Marquee::start): Ditto.
        (WebCore::Marquee::suspend): Ditto.
        (WebCore::Marquee::stop): Ditto.
        (WebCore::Marquee::updateMarqueeStyle): Ditto.
        (WebCore::Marquee::timerFired): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@12515 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8c1f0664
2006-02-01 Darin Adler <darin@apple.com>
Reviewed by Hyatt.
- use Timer for everything, kill timer features of QObject, QTimer, QTimerEvent
* ForwardingHeaders/kxmlcore/Noncopyable.h: Added.
* ForwardingHeaders/kxmlcore/OwnArrayPtr.h: Added.
* ForwardingHeaders/kxmlcore/OwnPtr.h: Added.
* ForwardingHeaders/qtimer.h: Removed.
* kwq/KWQTimer.cpp: Removed.
* kwq/KWQTimer.h: Removed.
* kwq/KWQObject.h:
* kwq/KWQObject.cpp: Remove timer-related features.
* kwq/KWQEvent.h: Remove QTimerEvent.
* WebCore.xcodeproj/project.pbxproj: Updated for file changes.
* WebCore.vcproj/WebCore/WebCore.vcproj: Ditto.
* platform/Timer.h: Change to use nextFireInterval rather than nextFireTime.
More convenient and also no need to define what the epoch is. Change TimerBase
to use a virtual function rather than a function pointer. Added setDeferringTimers
function to ensure timers don't fire while handling an event.
* platform/mac/Timer.cpp:
(WebCore::timerFired): Added deferral support.
(WebCore::fireDeferred): Added.
(WebCore::TimerBase::TimerBase): Simplify to remove function pointer.
(WebCore::TimerBase::~TimerBase): Put in here, no longer inline.
(WebCore::TimerBase::start): Change to use interval.
(WebCore::TimerBase::startRepeating): Change since we use interval now.
(WebCore::TimerBase::startOneShot): Ditto.
(WebCore::TimerBase::stop): Added deferral support.
(WebCore::TimerBase::nextFireInterval): Added.
(WebCore::TimerBase::fire): Added.
(WebCore::isDeferringTimers): Added.
(WebCore::setDeferringTimers): Added.
* bridge/mac/MacFrame.mm:
(WebCore::MacFrame::startRedirectionTimer): Update for change to Timer class.
(WebCore::MacFrame::passMouseDownEventToWidget): Update to use setDeferringTimers
instead of QObject::setDefersTimers.
* khtml/ecma/kjs_window.h:
* khtml/ecma/kjs_window.cpp:
(KJS::DOMWindowTimer): Added. Class for JavaScript "timeout".
(KJS::WindowQObject::parentDestroyed): Update to use DOMWindowTimer.
(KJS::WindowQObject::installTimeout): Ditto.
(KJS::WindowQObject::pauseTimeouts): Ditto.
(KJS::WindowQObject::resumeTimeouts): Ditto.
(KJS::WindowQObject::clearTimeout): Ditto.
(KJS::WindowQObject::timerFired): Ditto.
(KJS::DOMWindowTimer::fired): Added.
* khtml/html/htmltokenizer.h:
* khtml/html/htmltokenizer.cpp:
(WebCore::HTMLTokenizer::HTMLTokenizer): Use Timer instead of timer ID.
(WebCore::HTMLTokenizer::reset): Ditto.
(WebCore::HTMLTokenizer::continueProcessing): Ditto.
(WebCore::HTMLTokenizer::write): Ditto.
(WebCore::HTMLTokenizer::stopParsing): Ditto.
(WebCore::HTMLTokenizer::processingData): Ditto.
(WebCore::HTMLTokenizer::timerFired): Ditto.
(WebCore::HTMLTokenizer::end): Ditto.
(WebCore::HTMLTokenizer::finish): Ditto.
* khtml/xml/DocumentImpl.h:
* khtml/xml/DocumentImpl.cpp:
(WebCore::DocumentImpl::DocumentImpl): Updated for changes to use RefPtr
more cases, and not use it for m_svgExtensions.
(WebCore::DocumentImpl::~DocumentImpl): Delete m_svgExtensions instead of
just deref'ing it since it's no longer shared.
(WebCore::DocumentImpl::implementation): Update for RefPtr.
(WebCore::DocumentImpl::elementSheet): Ditto.
(WebCore::DocumentImpl::styleSheets): Ditto.
(WebCore::DocumentImpl::recalcStyleSelector): Ditto.
(WebCore::DocumentImpl::dispatchImageLoadEventSoon): Update to use new style timer.
(WebCore::DocumentImpl::removeImage): Ditto.
(WebCore::DocumentImpl::dispatchImageLoadEventsNow): Ditto.
(WebCore::DocumentImpl::imageLoadEventTimerFired): Ditto.
(WebCore::DocumentImpl::svgExtensions): Update for RefPtr.
(WebCore::DocumentImpl::accessSVGExtensions): Ditto.
* ksvg2/misc/KSVGTimeScheduler.h:
(WebCore::TimeScheduler::document):
* ksvg2/misc/KSVGTimeScheduler.cpp:
(WebCore::SVGTimer::downcast):
(WebCore::SVGTimer::SVGTimer):
(WebCore::SVGTimer::start):
(WebCore::SVGTimer::calculateTimePercentage):
(WebCore::SVGTimer::notifyAll):
(WebCore::SVGTimer::addNotify):
(WebCore::SVGTimer::removeNotify):
(WebCore::TimeScheduler::TimeScheduler):
(WebCore::TimeScheduler::~TimeScheduler):
(WebCore::TimeScheduler::addTimer):
(WebCore::TimeScheduler::connectIntervalTimer):
(WebCore::TimeScheduler::disconnectIntervalTimer):
(WebCore::TimeScheduler::startAnimations):
(WebCore::TimeScheduler::toggleAnimations):
(WebCore::TimeScheduler::timerFired):
Rework to use new timer.
* ksvg2/misc/SVGDocumentExtensions.h:
* ksvg2/misc/SVGDocumentExtensions.cpp:
Make SVGDocumentExtensions no longer be shared, be solely owned by the document.
* ksvg2/svg/SVGDocumentImpl.cpp:
(WebCore::SVGDocumentImpl::createStyleSelector): Update for RefPtr use.
* kwq/KWQSlot.cpp: Remove endLifeSupport and timerNotify slots.
* page/Frame.h:
* page/Frame.cpp:
(WebCore::Frame::selectionLayoutChanged): Update to use new style timer.
(WebCore::Frame::caretBlinkTimerFired): Ditto.
* page/FramePrivate.h: (WebCore::FramePrivate::FramePrivate): Ditto.
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameViewPrivate::FrameViewPrivate): Update to use new style timer.
(WebCore::FrameView::clear): Ditto.
(WebCore::FrameView::layout): Ditto.
(WebCore::FrameView::layoutTimerFired): Ditto.
(WebCore::FrameView::scheduleRelayout): Ditto.
(WebCore::FrameView::layoutPending): Ditto.
(WebCore::FrameView::haveDelayedLayoutScheduled): Ditto.
(WebCore::FrameView::unscheduleRelayout): Ditto.
* page/ObjectContents.h: Remove unneeded includes.
* rendering/render_frames.cpp: Removed include of <qtimer.h>.
* rendering/render_layer.h:
* rendering/render_layer.cpp:
(WebCore::Marquee::Marquee): Use new style timers.
(WebCore::Marquee::start): Ditto.
(WebCore::Marquee::suspend): Ditto.
(WebCore::Marquee::stop): Ditto.
(WebCore::Marquee::updateMarqueeStyle): Ditto.
(WebCore::Marquee::timerFired): Ditto.
2006-02-01 Darin Adler <darin@apple.com>
 
Reviewed by Beth.
......@@ -12,7 +155,7 @@
until the target is set.
 
* khtml/xml/dom2_eventsimpl.cpp:
(WebCore::EventImpl::setTarget): Now calls receievdTarget() if the
(WebCore::EventImpl::setTarget): Now calls receivedTarget() if the
target is not nil.
(WebCore::EventImpl::receivedTarget): virtual receivedTarget()
(WebCore::MouseRelatedEventImpl::MouseRelatedEventImpl): Call
......
#import <JavaScriptCore/Noncopyable.h>
#import <JavaScriptCore/OwnArrayPtr.h>
#import <JavaScriptCore/OwnPtr.h>
......@@ -506,10 +506,6 @@
RelativePath="..\..\kwq\KWQTextUtilities.h"
>
</File>
<File
RelativePath="..\..\kwq\KWQTimer.h"
>
</File>
<File
RelativePath="..\..\kwq\KWQValueList.h"
>
......
......@@ -199,7 +199,6 @@
93F1999908245E59001E9ABC /* KWQTextEdit.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786BE02DE3B8601EA4122 /* KWQTextEdit.h */; };
93F1999A08245E59001E9ABC /* KWQTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = F587851B02DE375901EA4122 /* KWQTextField.h */; };
93F1999B08245E59001E9ABC /* KWQTextStream.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786BF02DE3B8601EA4122 /* KWQTextStream.h */; };
93F1999C08245E59001E9ABC /* KWQTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C002DE3B8601EA4122 /* KWQTimer.h */; };
93F1999D08245E59001E9ABC /* KWQValueList.h in Headers */ = {isa = PBXBuildFile; fileRef = F58786C202DE3B8601EA4122 /* KWQValueList.h */; };
93F1999E08245E59001E9ABC /* KWQValueListImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F587853B02DE375901EA4122 /* KWQValueListImpl.h */; };
93F199A108245E59001E9ABC /* KWQView.h in Headers */ = {isa = PBXBuildFile; fileRef = F587854002DE375901EA4122 /* KWQView.h */; };
......@@ -310,7 +309,6 @@
93F19A5208245E59001E9ABC /* KWQTextCodec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853702DE375901EA4122 /* KWQTextCodec.cpp */; };
93F19A5308245E59001E9ABC /* KWQTextEdit.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587853802DE375901EA4122 /* KWQTextEdit.mm */; };
93F19A5408245E59001E9ABC /* KWQTextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853902DE375901EA4122 /* KWQTextStream.cpp */; };
93F19A5508245E59001E9ABC /* KWQTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853A02DE375901EA4122 /* KWQTimer.cpp */; };
93F19A5608245E59001E9ABC /* KWQValueListImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F587853C02DE375901EA4122 /* KWQValueListImpl.cpp */; };
93F19A5908245E59001E9ABC /* KWQWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587854202DE375901EA4122 /* KWQWidget.mm */; };
93F19A5A08245E59001E9ABC /* KWQWindowWidget.mm in Sources */ = {isa = PBXBuildFile; fileRef = F587854402DE375901EA4122 /* KWQWindowWidget.mm */; };
......@@ -2152,7 +2150,6 @@
F587853702DE375901EA4122 /* KWQTextCodec.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQTextCodec.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587853802DE375901EA4122 /* KWQTextEdit.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KWQTextEdit.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587853902DE375901EA4122 /* KWQTextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQTextStream.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587853A02DE375901EA4122 /* KWQTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQTimer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587853B02DE375901EA4122 /* KWQValueListImpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQValueListImpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587853C02DE375901EA4122 /* KWQValueListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KWQValueListImpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F587854002DE375901EA4122 /* KWQView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -2211,7 +2208,6 @@
F58786BD02DE3B8601EA4122 /* KWQTextCodec.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQTextCodec.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58786BE02DE3B8601EA4122 /* KWQTextEdit.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQTextEdit.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58786BF02DE3B8601EA4122 /* KWQTextStream.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQTextStream.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58786C002DE3B8601EA4122 /* KWQTimer.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQTimer.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58786C202DE3B8601EA4122 /* KWQValueList.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQValueList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58786C502DE3B8601EA4122 /* KWQWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = KWQWidget.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F58EF58E02DFDFB7018635CA /* WebCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.exports; name = WebCore.exp; path = ../WebCore.exp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
......@@ -3790,8 +3786,6 @@
F587853802DE375901EA4122 /* KWQTextEdit.mm */,
F58786BF02DE3B8601EA4122 /* KWQTextStream.h */,
F587853902DE375901EA4122 /* KWQTextStream.cpp */,
F58786C002DE3B8601EA4122 /* KWQTimer.h */,
F587853A02DE375901EA4122 /* KWQTimer.cpp */,
F58786C202DE3B8601EA4122 /* KWQValueList.h */,
F587853B02DE375901EA4122 /* KWQValueListImpl.h */,
F587853C02DE375901EA4122 /* KWQValueListImpl.cpp */,
......@@ -3907,7 +3901,6 @@
93F1999908245E59001E9ABC /* KWQTextEdit.h in Headers */,
93F1999A08245E59001E9ABC /* KWQTextField.h in Headers */,
93F1999B08245E59001E9ABC /* KWQTextStream.h in Headers */,
93F1999C08245E59001E9ABC /* KWQTimer.h in Headers */,
93F1999D08245E59001E9ABC /* KWQValueList.h in Headers */,
93F1999E08245E59001E9ABC /* KWQValueListImpl.h in Headers */,
93F199A108245E59001E9ABC /* KWQView.h in Headers */,
......@@ -5007,7 +5000,6 @@
93F19A5208245E59001E9ABC /* KWQTextCodec.cpp in Sources */,
93F19A5308245E59001E9ABC /* KWQTextEdit.mm in Sources */,
93F19A5408245E59001E9ABC /* KWQTextStream.cpp in Sources */,
93F19A5508245E59001E9ABC /* KWQTimer.cpp in Sources */,
93F19A5608245E59001E9ABC /* KWQValueListImpl.cpp in Sources */,
93F19A5908245E59001E9ABC /* KWQWidget.mm in Sources */,
93F19A5A08245E59001E9ABC /* KWQWindowWidget.mm in Sources */,
......
......@@ -918,8 +918,8 @@ void MacFrame::startRedirectionTimer()
// Don't report history navigations, just actual redirection.
if (d->m_scheduledRedirection != historyNavigationScheduled) {
NSTimeInterval fireDateNumber = d->m_redirectionTimer.nextFireTime() - NSTimeIntervalSince1970;
NSDate *fireDate = [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:fireDateNumber];
NSTimeInterval interval = d->m_redirectionTimer.nextFireInterval();
NSDate *fireDate = [[NSDate alloc] initWithTimeIntervalSinceNow:interval];
[_bridge reportClientRedirectToURL:KURL(d->m_redirectURL).getNSURL()
delay:d->m_delayRedirect
fireDate:fireDate
......@@ -1570,24 +1570,21 @@ bool MacFrame::passMouseDownEventToWidget(QWidget* widget)
// That's because we don't want the new page to load while the user is holding the mouse down.
BOOL wasDeferringLoading = [_bridge defersLoading];
if (!wasDeferringLoading) {
if (!wasDeferringLoading)
[_bridge setDefersLoading:YES];
}
BOOL wasDeferringTimers = QObject::defersTimers();
if (!wasDeferringTimers) {
QObject::setDefersTimers(true);
}
BOOL wasDeferringTimers = isDeferringTimers();
if (!wasDeferringTimers)
setDeferringTimers(true);
ASSERT(!_sendingEventToSubview);
_sendingEventToSubview = true;
[view mouseDown:_currentEvent];
_sendingEventToSubview = false;
if (!wasDeferringTimers) {
QObject::setDefersTimers(false);
}
if (!wasDeferringLoading) {
if (!wasDeferringTimers)
setDeferringTimers(false);
if (!wasDeferringLoading)
[_bridge setDefersLoading:NO];
}
// Remember which view we sent the event to, so we can direct the release event properly.
_mouseDownView = view;
......
......@@ -57,7 +57,6 @@
#include <kdebug.h>
#include <kjs/collector.h>
#include <klocale.h>
#include <qtimer.h>
#if KHTML_XSLT
#include "XSLTProcessor.h"
......@@ -68,11 +67,31 @@ using namespace EventNames;
namespace KJS {
static int lastUsedTimeoutId;
class DOMWindowTimer : public TimerBase {
public:
DOMWindowTimer(int timeoutId, WindowQObject* o, ScheduledAction* a)
: m_timeoutId(timeoutId), m_object(o), m_action(a) { }
virtual ~DOMWindowTimer() { delete m_action; }
int timeoutId() const { return m_timeoutId; }
ScheduledAction* action() const { return m_action; }
ScheduledAction* takeAction() { ScheduledAction* a = m_action; m_action = 0; return a; }
private:
virtual void fired();
int m_timeoutId;
WindowQObject* m_object;
ScheduledAction* m_action;
};
class PausedTimeout {
public:
int timerId;
int nextFireInterval;
int repeatInterval;
int timeoutId;
double nextFireInterval;
double repeatInterval;
ScheduledAction *action;
};
......@@ -1878,25 +1897,31 @@ WindowQObject::WindowQObject(Window *w)
void WindowQObject::parentDestroyed()
{
killTimers();
TimeoutsMap::iterator end = m_timeouts.end();
for (TimeoutsMap::iterator it = m_timeouts.begin(); it != end; ++it)
delete it->second;
deleteAllValues(m_timeouts);
m_timeouts.clear();
}
int WindowQObject::installTimeout(ScheduledAction* a, int t, bool singleShot)
{
int timeoutId = ++lastUsedTimeoutId;
DOMWindowTimer* timer = new DOMWindowTimer(timeoutId, this, a);
ASSERT(!m_timeouts.get(timeoutId));
m_timeouts.set(timeoutId, timer);
if (singleShot)
timer->startOneShot(t * 0.001);
else
timer->startRepeating(t * 0.001);
return timeoutId;
}
int WindowQObject::installTimeout(const UString& handler, int t, bool singleShot)
{
int id = startTimer(t);
m_timeouts.set(id, new ScheduledAction(handler.qstring(), singleShot));
return id;
return installTimeout(new ScheduledAction(handler.qstring()), t, singleShot);
}
int WindowQObject::installTimeout(JSValue *func, const List& args, int t, bool singleShot)
int WindowQObject::installTimeout(JSValue* func, const List& args, int t, bool singleShot)
{
int id = startTimer(t);
m_timeouts.set(id, new ScheduledAction(func, args, singleShot));
return id;
return installTimeout(new ScheduledAction(func, args), t, singleShot);
}
PausedTimeouts *WindowQObject::pauseTimeouts()
......@@ -1904,18 +1929,24 @@ PausedTimeouts *WindowQObject::pauseTimeouts()
size_t count = m_timeouts.size();
if (count == 0)
return 0;
PausedTimeout *t = new PausedTimeout [count];
PausedTimeouts *result = new PausedTimeouts(t, count);
TimeoutsMap::iterator end = m_timeouts.end();
for (TimeoutsMap::iterator it = m_timeouts.begin(); it != end; ++it) {
int timerId = it->first;
timerIntervals(timerId, t->nextFireInterval, t->repeatInterval);
t->timerId = timerId;
t->action = it->second;
++t;
killTimer(timerId);
PausedTimeout* t = new PausedTimeout [count];
PausedTimeouts* result = new PausedTimeouts(t, count);
TimeoutsMap::iterator it = m_timeouts.begin();
for (size_t i = 0; i != count; ++i, ++it) {
int timeoutId = it->first;
DOMWindowTimer* timer = it->second;
t[i].timeoutId = timeoutId;
t[i].nextFireInterval = timer->nextFireInterval();
t[i].repeatInterval = timer->repeatInterval();
t[i].action = timer->takeAction();
}
ASSERT(it == m_timeouts.end());
deleteAllValues(m_timeouts);
m_timeouts.clear();
return result;
}
......@@ -1926,44 +1957,38 @@ void WindowQObject::resumeTimeouts(PausedTimeouts *timeouts)
size_t count = timeouts->numTimeouts();
PausedTimeout *array = timeouts->takeTimeouts();
for (size_t i = 0; i != count; ++i) {
int timerId = array[i].timerId;
m_timeouts.set(timerId, array[i].action);
restartTimer(timerId, array[i].nextFireInterval, array[i].repeatInterval);
int timeoutId = array[i].timeoutId;
DOMWindowTimer* timer = new DOMWindowTimer(timeoutId, this, array[i].action);
m_timeouts.set(timeoutId, timer);
timer->start(array[i].nextFireInterval, array[i].repeatInterval);
}
delete [] array;
}
void WindowQObject::clearTimeout(int timerId, bool delAction)
void WindowQObject::clearTimeout(int timeoutId, bool delAction)
{
killTimer(timerId);
if (delAction) {
TimeoutsMap::iterator it = m_timeouts.find(timerId);
if (it != m_timeouts.end()) {
delete it->second;
m_timeouts.remove(it);
}
}
TimeoutsMap::iterator it = m_timeouts.find(timeoutId);
if (it != m_timeouts.end())
return;
DOMWindowTimer* timer = it->second;
m_timeouts.remove(it);
delete timer;
}
void WindowQObject::timerEvent(QTimerEvent *e)
void WindowQObject::timerFired(DOMWindowTimer* timer)
{
TimeoutsMap::iterator it = m_timeouts.find(e->timerId());
ScheduledAction* action = it->second;
bool singleShot = action->singleShot();
// remove single shots before executing
if (singleShot) {
clearTimeout(e->timerId(), false);
m_timeouts.remove(it);
// Simple case for non-one-shot timers.
if (timer->isActive()) {
timer->action()->execute(m_parent);
return;
}
// Delete timer before executing the action for one-shot timers.
ScheduledAction* action = timer->takeAction();
m_timeouts.remove(timer->timeoutId());
delete timer;
action->execute(m_parent);
// It is important not to use action->singleShot here.
// The action could have been deleted already if not single shot the
// JS code called by execute() calls clearTimeout().
if (singleShot)
delete action;
delete action;
}
const ClassInfo FrameArray::info = { "FrameArray", 0, &FrameArrayTable, 0 };
......@@ -2508,4 +2533,9 @@ PausedTimeouts::~PausedTimeouts()
delete [] array;
}
void DOMWindowTimer::fired()
{
m_object->timerFired(this);
}
} // namespace KJS
......@@ -28,8 +28,6 @@
#include <qobject.h>
#include <qstring.h>
class QTimer;
namespace WebCore {
class AtomicString;
class Frame;
......@@ -69,6 +67,8 @@ namespace KJS {
PausedTimeouts& operator=(const PausedTimeouts&);
};
class DOMWindowTimer;
class WindowQObject : public QObject {
Q_OBJECT
public:
......@@ -82,15 +82,17 @@ namespace KJS {
PausedTimeouts *pauseTimeouts();
void resumeTimeouts(PausedTimeouts *);
void timerFired(DOMWindowTimer*);
private slots:
void parentDestroyed();
private:
virtual void timerEvent(QTimerEvent *);
int installTimeout(ScheduledAction*, int interval, bool singleShot);
Window *m_parent;
typedef HashMap<int, ScheduledAction*> TimeoutsMap;
Window* m_parent;
typedef HashMap<int, DOMWindowTimer*> TimeoutsMap;
TimeoutsMap m_timeouts;
};
};
class Screen : public JSObject {
public:
......@@ -225,18 +227,16 @@ namespace KJS {
*/
class ScheduledAction {
public:
ScheduledAction(JSValue *func, const List& args, bool singleShot)
: m_func(func), m_args(args), m_singleShot(singleShot) { }
ScheduledAction(const QString& code, bool singleShot)
: m_code(code), m_singleShot(singleShot) { }
ScheduledAction(JSValue *func, const List& args)
: m_func(func), m_args(args) { }
ScheduledAction(const QString& code)
: m_code(code) { }
void execute(Window *);
bool singleShot() const { return m_singleShot; }
private:
ProtectedPtr<JSValue> m_func;
List m_args;
QString m_code;
bool m_singleShot;
};
class Location : public JSObject {
......
......@@ -135,7 +135,7 @@ void Token::addAttribute(DocumentImpl* doc, const AtomicString& attrName, const
// ----------------------------------------------------------------------------
HTMLTokenizer::HTMLTokenizer(DocumentImpl* _doc, FrameView* _view, bool includesComments)
: inWrite(false)
: m_timer(this, &HTMLTokenizer::timerFired), inWrite(false)
{
view = _view;
buffer = 0;
......@@ -144,14 +144,13 @@ HTMLTokenizer::HTMLTokenizer(DocumentImpl* _doc, FrameView* _view, bool includes
parser = new HTMLParser(_view, _doc, includesComments);
m_executingScript = 0;
onHold = false;
timerId = 0;
includesCommentsInDOM = includesComments;
begin();
}
HTMLTokenizer::HTMLTokenizer(DocumentImpl *_doc, DocumentFragmentImpl *i, bool includesComments)
: inWrite(false)
: m_timer(this, &HTMLTokenizer::timerFired), inWrite(false)
{
view = 0;
buffer = 0;
......@@ -160,7 +159,6 @@ HTMLTokenizer::HTMLTokenizer(DocumentImpl *_doc, DocumentFragmentImpl *i, bool i
parser = new HTMLParser(i, _doc, includesComments);
m_executingScript = 0;
onHold = false;
timerId = 0;
includesCommentsInDOM = includesComments;
begin();
......@@ -187,11 +185,7 @@ void HTMLTokenizer::reset()
scriptCode = 0;
scriptCodeSize = scriptCodeMaxSize = scriptCodeResync = 0;
if (timerId) {
killTimer(timerId);
timerId = 0;
}
timerId = 0;
m_timer.stop();
m_state.setAllowYield(false);
m_state.setForceSynchronous(false);
......@@ -1321,8 +1315,7 @@ inline bool HTMLTokenizer::continueProcessing(int& processedCount, double startT
|| (!parser->doc()->haveStylesheetsLoaded() &&
(parser->doc()->documentElement()->id() != ID_HTML || parser->doc()->body()))) {*/
// Schedule the timer to keep processing as soon as possible.
if (!timerId)
timerId = startTimer(0);
m_timer.startOneShot(0);
#if INSTRUMENT_LAYOUT_SCHEDULING
if (currentTime() - startTime > tokenizerTimeDelay)
printf("Deferring processing of data because 500ms elapsed away from event loop.\n");
......@@ -1368,7 +1361,7 @@ bool HTMLTokenizer::write(const SegmentedString &str, bool appendData)
setSrc(str);
// Once a timer is set, it has control of when the tokenizer continues.
if (timerId)
if (m_timer.isActive())
return false;
bool wasInWrite = inWrite;
......@@ -1506,7 +1499,7 @@ bool HTMLTokenizer::write(const SegmentedString &str, bool appendData)
m_state = state;
if (noMoreData && !inWrite && !state.loadingExtScript() && !m_executingScript && !timerId) {
if (noMoreData && !inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) {
end(); // this actually causes us to be deleted
return true;
}
......@@ -1516,63 +1509,50 @@ bool HTMLTokenizer::write(const SegmentedString &str, bool appendData)
void HTMLTokenizer::stopParsing()
{
Tokenizer::stopParsing();