Changeset 74062 in webkit


Ignore:
Timestamp:
Dec 14, 2010 2:52:24 PM (13 years ago)
Author:
mihaip@chromium.org
Message:

2010-12-14 Mihai Parparita <mihaip@chromium.org>

Reviewed by Dimitri Glazkov.

Move asynchronous event dispatching out of Document
https://bugs.webkit.org/show_bug.cgi?id=49785

Move asynchonous event code out of Document and into a standalone
EventQueue class (which supports async events for both regular nodes
and the window object).

No new tests necessary, since no new functionality is exposed (existing
layout tests pass).

  • Android.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::enqueueWindowEvent): (WebCore::Document::enqueueHashchangeEvent):
  • dom/DOMAllInOne.cpp: (WebCore::Document::eventQueue):
  • dom/Document.h:
  • dom/EventQueue.cpp: Added. (WebCore::EventQueue::EventQueue): (WebCore::EventQueue::enqueueEvent): (WebCore::EventQueue::pendingEventTimerFired): (WebCore::EventQueue::dispatchEvent):
  • dom/EventQueue.h: Added.
  • storage/StorageEventDispatcher.cpp: (WebCore::StorageEventDispatcher::dispatch):

2010-12-14 Mihai Parparita <mihaip@chromium.org>

Reviewed by Dimitri Glazkov.

Move asynchronous event dispatching out of Document
https://bugs.webkit.org/show_bug.cgi?id=49785

