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

Side by Side Diff: third_party/WebKit/Source/core/dom/SelectorQuery.h

Issue 2797083002: Test cases for querySelector fast paths. (Closed)
Patch Set: Working tests. Created 3 years, 8 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // https://dom.spec.whatwg.org/#dom-element-closest 58 // https://dom.spec.whatwg.org/#dom-element-closest
59 Element* closest(Element&) const; 59 Element* closest(Element&) const;
60 60
61 // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall 61 // https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall
62 StaticElementList* queryAll(ContainerNode& rootNode) const; 62 StaticElementList* queryAll(ContainerNode& rootNode) const;
63 63
64 // https://dom.spec.whatwg.org/#dom-parentnode-queryselector 64 // https://dom.spec.whatwg.org/#dom-parentnode-queryselector
65 Element* queryFirst(ContainerNode& rootNode) const; 65 Element* queryFirst(ContainerNode& rootNode) const;
66 66
67 struct QueryStats {
68 unsigned totalCount;
69 unsigned fastId;
70 unsigned fastClass;
71 unsigned fastTagName;
72 unsigned fastScan;
73 unsigned slowScan;
74 unsigned slowTraversingShadowTreeScan;
75 };
76 // Used by unit tests to get information about what paths were taken during
77 // the last query. Always reset between queries. This system is disabled in
78 // non DCHECK builds to avoid the overhead on the query process.
79 static QueryStats lastQueryStats();
80
67 private: 81 private:
68 explicit SelectorQuery(CSSSelectorList); 82 explicit SelectorQuery(CSSSelectorList);
69 83
70 bool canUseFastQuery(const ContainerNode& rootNode) const; 84 bool canUseFastQuery(const ContainerNode& rootNode) const;
71 85
72 template <typename SelectorQueryTrait> 86 template <typename SelectorQueryTrait>
73 void findTraverseRootsAndExecute( 87 void findTraverseRootsAndExecute(
74 ContainerNode& rootNode, 88 ContainerNode& rootNode,
75 typename SelectorQueryTrait::OutputType&) const; 89 typename SelectorQueryTrait::OutputType&) const;
76 template <typename SelectorQueryTrait> 90 template <typename SelectorQueryTrait>
(...skipping 30 matching lines...) Expand all
107 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); 121 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&);
108 void invalidate(); 122 void invalidate();
109 123
110 private: 124 private:
111 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries; 125 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries;
112 }; 126 };
113 127
114 } // namespace blink 128 } // namespace blink
115 129
116 #endif 130 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ContainerNode.h ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698