OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
| 6 * reserved. |
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 10 * (http://www.torchmobile.com/) |
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 11 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 12 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
11 * Copyright (C) 2012 Google Inc. All rights reserved. | 13 * Copyright (C) 2012 Google Inc. All rights reserved. |
12 * | 14 * |
13 * This library is free software; you can redistribute it and/or | 15 * This library is free software; you can redistribute it and/or |
14 * modify it under the terms of the GNU Library General Public | 16 * modify it under the terms of the GNU Library General Public |
15 * License as published by the Free Software Foundation; either | 17 * License as published by the Free Software Foundation; either |
16 * version 2 of the License, or (at your option) any later version. | 18 * version 2 of the License, or (at your option) any later version. |
17 * | 19 * |
18 * This library is distributed in the hope that it will be useful, | 20 * This library is distributed in the hope that it will be useful, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 unsigned maximumIdentifierCount); | 75 unsigned maximumIdentifierCount); |
74 | 76 |
75 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
76 | 78 |
77 private: | 79 private: |
78 void pushParentStackFrame(Element& parent); | 80 void pushParentStackFrame(Element& parent); |
79 void popParentStackFrame(); | 81 void popParentStackFrame(); |
80 | 82 |
81 HeapVector<ParentStackFrame> m_parentStack; | 83 HeapVector<ParentStackFrame> m_parentStack; |
82 | 84 |
83 // With 100 unique strings in the filter, 2^12 slot table has false positive r
ate of ~0.2%. | 85 // With 100 unique strings in the filter, 2^12 slot table has false positive |
| 86 // rate of ~0.2%. |
84 using IdentifierFilter = BloomFilter<12>; | 87 using IdentifierFilter = BloomFilter<12>; |
85 std::unique_ptr<IdentifierFilter> m_ancestorIdentifierFilter; | 88 std::unique_ptr<IdentifierFilter> m_ancestorIdentifierFilter; |
86 }; | 89 }; |
87 | 90 |
88 template <unsigned maximumIdentifierCount> | 91 template <unsigned maximumIdentifierCount> |
89 inline bool SelectorFilter::fastRejectSelector( | 92 inline bool SelectorFilter::fastRejectSelector( |
90 const unsigned* identifierHashes) const { | 93 const unsigned* identifierHashes) const { |
91 ASSERT(m_ancestorIdentifierFilter); | 94 ASSERT(m_ancestorIdentifierFilter); |
92 for (unsigned n = 0; n < maximumIdentifierCount && identifierHashes[n]; ++n) { | 95 for (unsigned n = 0; n < maximumIdentifierCount && identifierHashes[n]; ++n) { |
93 if (!m_ancestorIdentifierFilter->mayContain(identifierHashes[n])) | 96 if (!m_ancestorIdentifierFilter->mayContain(identifierHashes[n])) |
94 return true; | 97 return true; |
95 } | 98 } |
96 return false; | 99 return false; |
97 } | 100 } |
98 | 101 |
99 } // namespace blink | 102 } // namespace blink |
100 | 103 |
101 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::SelectorFilter::ParentStackFrame); | 104 WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::SelectorFilter::ParentStackFrame); |
102 | 105 |
103 #endif | 106 #endif |
OLD | NEW |