[BlackBerry] Fix suspend/resume assertion in setCompositor().
authorjpetsovits@rim.com <jpetsovits@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2012 17:57:42 +0000 (17:57 +0000)
committerjpetsovits@rim.com <jpetsovits@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Nov 2012 17:57:42 +0000 (17:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102397
RIM PR 244701

Reviewed by Adam Treat.

If a compositor is used but no surface pool is ever
allocated (which is a perfectly valid use case), initial
suspension of the backingstore is skipped because of an
early return. This will cause an assertion to be triggered
and a bug. Fix this by suspending it before the return.

With Adam Treat's recent change to split suspension of
screen and backingstore into two different functions,
this can now be reduced to a mere screen (blitting)
suspension. That was the original intention of this code.

* Api/BackingStore.cpp:
(BlackBerry::WebKit::BackingStorePrivate::createSurfaces):
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::setCompositor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@134788 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/Api/BackingStore.cpp
Source/WebKit/blackberry/Api/WebPage.cpp
Source/WebKit/blackberry/ChangeLog

index 842c97c..bebc3e5 100644 (file)
@@ -2069,6 +2069,10 @@ void BackingStorePrivate::createSurfaces()
         return;
     }
 
+    // Don't try to blit to screen unless we have a buffer.
+    if (!buffer())
+        suspendScreenUpdates();
+
     SurfacePool* surfacePool = SurfacePool::globalSurfacePool();
     surfacePool->initialize(tileSize());
 
@@ -2101,13 +2105,6 @@ void BackingStorePrivate::createSurfaces()
     swapState();
 
     createVisibleTileBufferForWebPage(m_webPage->d);
-
-    // Don't try to blit to screen unless we have a buffer.
-    if (!buffer()) {
-        // FIXME: Do we really need to suspend/resume both backingstore and screen here?
-        suspendBackingStoreUpdates();
-        suspendScreenUpdates();
-    }
 }
 
 void BackingStorePrivate::createVisibleTileBuffer()
index f1ec1e3..24cc7db 100644 (file)
@@ -5279,21 +5279,15 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit
     // That seems extremely likely to be the case, but let's assert just to make sure.
     ASSERT(webKitThreadMessageClient()->isCurrentThread());
 
-    if (m_compositor || m_client->window()) {
-        // FIXME: Do we really need to suspend/resume both backingstore and screen here?
-        m_backingStore->d->suspendBackingStoreUpdates();
+    if (m_compositor || m_client->window())
         m_backingStore->d->suspendScreenUpdates();
-    }
 
     // The m_compositor member has to be modified during a sync call for thread
     // safe access to m_compositor and its refcount.
     userInterfaceThreadMessageClient()->dispatchSyncMessage(createMethodCallMessage(&WebPagePrivate::setCompositorHelper, this, compositor));
 
-    if (m_compositor || m_client->window()) { // the new compositor, if one was set
-        // FIXME: Do we really need to suspend/resume both backingstore and screen here?
-        m_backingStore->d->resumeBackingStoreUpdates();
+    if (m_compositor || m_client->window()) // the new compositor, if one was set
         m_backingStore->d->resumeScreenUpdates(BackingStore::RenderAndBlit);
-    }
 }
 
 void WebPagePrivate::setCompositorHelper(PassRefPtr<WebPageCompositorPrivate> compositor)
index b7ef7f1..b2cdc66 100644 (file)
@@ -1,5 +1,29 @@
 2012-11-15  Jakob Petsovits  <jpetsovits@rim.com>
 
+        [BlackBerry] Fix suspend/resume assertion in setCompositor().
+        https://bugs.webkit.org/show_bug.cgi?id=102397
+        RIM PR 244701
+
+        Reviewed by Adam Treat.
+
+        If a compositor is used but no surface pool is ever
+        allocated (which is a perfectly valid use case), initial
+        suspension of the backingstore is skipped because of an
+        early return. This will cause an assertion to be triggered
+        and a bug. Fix this by suspending it before the return.
+
+        With Adam Treat's recent change to split suspension of
+        screen and backingstore into two different functions,
+        this can now be reduced to a mere screen (blitting)
+        suspension. That was the original intention of this code.
+
+        * Api/BackingStore.cpp:
+        (BlackBerry::WebKit::BackingStorePrivate::createSurfaces):
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::setCompositor):
+
+2012-11-15  Jakob Petsovits  <jpetsovits@rim.com>
+
         [BlackBerry] Leave surface resizing to the client.
         https://bugs.webkit.org/show_bug.cgi?id=102280
         RIM PR 235034