OLD | NEW |
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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 nullptr, selectors); | 629 nullptr, selectors); |
630 | 630 |
631 if (!selectorList.first()) { | 631 if (!selectorList.first()) { |
632 exceptionState.throwDOMException( | 632 exceptionState.throwDOMException( |
633 SyntaxError, "'" + selectors + "' is not a valid selector."); | 633 SyntaxError, "'" + selectors + "' is not a valid selector."); |
634 return nullptr; | 634 return nullptr; |
635 } | 635 } |
636 | 636 |
637 const unsigned maximumSelectorQueryCacheSize = 256; | 637 const unsigned maximumSelectorQueryCacheSize = 256; |
638 if (m_entries.size() == maximumSelectorQueryCacheSize) | 638 if (m_entries.size() == maximumSelectorQueryCacheSize) |
639 m_entries.remove(m_entries.begin()); | 639 m_entries.erase(m_entries.begin()); |
640 | 640 |
641 return m_entries | 641 return m_entries |
642 .insert(selectors, SelectorQuery::adopt(std::move(selectorList))) | 642 .insert(selectors, SelectorQuery::adopt(std::move(selectorList))) |
643 .storedValue->value.get(); | 643 .storedValue->value.get(); |
644 } | 644 } |
645 | 645 |
646 void SelectorQueryCache::invalidate() { | 646 void SelectorQueryCache::invalidate() { |
647 m_entries.clear(); | 647 m_entries.clear(); |
648 } | 648 } |
649 | 649 |
650 } // namespace blink | 650 } // namespace blink |
OLD | NEW |