Change enqueueEvent callsite.

  • src/StorageAreaProxy.cpp: (WebCore::StorageAreaProxy::storageEvent):
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/Android.mk

    r74049 r74062  
    133133        dom/EventNames.cpp \
    134134        dom/EventTarget.cpp \
     135        dom/EventQueue.cpp \
    135136        dom/ExceptionBase.cpp \
    136137        dom/ExceptionCode.cpp \
  • trunk/WebCore/CMakeLists.txt

    r74049 r74062  
    853853    dom/EventNames.cpp
    854854    dom/EventTarget.cpp
     855    dom/EventQueue.cpp
    855856    dom/ExceptionBase.cpp
    856857    dom/ExceptionCode.cpp
  • trunk/WebCore/ChangeLog

    r74059 r74062  
     12010-12-14  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Move asynchronous event dispatching out of Document
     6        https://bugs.webkit.org/show_bug.cgi?id=49785
     7       
     8        Move asynchonous event code out of Document and into a standalone
     9        EventQueue class (which supports async events for both regular nodes
     10        and the window object).
     11
     12        No new tests necessary, since no new functionality is exposed (existing
     13        layout tests pass).
     14
     15        * Android.mk:
     16        * CMakeLists.txt:
     17        * GNUmakefile.am:
     18        * WebCore.gypi:
     19        * WebCore.pro:
     20        * WebCore.vcproj/WebCore.vcproj:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * dom/Document.cpp:
     23        (WebCore::Document::Document):
     24        (WebCore::Document::enqueueWindowEvent):
     25        (WebCore::Document::enqueueHashchangeEvent):
     26        * dom/DOMAllInOne.cpp:
     27        (WebCore::Document::eventQueue):
     28        * dom/Document.h:
     29        * dom/EventQueue.cpp: Added.
     30        (WebCore::EventQueue::EventQueue):
     31        (WebCore::EventQueue::enqueueEvent):
     32        (WebCore::EventQueue::pendingEventTimerFired):
     33        (WebCore::EventQueue::dispatchEvent):
     34        * dom/EventQueue.h: Added.
     35        * storage/StorageEventDispatcher.cpp:
     36        (WebCore::StorageEventDispatcher::dispatch):
     37
    1382010-12-14  Kyounga Ra  <kyounga.ra@gmail.com>
    239
  • trunk/WebCore/GNUmakefile.am

    r74049 r74062  
    12071207        WebCore/dom/EventTarget.cpp \
    12081208        WebCore/dom/EventTarget.h \
     1209        WebCore/dom/EventQueue.cpp \
     1210        WebCore/dom/EventQueue.h \
    12091211        WebCore/dom/ExceptionBase.cpp \
    12101212        WebCore/dom/ExceptionBase.h \
  • trunk/WebCore/WebCore.gypi

    r74049 r74062  
    12471247            'dom/EventTarget.cpp',
    12481248            'dom/EventTarget.h',
     1249            'dom/EventQueue.cpp',
     1250            'dom/EventQueue.h',
    12491251            'dom/ExceptionBase.cpp',
    12501252            'dom/ExceptionBase.h',
  • trunk/WebCore/WebCore.pro

    r74056 r74062  
    731731    dom/EventNames.cpp \
    732732    dom/EventTarget.cpp \
     733    dom/EventQueue.cpp \
    733734    dom/ExceptionBase.cpp \
    734735    dom/ExceptionCode.cpp \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r74049 r74062  
    4369843698                                >
    4369943699                        </File>
     43700                  <File
     43701                                RelativePath="..\dom\EventQueue.cpp"
     43702                                >
     43703                                <FileConfiguration
     43704                                        Name="Debug|Win32"
     43705                                        ExcludedFromBuild="true"
     43706                                        >
     43707                                        <Tool
     43708                                                Name="VCCLCompilerTool"
     43709                                        />
     43710                                </FileConfiguration>
     43711                                <FileConfiguration
     43712                                        Name="Release|Win32"
     43713                                        ExcludedFromBuild="true"
     43714                                        >
     43715                                        <Tool
     43716                                                Name="VCCLCompilerTool"
     43717                                        />
     43718                                </FileConfiguration>
     43719                                <FileConfiguration
     43720                                        Name="Debug_Internal|Win32"
     43721                                        ExcludedFromBuild="true"
     43722                                        >
     43723                                        <Tool
     43724                                                Name="VCCLCompilerTool"
     43725                                        />
     43726                                </FileConfiguration>
     43727                                <FileConfiguration
     43728                                        Name="Debug_Cairo|Win32"
     43729                                        ExcludedFromBuild="true"
     43730                                        >
     43731                                        <Tool
     43732                                                Name="VCCLCompilerTool"
     43733                                        />
     43734                                </FileConfiguration>
     43735                                <FileConfiguration
     43736                                        Name="Release_Cairo|Win32"
     43737                                        ExcludedFromBuild="true"
     43738                                        >
     43739                                        <Tool
     43740                                                Name="VCCLCompilerTool"
     43741                                        />
     43742                                </FileConfiguration>
     43743                                <FileConfiguration
     43744                                        Name="Debug_All|Win32"
     43745                                        ExcludedFromBuild="true"
     43746                                        >
     43747                                        <Tool
     43748                                                Name="VCCLCompilerTool"
     43749                                        />
     43750                                </FileConfiguration>
     43751                        </File>
     43752                        <File
     43753                                RelativePath="..\dom\EventQueue.h"
     43754                                >
     43755                        </File>
    4370043756                        <File
    4370143757                                RelativePath="..\dom\ExceptionBase.cpp"
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r74050 r74062  
    26912691                8C6EA61911EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C6EA61711EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp */; };
    26922692                8C6EA61A11EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */; };
     2693                8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6756191288B17B0047ACA3 /* EventQueue.h */; };
     2694                8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F67561A1288B17B0047ACA3 /* EventQueue.cpp */; };
    26932695                8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; };
    26942696                9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; };
     
    90289030                8C6EA61711EF7E0400FD8EE3 /* RuntimeEnabledFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RuntimeEnabledFeatures.cpp; path = generic/RuntimeEnabledFeatures.cpp; sourceTree = "<group>"; };
    90299031                8C6EA61811EF7E0400FD8EE3 /* RuntimeEnabledFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RuntimeEnabledFeatures.h; path = generic/RuntimeEnabledFeatures.h; sourceTree = "<group>"; };
     9032                8F6756191288B17B0047ACA3 /* EventQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventQueue.h; sourceTree = "<group>"; };
     9033                8F67561A1288B17B0047ACA3 /* EventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventQueue.cpp; sourceTree = "<group>"; };
    90309034                8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; };
    90319035                8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; };
     
    1880718811                                939885C108B7E3D100E707C4 /* EventNames.cpp */,
    1880818812                                939885C208B7E3D100E707C4 /* EventNames.h */,
     18813                                8F6756191288B17B0047ACA3 /* EventQueue.h */,
     18814                                8F67561A1288B17B0047ACA3 /* EventQueue.cpp */,
    1880918815                                E12EDBE90B308E0B002704B6 /* EventTarget.cpp */,
    1881018816                                E12EDB7A0B308A78002704B6 /* EventTarget.h */,
     
    2033220338                                1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */,
    2033320339                                939885C408B7E3D100E707C4 /* EventNames.h in Headers */,
     20340                                8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */,
    2033420341                                E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */,
    2033520342                                E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */,
     
    2309123098                                1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */,
    2309223099                                939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */,
     23100                                8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */,
    2309323101                                E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */,
    2309423102                                E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */,
  • trunk/WebCore/dom/DOMAllInOne.cpp

    r73690 r74062  
    7272#include "EventContext.cpp"
    7373#include "EventNames.cpp"
     74#include "EventQueue.cpp"
    7475#include "EventTarget.cpp"
    7576#include "ExceptionBase.cpp"
  • trunk/WebCore/dom/Document.cpp

    r73939 r74062  
    6060#include "EventListener.h"
    6161#include "EventNames.h"
     62#include "EventQueue.h"
    6263#include "ExceptionCode.h"
    6364#include "FocusController.h"
     
    404405#endif
    405406    , m_usingGeolocation(false)
    406     , m_pendingEventTimer(this, &Document::pendingEventTimerFired)
     407    , m_eventQueue(adoptPtr(new EventQueue))
    407408#if ENABLE(WML)
    408409    , m_containsWMLContent(false)
     
    34743475}
    34753476
    3476 void Document::enqueueEvent(PassRefPtr<Event> event)
    3477 {
    3478     m_pendingEventQueue.append(event);
    3479     if (!m_pendingEventTimer.isActive())
    3480         m_pendingEventTimer.startOneShot(0);
    3481 }
    3482 
    3483 void Document::pendingEventTimerFired(Timer<Document>*)
    3484 {
    3485     ASSERT(!m_pendingEventTimer.isActive());
    3486     Vector<RefPtr<Event> > eventQueue;
    3487     eventQueue.swap(m_pendingEventQueue);
    3488 
    3489     typedef Vector<RefPtr<Event> >::const_iterator Iterator;
    3490     Iterator end = eventQueue.end();
    3491     for (Iterator it = eventQueue.begin(); it != end; ++it)
    3492         dispatchWindowEvent(*it);
     3477void Document::enqueueWindowEvent(PassRefPtr<Event> event)
     3478{
     3479    event->setTarget(domWindow());
     3480    m_eventQueue->enqueueEvent(event);
    34933481}
    34943482
     
    47524740void Document::enqueueHashchangeEvent(const String& oldURL, const String& newURL)
    47534741{
    4754     enqueueEvent(HashChangeEvent::create(oldURL, newURL));
     4742    enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL));
    47554743}
    47564744
  • trunk/WebCore/dom/Document.h

    r74041 r74062  
    7777class Event;
    7878class EventListener;
     79class EventQueue;
    7980class FormAssociatedElement;
    8081class Frame;
     
    10271028    void setContainsValidityStyleRules() { m_containsValidityStyleRules = true; }
    10281029
    1029     void enqueueEvent(PassRefPtr<Event>);
     1030    void enqueueWindowEvent(PassRefPtr<Event>);
    10301031    void enqueuePageshowEvent(PageshowEventPersistence);
    10311032    void enqueueHashchangeEvent(const String& oldURL, const String& newURL);
    10321033    void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject);
     1034    EventQueue* eventQueue() const { return m_eventQueue.get(); }
    10331035
    10341036    void addMediaCanStartListener(MediaCanStartListener*);
     
    11281130
    11291131    void createStyleSelector();
    1130 
    1131     void pendingEventTimerFired(Timer<Document>*);
    11321132
    11331133    PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const;
     
    13531353
    13541354    bool m_usingGeolocation;
    1355 
    1356     Timer<Document> m_pendingEventTimer;
    1357     Vector<RefPtr<Event> > m_pendingEventQueue;
     1355   
     1356    OwnPtr<EventQueue> m_eventQueue;
    13581357
    13591358#if ENABLE(WML)
  • trunk/WebCore/storage/StorageEventDispatcher.cpp

    r58873 r74062  
    5959            Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
    6060            if (!ec)
    61                 frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
     61                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    6262        }
    6363    } else {
     
    7676            Storage* storage = frames[i]->domWindow()->localStorage(ec);
    7777            if (!ec)
    78                 frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
     78                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    7979        }
    8080    }
  • trunk/WebKit/chromium/ChangeLog

    r73995 r74062  
     12010-12-14  Mihai Parparita  <mihaip@chromium.org>
     2
     3        Reviewed by Dimitri Glazkov.
     4
     5        Move asynchronous event dispatching out of Document
     6        https://bugs.webkit.org/show_bug.cgi?id=49785
     7       
     8        Change enqueueEvent callsite.
     9
     10        * src/StorageAreaProxy.cpp:
     11        (WebCore::StorageAreaProxy::storageEvent):
     12
    1132010-12-13  Mike Lawther  <mikelawther@chromium.org>
    214
  • trunk/WebKit/chromium/src/StorageAreaProxy.cpp

    r58873 r74062  
    130130            Storage* storage = frames[i]->domWindow()->sessionStorage(ec);
    131131            if (!ec)
    132                 frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
     132                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    133133        }
    134134    } else {
     
    147147            Storage* storage = frames[i]->domWindow()->localStorage(ec);
    148148            if (!ec)
    149                 frames[i]->document()->enqueueEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
     149                frames[i]->document()->enqueueWindowEvent(StorageEvent::create(eventNames().storageEvent, key, oldValue, newValue, sourceFrame->document()->url(), storage));
    150150        }
    151151    }
Note: See TracChangeset for help on using the changeset viewer.