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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/V0CustomElementScheduler.cpp

Issue 2671933002: Migrate WTF::HashMap::add() to ::insert() (Closed)
Patch Set: rebase, add TODOs Created 3 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 ElementCallbackQueueMap; 51 ElementCallbackQueueMap;
52 52
53 static ElementCallbackQueueMap& callbackQueues() { 53 static ElementCallbackQueueMap& callbackQueues() {
54 DEFINE_STATIC_LOCAL(ElementCallbackQueueMap, map, 54 DEFINE_STATIC_LOCAL(ElementCallbackQueueMap, map,
55 (new ElementCallbackQueueMap)); 55 (new ElementCallbackQueueMap));
56 return map; 56 return map;
57 } 57 }
58 58
59 static V0CustomElementCallbackQueue& ensureCallbackQueue(Element* element) { 59 static V0CustomElementCallbackQueue& ensureCallbackQueue(Element* element) {
60 ElementCallbackQueueMap::ValueType* it = 60 ElementCallbackQueueMap::ValueType* it =
61 callbackQueues().add(element, nullptr).storedValue; 61 callbackQueues().insert(element, nullptr).storedValue;
62 if (!it->value) 62 if (!it->value)
63 it->value = V0CustomElementCallbackQueue::create(element); 63 it->value = V0CustomElementCallbackQueue::create(element);
64 return *it->value.get(); 64 return *it->value.get();
65 } 65 }
66 66
67 // Finds or creates the callback queue for element. 67 // Finds or creates the callback queue for element.
68 static V0CustomElementCallbackQueue& scheduleCallbackQueue(Element* element) { 68 static V0CustomElementCallbackQueue& scheduleCallbackQueue(Element* element) {
69 V0CustomElementCallbackQueue& callbackQueue = ensureCallbackQueue(element); 69 V0CustomElementCallbackQueue& callbackQueue = ensureCallbackQueue(element);
70 if (callbackQueue.inCreatedCallback()) { 70 if (callbackQueue.inCreatedCallback()) {
71 // Don't move it. Authors use the createdCallback like a 71 // Don't move it. Authors use the createdCallback like a
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if (V0CustomElementMicrotaskDispatcher::instance().elementQueueIsEmpty()) 160 if (V0CustomElementMicrotaskDispatcher::instance().elementQueueIsEmpty())
161 callbackQueues().clear(); 161 callbackQueues().clear();
162 } 162 }
163 163
164 void V0CustomElementScheduler::microtaskDispatcherDidFinish() { 164 void V0CustomElementScheduler::microtaskDispatcherDidFinish() {
165 DCHECK(!V0CustomElementProcessingStack::inCallbackDeliveryScope()); 165 DCHECK(!V0CustomElementProcessingStack::inCallbackDeliveryScope());
166 callbackQueues().clear(); 166 callbackQueues().clear();
167 } 167 }
168 168
169 } // namespace blink 169 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698