Ignore:
Timestamp:
May 7, 2010, 11:24:12 PM (15 years ago)
Author:
[email protected]
Message:

JavaScriptCore: Safari pegs CPU and drops tons of frames using HTML5 Vimeo player
<https://bugs.webkit.org/show_bug.cgi?id=34005>
<rdar://problem/7569713>

Reviewed by Maciej Stachowiak

Added cancelCallOnMainThread. callOnMainThread should always now be paired
with cancelCallOnMainThread in situations where the refcon passed to callOnMainThread
may be dealloced before the main thread function can be dispatched.

  • wtf/MainThread.cpp:

(WTF::FunctionWithContext::operator == ): Supports the FunctionWithContextFinder predicate functor.
(WTF::FunctionWithContextFinder::FunctionWithContextFinder): Predicate functor for use with Dequeue::findIf
(WTF::FunctionWithContextFinder::operator()):
(WTF::cancelCallOnMainThread):

  • wtf/MainThread.h:

WebCore: Safari pegs CPU and drops tons of frames using HTML5 Vimeo player
<https://bugs.webkit.org/show_bug.cgi?id=34005>
<rdar://problem/7569713>

Reviewed by Eric Carlson

The original functionality of QTMovieWin has been split between QTMovieGWorld,
and a new class: QTMovie. QTMovie contains all the "controller" parts (changing
the rate, seeking, etc) while QTMovieGWorld retains all the drawing code. QTMovieGWorld
now takes a QTMovie, and as such QTMovie is now retainable. QTMovieGWorld registers
itself as a client of QTMovie, so that it can receive load-state notifications,
and thus QTMovie must now support multiple clients. Movie tasking timer support
has been moved into its own class (QTMovieTask) and will be addressed in a future
patch. Most of the functions listed below only changed so much as their class name changed.

  • platform/graphics/win/QTMovie.cpp: Copied from WebCore/platform/graphics/win/QTMovieWin.cpp.

(QTMoviePrivate::QTMoviePrivate):
(QTMoviePrivate::~QTMoviePrivate):
(QTMoviePrivate::startTask):
(QTMoviePrivate::endTask):
(QTMoviePrivate::task):
(QTMoviePrivate::createMovieController):
(QTMovie::QTMovie):
(QTMovie::~QTMovie):
(QTMovie::addClient):
(QTMovie::removeClient):
(QTMovie::play):
(QTMovie::pause):
(QTMovie::rate):
(QTMovie::setRate):
(QTMovie::duration):
(QTMovie::currentTime):
(QTMovie::setCurrentTime):
(QTMovie::setVolume):
(QTMovie::setPreservesPitch):
(QTMovie::dataSize):
(QTMovie::maxTimeLoaded):
(QTMovie::loadState):
(QTMovie::getNaturalSize):
(QTMovie::load):
(QTMovie::disableUnsupportedTracks):
(QTMovie::isDisabled):
(QTMovie::setDisabled):
(QTMovie::hasVideo):
(QTMovie::hasAudio):
(QTMovie::hasClosedCaptions):
(QTMovie::setClosedCaptionsVisible):
(QTMovie::countSupportedTypes):
(QTMovie::getSupportedType):
(QTMovie::initializeQuickTime):
(QTMovie::getMovieHandle):

  • platform/graphics/win/QTMovie.h: Copied from WebCore/platform/graphics/win/QTMovieWin.h.
  • platform/graphics/win/QTMovieGWorld.cpp: Copied from WebCore/platform/graphics/win/QTMovieWin.cpp.

(QTMovieGWorldPrivate::QTMovieGWorldPrivate):
(QTMovieGWorldPrivate::~QTMovieGWorldPrivate):
(QTMovieGWorldPrivate::cacheMovieScale):
(movieDrawingCompleteProc):
(QTMovieGWorldPrivate::registerDrawingCallback):
(QTMovieGWorldPrivate::unregisterDrawingCallback):
(QTMovieGWorldPrivate::drawingComplete):
(QTMovieGWorldPrivate::updateGWorld):
(QTMovieGWorldPrivate::createGWorld):
(QTMovieGWorldPrivate::clearGWorld):
(QTMovieGWorldPrivate::setSize):
(QTMovieGWorldPrivate::updateMovieSize):
(QTMovieGWorldPrivate::deleteGWorld):
(QTMovieGWorldPrivate::movieEnded):
(QTMovieGWorldPrivate::movieLoadStateChanged):
(QTMovieGWorldPrivate::movieTimeChanged):
(QTMovieGWorld::QTMovieGWorld):
(QTMovieGWorld::~QTMovieGWorld):
(QTMovieGWorld::setSize):
(QTMovieGWorld::setVisible):
(QTMovieGWorld::getCurrentFrameInfo):
(QTMovieGWorld::paint):
(QTMovieGWorld::setDisabled):
(QTMovieGWorld::isDisabled):
(QTMovieGWorld::fullscreenWndProc):
(QTMovieGWorld::enterFullscreen):
(QTMovieGWorld::exitFullscreen):
(QTMovieGWorld::setMovie):
(QTMovieGWorld::movie):

  • platform/graphics/win/QTMovieGWorld.h: Copied from WebCore/platform/graphics/win/QTMovieWin.h.
  • platform/graphics/win/QTMovieTask.cpp: Added.

(QTMovieTask::QTMovieTask):
(QTMovieTask::~QTMovieTask):
(QTMovieTask::sharedTask):
(QTMovieTask::updateTaskTimer):
(QTMovieTask::fireTaskClients):
(QTMovieTask::addTaskClient):
(QTMovieTask::removeTaskClient):
(QTMovieTask::setTaskTimerFuncs):

  • platform/graphics/win/QTMovieTask.h: Added.

WebKit/win: Safari pegs CPU and drops tons of frames using HTML5 Vimeo player
https://bugs.webkit.org/show_bug.cgi?id=34005

Reviewed by Adele Peterson.

QTMovieWin is now QTMovieGWorld.

  • FullscreenVideoController.cpp:

(FullscreenVideoController::movie):

  • FullscreenVideoController.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/MainThread.cpp

    r58425 r59001  
    5252    {
    5353    }
     54    bool operator == (const FunctionWithContext& o)
     55    {
     56        return function == o.function
     57            && context == o.context
     58            && syncFlag == o.syncFlag;
     59    }
    5460};
     61
     62class FunctionWithContextFinder {
     63public:
     64    FunctionWithContextFinder(const FunctionWithContext& m) : m(m) {}
     65    bool operator() (FunctionWithContext& o) { return o == m; }
     66    FunctionWithContext m;
     67};
     68
    5569
    5670typedef Deque<FunctionWithContext> FunctionQueue;
     
    186200}
    187201
     202void cancelCallOnMainThread(MainThreadFunction* function, void* context)
     203{
     204    ASSERT(function);
     205
     206    MutexLocker locker(mainThreadFunctionQueueMutex());
     207
     208    FunctionWithContextFinder pred(FunctionWithContext(function, context));
     209
     210    while (true) {
     211        // We must redefine 'i' each pass, because the itererator's operator=
     212        // requires 'this' to be valid, and remove() invalidates all iterators
     213        FunctionQueue::iterator i(functionQueue().findIf(pred));
     214        if (i == functionQueue().end())
     215            break;
     216        functionQueue().remove(i);
     217    }
     218}
     219
    188220void setMainThreadCallbacksPaused(bool paused)
    189221{
Note: See TracChangeset for help on using the changeset viewer.