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

Unified Diff: Source/core/inspector/AsyncCallStackTracker.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/inspector/AsyncCallStackTracker.cpp
diff --git a/Source/core/inspector/AsyncCallStackTracker.cpp b/Source/core/inspector/AsyncCallStackTracker.cpp
index e93fdc5f85701c61cc24c6d545607df3cbb00ab4..0acd90101d20872a9acfe2f2c623ef539ed03e02 100644
--- a/Source/core/inspector/AsyncCallStackTracker.cpp
+++ b/Source/core/inspector/AsyncCallStackTracker.cpp
@@ -80,13 +80,17 @@ public:
void addEventListenerData(EventTarget* eventTarget, const AtomicString& eventType, const EventListenerAsyncCallChain& item)
{
HashMap<EventTarget*, EventListenerAsyncCallChainVectorHashMap>::iterator it = m_eventTargetCallChains.find(eventTarget);
+ EventListenerAsyncCallChainVectorHashMap* mapPtr;
if (it == m_eventTargetCallChains.end())
- it = m_eventTargetCallChains.set(eventTarget, EventListenerAsyncCallChainVectorHashMap()).iterator;
- EventListenerAsyncCallChainVectorHashMap& map = it->value;
+ mapPtr = &m_eventTargetCallChains.set(eventTarget, EventListenerAsyncCallChainVectorHashMap()).iterator->value;
+ else
+ mapPtr = &it->value;
+ EventListenerAsyncCallChainVectorHashMap& map = *mapPtr;
EventListenerAsyncCallChainVectorHashMap::iterator it2 = map.find(eventType);
if (it2 == map.end())
- it2 = map.set(eventType, EventListenerAsyncCallChainVector()).iterator;
- it2->value.append(item);
+ map.set(eventType, EventListenerAsyncCallChainVector()).iterator->value.append(item);
+ else
+ it2->value.append(item);
}
void removeEventListenerData(EventTarget* eventTarget, const AtomicString& eventType, const RegisteredEventListener& item)

Powered by Google App Engine
This is Rietveld 408576698