Title: [120902] trunk/Source/WebCore
- Revision
- 120902
- Author
- e...@google.com
- Date
- 2012-06-20 21:46:05 -0700 (Wed, 20 Jun 2012)
Log Message
[chromium] Modify CCDamageTracker hash to allow for layer id 0
https://bugs.webkit.org/show_bug.cgi?id=89631
Reviewed by James Robinson.
HashMap has the bizarre property that 0 is the empty value for integer
keys. Modify the damage tracking HashMap to use negative values for
both the empty and the deleted key traits. Additionally, make sure we
never generate negative layer IDs in practice.
Test: passes webkit_unit_tests with the patch in bug 89589 applied.
* platform/graphics/chromium/LayerChromium.cpp:
(WebCore::LayerChromium::LayerChromium):
* platform/graphics/chromium/cc/CCDamageTracker.h:
(RectMapKeyTraits):
(WebCore::CCDamageTracker::RectMapKeyTraits::emptyValue):
(WebCore::CCDamageTracker::RectMapKeyTraits::constructDeletedValue):
(WebCore::CCDamageTracker::RectMapKeyTraits::isDeletedValue):
(CCDamageTracker):
* platform/graphics/chromium/cc/CCLayerImpl.cpp:
(WebCore::CCLayerImpl::CCLayerImpl):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (120901 => 120902)
--- trunk/Source/WebCore/ChangeLog 2012-06-21 04:27:18 UTC (rev 120901)
+++ trunk/Source/WebCore/ChangeLog 2012-06-21 04:46:05 UTC (rev 120902)
@@ -1,3 +1,28 @@
+2012-06-20 Adrienne Walker <e...@google.com>
+
+ [chromium] Modify CCDamageTracker hash to allow for layer id 0
+ https://bugs.webkit.org/show_bug.cgi?id=89631
+
+ Reviewed by James Robinson.
+
+ HashMap has the bizarre property that 0 is the empty value for integer
+ keys. Modify the damage tracking HashMap to use negative values for
+ both the empty and the deleted key traits. Additionally, make sure we
+ never generate negative layer IDs in practice.
+
+ Test: passes webkit_unit_tests with the patch in bug 89589 applied.
+
+ * platform/graphics/chromium/LayerChromium.cpp:
+ (WebCore::LayerChromium::LayerChromium):
+ * platform/graphics/chromium/cc/CCDamageTracker.h:
+ (RectMapKeyTraits):
+ (WebCore::CCDamageTracker::RectMapKeyTraits::emptyValue):
+ (WebCore::CCDamageTracker::RectMapKeyTraits::constructDeletedValue):
+ (WebCore::CCDamageTracker::RectMapKeyTraits::isDeletedValue):
+ (CCDamageTracker):
+ * platform/graphics/chromium/cc/CCLayerImpl.cpp:
+ (WebCore::CCLayerImpl::CCLayerImpl):
+
2012-06-20 Adam Klein <ad...@chromium.org>
Use Dictionary in MutationObserver.observe to kill custom code
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp (120901 => 120902)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-06-21 04:27:18 UTC (rev 120901)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp 2012-06-21 04:46:05 UTC (rev 120902)
@@ -97,6 +97,10 @@
, m_layerAnimationDelegate(0)
, m_layerScrollDelegate(0)
{
+ if (m_layerId < 0) {
+ s_nextLayerId = 1;
+ m_layerId = s_nextLayerId++;
+ }
}
LayerChromium::~LayerChromium()
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h (120901 => 120902)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h 2012-06-21 04:27:18 UTC (rev 120901)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h 2012-06-21 04:46:05 UTC (rev 120902)
@@ -70,7 +70,14 @@
// To correctly track exposed regions, two hashtables of rects are maintained.
// The "current" map is used to compute exposed regions of the current frame, while
// the "next" map is used to collect layer rects that are used in the next frame.
- typedef HashMap<int, FloatRect> RectMap;
+ struct RectMapKeyTraits : HashTraits<int> {
+ static const bool emptyValueIsZero = false;
+ static const bool needsDestruction = false;
+ static int emptyValue() { return -1; }
+ static void constructDeletedValue(int& slot) { slot = -2; }
+ static bool isDeletedValue(int value) { return value == -2; }
+ };
+ typedef HashMap<int, FloatRect, DefaultHash<int>::Hash, RectMapKeyTraits> RectMap;
OwnPtr<RectMap> m_currentRectHistory;
OwnPtr<RectMap> m_nextRectHistory;
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp (120901 => 120902)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp 2012-06-21 04:27:18 UTC (rev 120901)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp 2012-06-21 04:46:05 UTC (rev 120902)
@@ -84,6 +84,7 @@
, m_layerAnimationController(CCLayerAnimationController::create(this))
{
ASSERT(CCProxy::isImplThread());
+ ASSERT(m_layerId >= 0);
}
CCLayerImpl::~CCLayerImpl()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes