Changeset 84176 in webkit


Ignore:
Timestamp:
Apr 18, 2011 1:34:50 PM (13 years ago)
Author:
oliver@apple.com
Message:

2011-04-18 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Remove DeprecatedPtr
https://bugs.webkit.org/show_bug.cgi?id=58718

As simple as it sounds.

  • runtime/JSValue.h:
  • runtime/WriteBarrier.h:

2011-04-18 Oliver Hunt <oliver@apple.com>

Reviewed by Gavin Barraclough.

Remove DeprecatedPtr
https://bugs.webkit.org/show_bug.cgi?id=58718

Replace use of DeprecatedPtr<> with Global<> as ownership rules
aren't obvious, have filed bug #58820 on seeing if this is safe.

  • bridge/qt/qt_class.cpp: (JSC::Bindings::QtClass::fallbackObject):
  • bridge/qt/qt_instance.cpp: (JSC::Bindings::QtInstance::removeCachedMethod): (JSC::Bindings::QtInstance::markAggregate):
  • bridge/qt/qt_instance.h:
Location:
trunk/Source
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r84121 r84176  
     12011-04-18  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Remove DeprecatedPtr
     6        https://bugs.webkit.org/show_bug.cgi?id=58718
     7
     8        As simple as it sounds.
     9
     10        * runtime/JSValue.h:
     11        * runtime/WriteBarrier.h:
     12
    1132011-04-17  Cameron Zwarich  <zwarich@apple.com>
    214
  • trunk/Source/JavaScriptCore/runtime/JSValue.h

    r84081 r84176  
    5252    struct Instruction;
    5353
    54     template <class T> class DeprecatedPtr;
    5554    template <class T> class WriteBarrierBase;
    5655
     
    237236
    238237    private:
    239         template <class T> JSValue(DeprecatedPtr<T>);
    240238        template <class T> JSValue(WriteBarrierBase<T>);
    241239
  • trunk/Source/JavaScriptCore/runtime/WriteBarrier.h

    r84081 r84176  
    4343typedef enum { } Unknown;
    4444typedef JSValue* HandleSlot;
    45 
    46 // FIXME: Remove all uses of this class.
    47 template <class T> class DeprecatedPtr {
    48 public:
    49     DeprecatedPtr() : m_cell(0) { }
    50     DeprecatedPtr(T* cell) : m_cell(reinterpret_cast<JSCell*>(cell)) { }
    51     T* get() const { return reinterpret_cast<T*>(m_cell); }
    52     T* operator*() const { return static_cast<T*>(m_cell); }
    53     T* operator->() const { return static_cast<T*>(m_cell); }
    54    
    55     JSCell** slot() { return &m_cell; }
    56    
    57     typedef T* (DeprecatedPtr::*UnspecifiedBoolType);
    58     operator UnspecifiedBoolType*() const { return m_cell ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
    59 
    60     bool operator!() const { return !m_cell; }
    61 
    62 protected:
    63     JSCell* m_cell;
    64 };
    65 
    66 // FIXME: Remove all uses of this class.
    67 template <> class DeprecatedPtr<Unknown> {
    68 public:
    69     DeprecatedPtr() { }
    70     DeprecatedPtr(JSValue value) : m_value(value) { }
    71     DeprecatedPtr(JSCell* value) : m_value(value) { }
    72     const JSValue& get() const { return m_value; }
    73     const JSValue* operator*() const { return &m_value; }
    74     const JSValue* operator->() const { return &m_value; }
    75    
    76     JSValue* slot() { return &m_value; }
    77    
    78     typedef JSValue (DeprecatedPtr::*UnspecifiedBoolType);
    79     operator UnspecifiedBoolType*() const { return m_value ? reinterpret_cast<UnspecifiedBoolType*>(1) : 0; }
    80     bool operator!() const { return !m_value; }
    81    
    82 private:
    83     JSValue m_value;
    84 };
    85 
    86 template <typename U, typename V> inline bool operator==(const DeprecatedPtr<U>& lhs, const DeprecatedPtr<V>& rhs)
    87 {
    88     return lhs.get() == rhs.get();
    89 }
    9045
    9146template <typename T> struct JSValueChecker {
  • trunk/Source/WebCore/ChangeLog

    r84172 r84176  
     12011-04-18  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Remove DeprecatedPtr
     6        https://bugs.webkit.org/show_bug.cgi?id=58718
     7
     8        Replace use of DeprecatedPtr<> with Global<> as ownership rules
     9        aren't obvious, have filed bug #58820 on seeing if this is safe.
     10
     11        * bridge/qt/qt_class.cpp:
     12        (JSC::Bindings::QtClass::fallbackObject):
     13        * bridge/qt/qt_instance.cpp:
     14        (JSC::Bindings::QtInstance::removeCachedMethod):
     15        (JSC::Bindings::QtInstance::markAggregate):
     16        * bridge/qt/qt_instance.h:
     17
    1182011-04-14  Matthew Delaney  <mdelaney@apple.com>
    219
  • trunk/Source/WebCore/bridge/qt/qt_class.cpp

    r77151 r84176  
    8888        if (m.access() != QMetaMethod::Private) {
    8989            QtRuntimeMetaMethod* val = new (exec) QtRuntimeMetaMethod(exec, identifier, static_cast<QtInstance*>(inst), index, normal, false);
    90             qtinst->m_methods.insert(name, val);
     90            qtinst->m_methods.insert(name, Global<JSObject>(exec->globalData(), val));
    9191            return val;
    9292        }
     
    107107        if (normal == QByteArray::fromRawData(signature, iter)) {
    108108            QtRuntimeMetaMethod* val = new (exec) QtRuntimeMetaMethod(exec, identifier, static_cast<QtInstance*>(inst), index, normal, false);
    109             qtinst->m_methods.insert(name, val);
     109            qtinst->m_methods.insert(name, Global<JSObject>(exec->globalData(), val));
    110110            return val;
    111111        }
  • trunk/Source/WebCore/bridge/qt/qt_instance.cpp

    r84052 r84176  
    152152        m_defaultMethod.clear();
    153153
    154     for (QHash<QByteArray, DeprecatedPtr<JSObject> >::Iterator it = m_methods.begin(),
     154    for (QHash<QByteArray, Global<JSObject> >::Iterator it = m_methods.begin(),
    155155        end = m_methods.end(); it != end; ++it)
    156156        if (it.value().get() == method) {
     
    190190    if (m_defaultMethod)
    191191        markStack.append(&m_defaultMethod);
    192     foreach (DeprecatedPtr<JSObject> val, m_methods.values()) {
    193         if (val)
    194             markStack.append(&val);
    195     }
    196192}
    197193
  • trunk/Source/WebCore/bridge/qt/qt_instance.h

    r79988 r84176  
    8484    QPointer<QObject> m_object;
    8585    QObject* m_hashkey;
    86     mutable QHash<QByteArray, DeprecatedPtr<JSObject> > m_methods;
     86    mutable QHash<QByteArray, Global<JSObject> > m_methods;
    8787    mutable QHash<QString, QtField*> m_fields;
    8888    mutable WriteBarrier<QtRuntimeMetaMethod> m_defaultMethod;
Note: See TracChangeset for help on using the changeset viewer.