Changeset 58220 in webkit


Ignore:
Timestamp:
Apr 24, 2010 10:53:24 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-24 Anton Muhin <antonm@chromium.org>

Reviewed by Darin Adler.

Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue

Former implementation attempted to use AtomicString(HashTableDeletedValue)
however those values cannot be used that way: one cannot construct
QualifiedNameImpl out of such AtomicString as we'll try to lookup this string
in the table, for example.
https://bugs.webkit.org/show_bug.cgi?id=37722

  • wtf/RefPtr.h: expose hash table deleted value

2010-04-24 Anton Muhin <antonm@chromium.org>

Reviewed by Darin Adler.

Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue

Former implementation attempted to use AtomicString(HashTableDeletedValue)
however those values cannot be used that way: one cannot construct
QualifiedNameImpl out of such AtomicString as we'll try to lookup this string
in the table, for example.
https://bugs.webkit.org/show_bug.cgi?id=37722

  • dom/QualifiedName.cpp: (WebCore::QualifiedName::deref): check that hash table deleted values never derefed
  • dom/QualifiedName.h: (WebCore::QualifiedName::QualifiedName): add a constructor to create hash table deleted values (WebCore::QualifiedName::isHashTableDeletedValue): add a check if given instance is hash table deleted value (WTF::):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r58206 r58220  
     12010-04-24  Anton Muhin  <antonm@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue
     6
     7        Former implementation attempted to use AtomicString(HashTableDeletedValue)
     8        however those values cannot be used that way: one cannot construct
     9        QualifiedNameImpl out of such AtomicString as we'll try to lookup this string
     10        in the table, for example.
     11        https://bugs.webkit.org/show_bug.cgi?id=37722
     12
     13        * wtf/RefPtr.h: expose hash table deleted value
     14
    1152010-04-23  Sam Weinig  <sam@webkit.org>
    216
  • trunk/JavaScriptCore/wtf/RefPtr.h

    r54724 r58220  
    8080        void swap(RefPtr&);
    8181
     82        static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
     83
    8284    private:
    83         static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
    84 
    8585        T* m_ptr;
    8686    };
  • trunk/WebCore/ChangeLog

    r58219 r58220  
     12010-04-24  Anton Muhin  <antonm@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Allow to construct HashTraits<WebCore::QualifiedName>::constructDeletedValue
     6
     7        Former implementation attempted to use AtomicString(HashTableDeletedValue)
     8        however those values cannot be used that way: one cannot construct
     9        QualifiedNameImpl out of such AtomicString as we'll try to lookup this string
     10        in the table, for example.
     11        https://bugs.webkit.org/show_bug.cgi?id=37722
     12
     13        * dom/QualifiedName.cpp:
     14        (WebCore::QualifiedName::deref): check that hash table deleted values never derefed
     15        * dom/QualifiedName.h:
     16        (WebCore::QualifiedName::QualifiedName): add a constructor to create hash table deleted values
     17        (WebCore::QualifiedName::isHashTableDeletedValue): add a check if given instance is hash table deleted value
     18        (WTF::):
     19
    1202010-04-24  Julien Chaffraix  <jchaffraix@webkit.org>
    221
  • trunk/WebCore/dom/QualifiedName.cpp

    r57904 r58220  
    7979        return;
    8080#endif
     81    ASSERT(!isHashTableDeletedValue());
    8182
    8283    if (m_impl->hasOneRef())
  • trunk/WebCore/dom/QualifiedName.h

    r52280 r58220  
    5959    QualifiedName(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI);
    6060    QualifiedName(const AtomicString& prefix, const char* localName, const AtomicString& namespaceURI);
     61    QualifiedName(WTF::HashTableDeletedValueType) : m_impl(hashTableDeletedValue()) { }
     62    bool isHashTableDeletedValue() const { return m_impl == hashTableDeletedValue(); }
    6163    ~QualifiedName() { deref(); }
    6264#ifdef QNAME_DEFAULT_CONSTRUCTOR
     
    9395    void ref() const { m_impl->ref(); }
    9496    void deref();
     97
     98    static QualifiedNameImpl* hashTableDeletedValue() { return RefPtr<QualifiedNameImpl>::hashTableDeletedValue(); }
    9599   
    96100    QualifiedNameImpl* m_impl;
     
    168172        static const bool emptyValueIsZero = false;
    169173        static WebCore::QualifiedName emptyValue() { return WebCore::QualifiedName(WebCore::nullAtom, WebCore::nullAtom, WebCore::nullAtom); }
    170         static void constructDeletedValue(WebCore::QualifiedName& slot) { new (&slot) WebCore::QualifiedName(WebCore::nullAtom, WebCore::AtomicString(HashTableDeletedValue), WebCore::nullAtom); }
    171         static bool isDeletedValue(const WebCore::QualifiedName& slot) { return slot.localName().isHashTableDeletedValue(); }
     174        static void constructDeletedValue(WebCore::QualifiedName& slot) { new (&slot) WebCore::QualifiedName(WTF::HashTableDeletedValue); }
     175        static bool isDeletedValue(const WebCore::QualifiedName& slot) { return slot.isHashTableDeletedValue(); }
    172176    };
    173177}
Note: See TracChangeset for help on using the changeset viewer.