Changeset 70098 in webkit


Ignore:
Timestamp:
Oct 19, 2010 3:48:18 PM (14 years ago)
Author:
andersca@apple.com
Message:

Coalesce plug-in drawing
https://bugs.webkit.org/show_bug.cgi?id=47939

Reviewed by Sam Weinig.

Coalesce plug-in drawing in the same manner as we do it in the chunked update drawing area.

  • PluginProcess/PluginControllerProxy.cpp:

(WebKit::PluginControllerProxy::PluginControllerProxy):
Initialize m_waitingForDidUpdate to false.

(WebKit::PluginControllerProxy::startPaintTimer):
Move code from invalidate out to here. Don't start the paint timer if m_waitingForDidUpdate is true.

(WebKit::PluginControllerProxy::invalidate):
Call startPaintTimer.

(WebKit::PluginControllerProxy::didUpdate):
Set m_waitingForDidUpdate to false and start the paint timer.

  • PluginProcess/PluginControllerProxy.messages.in:

Add DidUpdate message.

  • WebProcess/Plugins/PluginProxy.cpp:

(WebKit::PluginProxy::PluginProxy):
Initialize m_waitingForPaintInResponseToUpdate to false.

(WebKit::PluginProxy::paint):
If m_waitingForPaintInResponseToUpdate is true, send a DidUpdate message.

(WebKit::PluginProxy::update):
Set m_waitingForPaintInResponseToUpdate to true.

Location:
trunk/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70097 r70098  
     12010-10-19  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Coalesce plug-in drawing
     6        https://bugs.webkit.org/show_bug.cgi?id=47939
     7
     8        Coalesce plug-in drawing in the same manner as we do it in the chunked update drawing area.
     9
     10        * PluginProcess/PluginControllerProxy.cpp:
     11        (WebKit::PluginControllerProxy::PluginControllerProxy):
     12        Initialize m_waitingForDidUpdate to false.
     13
     14        (WebKit::PluginControllerProxy::startPaintTimer):
     15        Move code from invalidate out to here. Don't start the paint timer if m_waitingForDidUpdate is true.
     16
     17        (WebKit::PluginControllerProxy::invalidate):
     18        Call startPaintTimer.
     19
     20        (WebKit::PluginControllerProxy::didUpdate):
     21        Set m_waitingForDidUpdate to false and start the paint timer.
     22
     23        * PluginProcess/PluginControllerProxy.messages.in:
     24        Add DidUpdate message.
     25
     26        * WebProcess/Plugins/PluginProxy.cpp:
     27        (WebKit::PluginProxy::PluginProxy):
     28        Initialize m_waitingForPaintInResponseToUpdate to false.
     29
     30        (WebKit::PluginProxy::paint):
     31        If m_waitingForPaintInResponseToUpdate is true, send a DidUpdate message.
     32
     33        (WebKit::PluginProxy::update):
     34        Set m_waitingForPaintInResponseToUpdate to true.
     35
    1362010-10-19  Sam Weinig  <sam@webkit.org>
    237
  • trunk/WebKit2/PluginProcess/PluginControllerProxy.cpp

    r68989 r70098  
    5454    , m_isPrivateBrowsingEnabled(isPrivateBrowsingEnabled)
    5555    , m_paintTimer(RunLoop::main(), this, &PluginControllerProxy::paint)
     56    , m_waitingForDidUpdate(false)
    5657{
    5758}
     
    103104}
    104105
     106void PluginControllerProxy::startPaintTimer()
     107{
     108    // Check if we should start the timer.
     109   
     110    if (m_dirtyRect.isEmpty())
     111        return;
     112
     113    // FIXME: Check clip rect.
     114   
     115    if (m_paintTimer.isActive())
     116        return;
     117
     118    if (m_waitingForDidUpdate)
     119        return;
     120
     121    // Start the timer.
     122    m_paintTimer.startOneShot(0);
     123
     124    m_waitingForDidUpdate = true;
     125}
     126
    105127void PluginControllerProxy::invalidate(const IntRect& rect)
    106128{
     
    114136    m_dirtyRect.unite(dirtyRect);
    115137
    116     // Check if we should start the timer.
    117    
    118     if (m_dirtyRect.isEmpty())
    119         return;
    120    
    121     // FIXME: Check clip rect.
    122    
    123     if (m_paintTimer.isActive())
    124         return;
    125 
    126     // Start the timer.
    127     m_paintTimer.startOneShot(0);
     138    startPaintTimer();
    128139}
    129140
     
    286297}
    287298
     299void PluginControllerProxy::didUpdate()
     300{
     301    m_waitingForDidUpdate = false;
     302    startPaintTimer();
     303}
     304
    288305#if PLATFORM(MAC)
    289306void PluginControllerProxy::windowFocusChanged(bool hasFocus)
  • trunk/WebKit2/PluginProcess/PluginControllerProxy.h

    r68989 r70098  
    6363    PluginControllerProxy(WebProcessConnection* connection, uint64_t pluginInstanceID, const String& userAgent, bool isPrivateBrowsingEnabled);
    6464
     65    void startPaintTimer();
    6566    void paint();
    6667
     
    9596    void handleKeyboardEvent(const WebKeyboardEvent&, bool& handled);
    9697    void setFocus(bool);
     98    void didUpdate();
    9799#if PLATFORM(MAC)
    98100    void windowFocusChanged(bool);
     
    120122    RunLoop::Timer<PluginControllerProxy> m_paintTimer;
    121123
     124    // Whether we're waiting for the plug-in proxy in the web process to draw the contents of its
     125    // backing store into the web process backing store.
     126    bool m_waitingForDidUpdate;
     127
    122128    // The backing store that this plug-in draws into.
    123129    RefPtr<BackingStore> m_backingStore;
  • trunk/WebKit2/PluginProcess/PluginControllerProxy.messages.in

    r68989 r70098  
    6060    SetFocus(bool isFocused)
    6161
     62    # Sent when the update requested by Update has been painted.
     63    DidUpdate()
     64
    6265#if PLATFORM(MAC)
    6366    # Sent when the containing NSWindow's focus changes
  • trunk/WebKit2/WebProcess/Plugins/PluginProxy.cpp

    r68989 r70098  
    5959    , m_pluginController(0)
    6060    , m_isStarted(false)
    61 
     61    , m_waitingForPaintInResponseToUpdate(false)
    6262{
    6363}
     
    123123
    124124    graphicsContext->restore();
     125
     126    if (m_waitingForPaintInResponseToUpdate) {
     127        m_waitingForPaintInResponseToUpdate = false;
     128        m_connection->connection()->send(Messages::PluginControllerProxy::DidUpdate(), m_pluginInstanceID);
     129        return;
     130    }
    125131}
    126132
     
    350356    }
    351357
    352     // Ask the controller to invalidate the rect for us.       
     358    // Ask the controller to invalidate the rect for us.
     359    m_waitingForPaintInResponseToUpdate = true;
    353360    m_pluginController->invalidate(paintedRectPluginCoordinates);
    354361}
  • trunk/WebKit2/WebProcess/Plugins/PluginProxy.h

    r68989 r70098  
    115115
    116116    bool m_isStarted;
     117
     118    // Whether we're called invalidate in response to an update call, and are now waiting for a paint call.
     119    bool m_waitingForPaintInResponseToUpdate;
    117120};
    118121
Note: See TracChangeset for help on using the changeset viewer.