Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / css / SelectorFilter.h
index 8a2e852..b475bc0 100644 (file)
 #include "wtf/BloomFilter.h"
 #include "wtf/Vector.h"
 
-namespace WebCore {
+namespace blink {
 
 class CSSSelector;
 
 class SelectorFilter {
+    DISALLOW_ALLOCATION();
 public:
+    class ParentStackFrame {
+        ALLOW_ONLY_INLINE_ALLOCATION();
+    public:
+        ParentStackFrame() : element(nullptr) { }
+        explicit ParentStackFrame(Element& element) : element(&element) { }
+
+        void trace(Visitor*);
+
+        RawPtrWillBeMember<Element> element;
+        Vector<unsigned, 4> identifierHashes;
+    };
+
     void pushParentStackFrame(Element& parent);
     void popParentStackFrame();
 
@@ -52,14 +65,10 @@ public:
     inline bool fastRejectSelector(const unsigned* identifierHashes) const;
     static void collectIdentifierHashes(const CSSSelector&, unsigned* identifierHashes, unsigned maximumIdentifierCount);
 
+    void trace(Visitor*);
+
 private:
-    struct ParentStackFrame {
-        ParentStackFrame() : element(0) { }
-        ParentStackFrame(Element& element) : element(&element) { }
-        Element* element;
-        Vector<unsigned, 4> identifierHashes;
-    };
-    Vector<ParentStackFrame> m_parentStack;
+    WillBeHeapVector<ParentStackFrame> m_parentStack;
 
     // With 100 unique strings in the filter, 2^12 slot table has false positive rate of ~0.2%.
     static const unsigned bloomFilterKeyBits = 12;
@@ -79,4 +88,6 @@ inline bool SelectorFilter::fastRejectSelector(const unsigned* identifierHashes)
 
 }
 
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::SelectorFilter::ParentStackFrame);
+
 #endif