Changeset 41845 in webkit


Ignore:
Timestamp:
Mar 19, 2009 4:45:57 PM (15 years ago)
Author:
timothy@apple.com
Message:

Make the defered data loading timer honor the Page's scheduled runloop pairs.
Introduces a new RunLoopTimer class that has an API mimicking Timer but
allows it to be scheduled with one or more SchedulePairs.

<rdar://problem/6687342> -[WebView scheduleInRunLoop:forMode:] has no affect on timers

Reviewed by Darin Adler.

  • WebCore.xcodeproj/project.pbxproj: Adds the new RunLoopTimer.{cpp,h} files.
  • loader/MainResourceLoader.cpp: (WebCore::MainResourceLoader::handleDataLoadNow): Use the MainResourceLoaderTimer typedef. (WebCore::MainResourceLoader::startDataLoadTimer): Added. Start the timer and on Mac platforms also schedule with the Page's SchedulePairs. (WebCore::MainResourceLoader::handleDataLoadSoon): Call startDataLoadTimer(). (WebCore::MainResourceLoader::setDefersLoading): Ditto.
  • loader/MainResourceLoader.h:
  • platform/cf/RunLoopTimerCF.cpp: Added. (WebCore::RunLoopTimerBase::~RunLoopTimerBase): (WebCore::timerFired): (WebCore::RunLoopTimerBase::start): (WebCore::RunLoopTimerBase::schedule): (WebCore::RunLoopTimerBase::stop): (WebCore::RunLoopTimerBase::isActive):
  • platform/RunLoopTimer.h: Added. (WebCore::RunLoopTimerBase::RunLoopTimerBase): (WebCore::RunLoopTimerBase::startRepeating): (WebCore::RunLoopTimerBase::startOneShot): (WebCore::RunLoopTimer::RunLoopTimer): (WebCore::RunLoopTimer::fired):
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r41842 r41845  
     12009-03-19  Timothy Hatcher  <timothy@apple.com>
     2
     3        <rdar://problem/6687342> -[WebView scheduleInRunLoop:forMode:] has no affect on timers
     4
     5        Reviewed by Darin Adler.
     6
     7        * wtf/Platform.h: Added HAVE_RUNLOOP_TIMER for PLATFORM(MAC).
     8
    192009-03-19  Geoffrey Garen  <ggaren@apple.com>
    210
  • trunk/JavaScriptCore/wtf/Platform.h

    r41764 r41845  
    312312#endif
    313313#define HAVE_READLINE 1
     314#define HAVE_RUNLOOP_TIMER 1
    314315#endif
    315316
  • trunk/WebCore/ChangeLog

    r41841 r41845  
     12009-03-18  Timothy Hatcher  <timothy@apple.com>
     2
     3        Make the defered data loading timer honor the Page's scheduled runloop pairs.
     4        Introduces a new RunLoopTimer class that has an API mimicking Timer but
     5        allows it to be scheduled with one or more SchedulePairs.
     6
     7        <rdar://problem/6687342> -[WebView scheduleInRunLoop:forMode:] has no affect on timers
     8
     9        Reviewed by Darin Adler.
     10
     11        * WebCore.xcodeproj/project.pbxproj: Adds the new RunLoopTimer.{cpp,h} files.
     12        * loader/MainResourceLoader.cpp:
     13        (WebCore::MainResourceLoader::handleDataLoadNow): Use the MainResourceLoaderTimer typedef.
     14        (WebCore::MainResourceLoader::startDataLoadTimer): Added. Start the timer and on
     15        Mac platforms also schedule with the Page's SchedulePairs.
     16        (WebCore::MainResourceLoader::handleDataLoadSoon): Call startDataLoadTimer().
     17        (WebCore::MainResourceLoader::setDefersLoading): Ditto.
     18        * loader/MainResourceLoader.h:
     19        * platform/cf/RunLoopTimerCF.cpp: Added.
     20        (WebCore::RunLoopTimerBase::~RunLoopTimerBase):
     21        (WebCore::timerFired):
     22        (WebCore::RunLoopTimerBase::start):
     23        (WebCore::RunLoopTimerBase::schedule):
     24        (WebCore::RunLoopTimerBase::stop):
     25        (WebCore::RunLoopTimerBase::isActive):
     26        * platform/RunLoopTimer.h: Added.
     27        (WebCore::RunLoopTimerBase::RunLoopTimerBase):
     28        (WebCore::RunLoopTimerBase::startRepeating):
     29        (WebCore::RunLoopTimerBase::startOneShot):
     30        (WebCore::RunLoopTimer::RunLoopTimer):
     31        (WebCore::RunLoopTimer::fired):
     32
    1332009-03-19  Dimitri Glazkov  <dglazkov@chromium.org>
    234
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r41684 r41845  
    481481                1C5FAED20DCFD90100D58F78 /* JSJavaScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C5FAED00DCFD90100D58F78 /* JSJavaScriptCallFrame.h */; };
    482482                1C5FAEE70DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C5FAEE60DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp */; };
     483                1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C63A2460F71646600C09D5A /* RunLoopTimer.h */; };
     484                1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C63A2470F71646600C09D5A /* RunLoopTimerCF.cpp */; };
    483485                1C81B95A0E97330800266E07 /* InspectorController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C81B9560E97330800266E07 /* InspectorController.h */; settings = {ATTRIBUTES = (Private, ); }; };
    484486                1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C81B9570E97330800266E07 /* InspectorController.cpp */; };
     
    54315433                1C5FAED00DCFD90100D58F78 /* JSJavaScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSJavaScriptCallFrame.h; sourceTree = "<group>"; };
    54325434                1C5FAEE60DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSJavaScriptCallFrameCustom.cpp; sourceTree = "<group>"; };
     5435                1C63A2460F71646600C09D5A /* RunLoopTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RunLoopTimer.h; sourceTree = "<group>"; };
     5436                1C63A2470F71646600C09D5A /* RunLoopTimerCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RunLoopTimerCF.cpp; sourceTree = "<group>"; };
    54335437                1C81B9560E97330800266E07 /* InspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorController.h; sourceTree = "<group>"; };
    54345438                1C81B9570E97330800266E07 /* InspectorController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorController.cpp; sourceTree = "<group>"; };
     
    96659669                                5160306B0CC4362300C8AC25 /* FileSystemCF.cpp */,
    96669670                                1A98956A0AA78F80005EF5EF /* KURLCFNet.cpp */,
     9671                                1C63A2470F71646600C09D5A /* RunLoopTimerCF.cpp */,
    96679672                                1CEFC9B80D78DC8C007D2579 /* SchedulePair.cpp */,
    96689673                                1CEFC9B70D78DC8C007D2579 /* SchedulePair.h */,
     
    1388913894                                BC3BE12A0E98092F00835588 /* PopupMenuStyle.h */,
    1389013895                                E4D687780ED7AE4F006EA978 /* PurgeableBuffer.h */,
     13896                                1C63A2460F71646600C09D5A /* RunLoopTimer.h */,
    1389113897                                F587866202DE3B1101EA4122 /* SSLKeyGenerator.h */,
    1389213898                                93C09C850B0657AA005ABD4D /* ScrollTypes.h */,
     
    1690316909                                FE6FD4880F676E5700092873 /* Coordinates.h in Headers */,
    1690416910                                FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */,
     16911                                1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */,
    1690516912                        );
    1690616913                        runOnlyForDeploymentPostprocessing = 0;
     
    1890618913                                FE6FD4870F676E5700092873 /* Coordinates.cpp in Sources */,
    1890718914                                FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */,
     18915                                1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */,
    1890818916                        );
    1890918917                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/loader/MainResourceLoader.cpp

    r40745 r41845  
    412412}
    413413
    414 void MainResourceLoader::handleDataLoadNow(Timer<MainResourceLoader>*)
     414void MainResourceLoader::handleDataLoadNow(MainResourceLoaderTimer*)
    415415{
    416416    RefPtr<MainResourceLoader> protect(this);
     
    424424}
    425425
     426void MainResourceLoader::startDataLoadTimer()
     427{
     428    m_dataLoadTimer.startOneShot(0);
     429
     430#if HAVE(RUNLOOP_TIMER)
     431    if (SchedulePairHashSet* scheduledPairs = m_frame->page()->scheduledRunLoopPairs())
     432        m_dataLoadTimer.schedule(*scheduledPairs);
     433#endif
     434}
     435
    426436void MainResourceLoader::handleDataLoadSoon(ResourceRequest& r)
    427437{
     
    429439   
    430440    if (m_documentLoader->deferMainResourceDataLoad())
    431         m_dataLoadTimer.startOneShot(0);
     441        startDataLoadTimer();
    432442    else
    433443        handleDataLoadNow(0);
     
    513523{
    514524    ResourceLoader::setDefersLoading(defers);
    515    
     525
    516526    if (defers) {
    517527        if (m_dataLoadTimer.isActive())
     
    520530        if (m_initialRequest.isNull())
    521531            return;
    522        
    523         if (m_substituteData.isValid() &&
    524             m_documentLoader->deferMainResourceDataLoad())
    525                 m_dataLoadTimer.startOneShot(0);
     532
     533        if (m_substituteData.isValid() && m_documentLoader->deferMainResourceDataLoad())
     534            startDataLoadTimer();
    526535        else {
    527536            ResourceRequest r(m_initialRequest);
  • trunk/WebCore/loader/MainResourceLoader.h

    r41225 r41845  
    3030#include "ResourceLoader.h"
    3131#include "SubstituteData.h"
     32#include <wtf/Forward.h>
     33
     34#if HAVE(RUNLOOP_TIMER)
     35#include "RunLoopTimer.h"
     36#else
    3237#include "Timer.h"
    33 #include <wtf/Forward.h>
     38#endif
    3439
    3540namespace WebCore {
     
    5762        virtual void didFail(const ResourceError&);
    5863
    59         void handleDataLoadNow(Timer<MainResourceLoader>*);
     64#if HAVE(RUNLOOP_TIMER)
     65        typedef RunLoopTimer<MainResourceLoader> MainResourceLoaderTimer;
     66#else
     67        typedef Timer<MainResourceLoader> MainResourceLoaderTimer;
     68#endif
     69
     70        void handleDataLoadNow(MainResourceLoaderTimer*);
    6071
    6172        bool isLoadingMultipartContent() const { return m_loadingMultipartContent; }
     
    7586        void handleDataLoadSoon(ResourceRequest& r);
    7687
     88        void startDataLoadTimer();
    7789        void handleDataLoad(ResourceRequest&);
    7890
     
    91103        ResourceRequest m_initialRequest;
    92104        SubstituteData m_substituteData;
    93         Timer<MainResourceLoader> m_dataLoadTimer;
     105
     106        MainResourceLoaderTimer m_dataLoadTimer;
    94107
    95108#if ENABLE(OFFLINE_WEB_APPLICATIONS)
Note: See TracChangeset for help on using the changeset viewer.