Title: [112304] trunk/Source/WebCore
- Revision
- 112304
- Author
- [email protected]
- Date
- 2012-03-27 13:06:14 -0700 (Tue, 27 Mar 2012)
Log Message
[BlackBerry] fix confusing destruction sequence in LayerCompositingThread
https://bugs.webkit.org/show_bug.cgi?id=81706
Patch by Joe Mason <[email protected]> on 2012-03-27
Reviewed by Rob Buis.
LayerCompositingThread has a destructor that does a synchronous
dispatch to the compositing thread and then does the actual cleanup
from a helper function. This is confusing.It should be the
opposite: the helper function dispatches to the compositing thread,
which calls delete.
No new tests since the existing animation tests will exercise this
code.
* platform/graphics/blackberry/LayerCompositingThread.cpp:
(WebCore::LayerCompositingThread::destroyOnCompositingThread):
(WebCore):
(WebCore::LayerCompositingThread::~LayerCompositingThread):
* platform/graphics/blackberry/LayerCompositingThread.h:
(LayerCompositingThread):
(WTF):
(WTF::::deref):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112303 => 112304)
--- trunk/Source/WebCore/ChangeLog 2012-03-27 19:36:20 UTC (rev 112303)
+++ trunk/Source/WebCore/ChangeLog 2012-03-27 20:06:14 UTC (rev 112304)
@@ -1,3 +1,28 @@
+2012-03-27 Joe Mason <[email protected]>
+
+ [BlackBerry] fix confusing destruction sequence in LayerCompositingThread
+ https://bugs.webkit.org/show_bug.cgi?id=81706
+
+ Reviewed by Rob Buis.
+
+ LayerCompositingThread has a destructor that does a synchronous
+ dispatch to the compositing thread and then does the actual cleanup
+ from a helper function. This is confusing.It should be the
+ opposite: the helper function dispatches to the compositing thread,
+ which calls delete.
+
+ No new tests since the existing animation tests will exercise this
+ code.
+
+ * platform/graphics/blackberry/LayerCompositingThread.cpp:
+ (WebCore::LayerCompositingThread::destroyOnCompositingThread):
+ (WebCore):
+ (WebCore::LayerCompositingThread::~LayerCompositingThread):
+ * platform/graphics/blackberry/LayerCompositingThread.h:
+ (LayerCompositingThread):
+ (WTF):
+ (WTF::::deref):
+
2012-03-27 Alexey Proskuryakov <[email protected]>
[Mac] Stop using NSMapTable in FormDataStreamMac.mm
Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp (112303 => 112304)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp 2012-03-27 19:36:20 UTC (rev 112303)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.cpp 2012-03-27 20:06:14 UTC (rev 112304)
@@ -71,14 +71,6 @@
{
}
-LayerCompositingThread::~LayerCompositingThread()
-{
- // Unfortunately, ThreadSafeShared<T> is hardwired to call T::~T().
- // To switch threads in case the last reference is released on the
- // WebKit thread, we send a sync message to the compositing thread.
- destroyOnCompositingThread();
-}
-
void LayerCompositingThread::destroyOnCompositingThread()
{
if (!isCompositingThread()) {
@@ -88,6 +80,13 @@
return;
}
+ delete this;
+}
+
+LayerCompositingThread::~LayerCompositingThread()
+{
+ ASSERT(isCompositingThread());
+
m_tiler->layerCompositingThreadDestroyed();
ASSERT(!superlayer());
Modified: trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h (112303 => 112304)
--- trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h 2012-03-27 19:36:20 UTC (rev 112303)
+++ trunk/Source/WebCore/platform/graphics/blackberry/LayerCompositingThread.h 2012-03-27 20:06:14 UTC (rev 112304)
@@ -53,7 +53,6 @@
namespace WebCore {
-class DestroyOnCompositingThread;
class LayerRenderer;
class LayerCompositingThread : public ThreadSafeRefCounted<LayerCompositingThread>, public LayerData, public BlackBerry::Platform::GuardedPointerBase {
@@ -145,7 +144,7 @@
private:
LayerCompositingThread(LayerType, PassRefPtr<LayerTiler>);
- friend class DestroyOnCompositingThread;
+ friend class WTF::ThreadSafeRefCounted<WebCore::LayerCompositingThread>;
void destroyOnCompositingThread();
void updateTileContents(const IntRect& tile);
@@ -188,8 +187,25 @@
RefPtr<LayerTiler> m_tiler;
};
+} // namespace WebCore
+
+namespace WTF {
+
+// LayerCompositingThread objects must be destroyed on the compositing thread.
+// But it's possible for the last reference to be held by the WebKit thread.
+// So we create a custom specialization of ThreadSafeRefCounted which calls a
+// function that ensures the destructor is called on the correct thread, rather
+// than calling delete directly.
+template<>
+inline void ThreadSafeRefCounted<WebCore::LayerCompositingThread>::deref()
+{
+ if (derefBase())
+ static_cast<WebCore::LayerCompositingThread*>(this)->destroyOnCompositingThread();
}
+} // namespace WTF
+
+
#endif // USE(ACCELERATED_COMPOSITING)
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes