[haiku-webkit-commits] r242 - webkit/trunk/WebKit/haiku/API

  • From: webkit@xxxxxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sun, 28 Feb 2010 12:52:43 +0000

Author: stippi
Date: Sun Feb 28 12:52:43 2010
New Revision: 242
URL: http://mmlr.dyndns.org/changeset/242

Log:
Don't relayout in BWebPage::paint(). This can in cycle back to reenter paint(),
which will then deadlock, since we already hold the lock of the offscreen 
bitmap,
but try to lock the BWebView looper again (reversed locking order). The
relayouting does not seem to be necessary at all. Prevent the reenter anyway
with a flag and print a warning to stdout if it is detected.

Modified:
   webkit/trunk/WebKit/haiku/API/WebPage.cpp
   webkit/trunk/WebKit/haiku/API/WebPage.h

Modified: webkit/trunk/WebKit/haiku/API/WebPage.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/API/WebPage.cpp   Sat Feb 27 20:47:03 2010        
(r241)
+++ webkit/trunk/WebKit/haiku/API/WebPage.cpp   Sun Feb 28 12:52:43 2010        
(r242)
@@ -161,6 +161,7 @@
     , m_page(0)
     , m_pageVisible(true)
     , m_pageDirty(false)
+    , m_inPaint(false)
     , m_toolbarsVisible(true)
     , m_statusbarVisible(true)
     , m_menubarVisible(true)
@@ -173,7 +174,7 @@
                                0,
                                0);
 
-    // Default settings - We should have WebViewSettings class for this.
+    // Default settings - We should have BWebSettings class for this.
     WebCore::Settings* settings = m_page->settings();
     settings->setLoadsImagesAutomatically(true);
     settings->setMinimumFontSize(5);
@@ -531,6 +532,12 @@
 void BWebPage::paint(BRect rect, bool contentChanged, bool immediate,
     bool repaintContentOnly)
 {
+       if (m_inPaint) {
+               printf("%p->BWebPage::paint(BRect(%.1f, %.1f, %.1f, %.1f), %d, 
%d, %d) - already painting!\n",
+                       this, rect.left, rect.top, rect.right, rect.bottom, 
contentChanged, immediate,
+                       repaintContentOnly);
+               return;
+       }
     // Block any drawing as long as the BWebView is hidden
     // (should be extended to when the containing BWebWindow is not
     // currently on screen either...)
@@ -550,9 +557,13 @@
     if (!view || !frame->contentRenderer())
         return;
 
+       m_inPaint = true;
+
 //    if (m_webView->LockLooperWithTimeout(5000) != B_OK)
-    if (!m_webView->LockLooper())
+    if (!m_webView->LockLooper()) {
+       m_inPaint = false;
         return;
+    }
     BView* offscreenView = m_webView->OffscreenView();
 
     // Lock the offscreen bitmap while we still have the
@@ -564,7 +575,6 @@
 
     WebCore::GraphicsContext context(offscreenView);
 
-    view->layoutIfNeededRecursive();
     offscreenView->PushState();
     if (!rect.IsValid())
         rect = offscreenView->Bounds();
@@ -578,6 +588,8 @@
 
     // Notify the window that it can now pull the bitmap in its own thread
     m_webView->SetOffscreenViewClean(rect, immediate);
+
+       m_inPaint = false;
 }
 
 // #pragma mark - private
@@ -771,13 +783,6 @@
         paint(BRect(), false, false, true);
 }
 
-void BWebPage::handleDraw(const BMessage* message)
-{
-    BRect rect;
-    message->FindRect("update rect", &rect);
-    paint(rect, true, false, true);
-}
-
 void BWebPage::handleFrameResized(const BMessage* message)
 {
     float width;

Modified: webkit/trunk/WebKit/haiku/API/WebPage.h
==============================================================================
--- webkit/trunk/WebKit/haiku/API/WebPage.h     Sat Feb 27 20:47:03 2010        
(r241)
+++ webkit/trunk/WebKit/haiku/API/WebPage.h     Sun Feb 28 12:52:43 2010        
(r242)
@@ -175,7 +175,6 @@
        void handleGoForward(const BMessage* message);
        void handleStop(const BMessage* message);
        void handleSetVisible(const BMessage* message);
-       void handleDraw(const BMessage* message);
        void handleFrameResized(const BMessage* message);
        void handleFocused(const BMessage* message);
        void handleActivated(const BMessage* message);
@@ -197,6 +196,7 @@
 
     bool m_pageVisible;
     bool m_pageDirty;
+    bool m_inPaint;
 
        bool m_toolbarsVisible;
        bool m_statusbarVisible;

Other related posts:

  • » [haiku-webkit-commits] r242 - webkit/trunk/WebKit/haiku/API - webkit