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

Side by Side Diff: third_party/WebKit/Source/core/dom/SelectorQuery.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) 2011, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 if (!selectorList.first()) { 632 if (!selectorList.first()) {
633 exceptionState.throwDOMException( 633 exceptionState.throwDOMException(
634 SyntaxError, "'" + selectors + "' is not a valid selector."); 634 SyntaxError, "'" + selectors + "' is not a valid selector.");
635 return nullptr; 635 return nullptr;
636 } 636 }
637 637
638 const unsigned maximumSelectorQueryCacheSize = 256; 638 const unsigned maximumSelectorQueryCacheSize = 256;
639 if (m_entries.size() == maximumSelectorQueryCacheSize) 639 if (m_entries.size() == maximumSelectorQueryCacheSize)
640 m_entries.remove(m_entries.begin()); 640 m_entries.remove(m_entries.begin());
641 641
642 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList))) 642 return m_entries
643 .insert(selectors, SelectorQuery::adopt(std::move(selectorList)))
643 .storedValue->value.get(); 644 .storedValue->value.get();
644 } 645 }
645 646
646 void SelectorQueryCache::invalidate() { 647 void SelectorQueryCache::invalidate() {
647 m_entries.clear(); 648 m_entries.clear();
648 } 649 }
649 650
650 } // namespace blink 651 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698