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

Side by Side Diff: Source/core/dom/custom/CustomElementScheduler.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, 10 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 CustomElementScheduler& CustomElementScheduler::instance() 101 CustomElementScheduler& CustomElementScheduler::instance()
102 { 102 {
103 DEFINE_STATIC_LOCAL(CustomElementScheduler, instance, ()); 103 DEFINE_STATIC_LOCAL(CustomElementScheduler, instance, ());
104 return instance; 104 return instance;
105 } 105 }
106 106
107 CustomElementCallbackQueue* CustomElementScheduler::ensureCallbackQueue(PassRefP tr<Element> element) 107 CustomElementCallbackQueue* CustomElementScheduler::ensureCallbackQueue(PassRefP tr<Element> element)
108 { 108 {
109 Element* key = element.get(); 109 Element* key = element.get();
110 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key); 110 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
Erik Corry 2014/02/04 14:27:15 Also here with the find that insists on returning
111 if (it == m_elementCallbackQueueMap.end()) 111 if (it == m_elementCallbackQueueMap.end())
112 it = m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::crea te(element)).iterator; 112 return m_elementCallbackQueueMap.add(key, CustomElementCallbackQueue::cr eate(element)).iterator->value.get();
113 return it->value.get(); 113 return it->value.get();
114 } 114 }
115 115
116 void CustomElementScheduler::clearElementCallbackQueueMap() 116 void CustomElementScheduler::clearElementCallbackQueueMap()
117 { 117 {
118 ElementCallbackQueueMap emptyMap; 118 ElementCallbackQueueMap emptyMap;
119 instance().m_elementCallbackQueueMap.swap(emptyMap); 119 instance().m_elementCallbackQueueMap.swap(emptyMap);
120 } 120 }
121 121
122 // Finds or creates the callback queue for element. 122 // Finds or creates the callback queue for element.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return false; 160 return false;
161 161
162 CustomElementMicrotaskStep::Result result = m_baseMicrotaskQueue.dispatch(); 162 CustomElementMicrotaskStep::Result result = m_baseMicrotaskQueue.dispatch();
163 if (m_baseMicrotaskQueue.isEmpty()) 163 if (m_baseMicrotaskQueue.isEmpty())
164 clearElementCallbackQueueMap(); 164 clearElementCallbackQueueMap();
165 165
166 return result & CustomElementMicrotaskStep::DidWork; 166 return result & CustomElementMicrotaskStep::DidWork;
167 } 167 }
168 168
169 } // namespace WebCore 169 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698