Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |