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

Side by Side Diff: sky/engine/core/dom/SelectorQuery.cpp

Issue 867903002: Remove UseCounter (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/dom/Element.cpp ('k') | sky/engine/core/editing/Editor.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 return false; 81 return false;
82 } 82 }
83 83
84 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu ment& document, ExceptionState& exceptionState) 84 SelectorQuery* SelectorQueryCache::add(const AtomicString& selectors, const Docu ment& document, ExceptionState& exceptionState)
85 { 85 {
86 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find( selectors); 86 HashMap<AtomicString, OwnPtr<SelectorQuery> >::iterator it = m_entries.find( selectors);
87 if (it != m_entries.end()) 87 if (it != m_entries.end())
88 return it->value.get(); 88 return it->value.get();
89 89
90 BisonCSSParser parser(CSSParserContext(document, 0)); 90 CSSParserContext context(document);
91 BisonCSSParser parser(context);
91 CSSSelectorList selectorList; 92 CSSSelectorList selectorList;
92 parser.parseSelector(selectors, selectorList); 93 parser.parseSelector(selectors, selectorList);
93 94
94 if (!selectorList.first()) { 95 if (!selectorList.first()) {
95 exceptionState.throwDOMException(SyntaxError, "'" + selectors + "' is no t a valid selector."); 96 exceptionState.throwDOMException(SyntaxError, "'" + selectors + "' is no t a valid selector.");
96 return 0; 97 return 0;
97 } 98 }
98 99
99 const unsigned maximumSelectorQueryCacheSize = 256; 100 const unsigned maximumSelectorQueryCacheSize = 256;
100 if (m_entries.size() == maximumSelectorQueryCacheSize) 101 if (m_entries.size() == maximumSelectorQueryCacheSize)
101 m_entries.remove(m_entries.begin()); 102 m_entries.remove(m_entries.begin());
102 103
103 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get(); 104 return m_entries.add(selectors, SelectorQuery::adopt(selectorList)).storedVa lue->value.get();
104 } 105 }
105 106
106 } 107 }
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Element.cpp ('k') | sky/engine/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698