Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1276)

Unified Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 152883002: (Concept patch) Simplify WTF::HashTable::add() return value for size and performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/scrolling/ScrollingCoordinator.cpp
diff --git a/Source/core/page/scrolling/ScrollingCoordinator.cpp b/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 0c078331c2d9287e3f5eff978a2183e92a6e74a2..a6369ddefabc667a09e125e1b1f8c6beaff4628f 100644
--- a/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -396,8 +396,9 @@ static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map
const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLayer();
LayerFrameMap::iterator iter = map->find(containingLayer);
if (iter == map->end())
- iter = map->add(containingLayer, Vector<const Frame*>()).iterator;
- iter->value.append(child);
+ map->add(containingLayer, Vector<const Frame*>()).iterator->value.append(child);
+ else
+ iter->value.append(child);
}
}
@@ -431,8 +432,11 @@ static void convertLayerRectsToEnclosingCompositedLayerRecursive(
}
LayerHitTestRects::iterator compIter = compositorRects.find(compositedLayer);
+ Vector<LayoutRect>* compIterValue;
if (compIter == compositorRects.end())
- compIter = compositorRects.add(compositedLayer, Vector<LayoutRect>()).iterator;
+ compIterValue = &compositorRects.add(compositedLayer, Vector<LayoutRect>()).iterator->value;
+ else
+ compIterValue = &compIter->value;
// Transform each rect to the co-ordinate space of it's enclosing composited layer.
for (size_t i = 0; i < layerIter->value.size(); ++i) {
LayoutRect rect = layerIter->value[i];
@@ -445,7 +449,7 @@ static void convertLayerRectsToEnclosingCompositedLayerRecursive(
if (compositedLayer->renderer()->hasOverflowClip())
rect.move(compositedLayer->renderBox()->scrolledContentOffset());
}
- compIter->value.append(rect);
+ compIterValue->append(rect);
}
}

Powered by Google App Engine
This is Rietveld 408576698