Ignore:
Timestamp:
Dec 25, 2005, 1:22:35 AM (19 years ago)
Author:
mjs
Message:

Reviewed by Eric and Dave Hyatt.

This is a somewhat cheesy change. Having to use PassRefPtr_Ref creates ambiguities
in assignment and copy construction. And this makes life way easier and removes
the need for pass(). It is not really correct, but we pretty much never need a real
const PassRefPtr, and this takes care of things for PassRefPtr temporaries.

  • kjs/identifier.cpp: (KJS::Identifier::add): No more need for pass()
  • kjs/property_map.cpp: (KJS::PropertyMap::addSparseArrayPropertiesToReferenceList): No more need for pass()
  • kjs/ustring.cpp: (KJS::UString::Rep::create): Use adoptRef (KJS::UString::UString): No more need for pass (KJS::UString::append): No more need for pass (KJS::UString::substr): No more need for pass
  • kxmlcore/PassRefPtr.h: made m_ptr mutable (ugh) (KXMLCore::PassRefPtr::PassRefPtr): Take a const PassRefPtr reference (KXMLCore::PassRefPtr::release): Made this a const method (ugh) (KXMLCore::PassRefPtr::operator=): clean up appropriately (KXMLCore::adoptRef): Added this to use instead of PassRefPtr<T>::adopt, I think it makes the behavior more clear and it is less verbose. (KXMLCore::static_pointer_cast): use adoptRef (KXMLCore::const_pointer_cast): use adoptRef
  • kxmlcore/RefPtr.h: (KXMLCore::RefPtr::RefPtr): take const PassRefPtr& (KXMLCore::PassRefPtr::operator=): take const PassRefPtr&
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r11684 r11763  
    202202
    203203  // steal the single reference this Rep was created with
    204   return PassRefPtr<Rep>::adopt(r);
     204  return adoptRef(r);
    205205}
    206206
     
    232232
    233233  // steal the single reference this Rep was created with
    234   return PassRefPtr<Rep>::adopt(r);
     234  return adoptRef(r);
    235235}
    236236
     
    460460    x.expandCapacity(aOffset + length);
    461461    memcpy(const_cast<UChar *>(a.data() + aSize), b.data(), bSize * sizeof(UChar));
    462     m_rep = Rep::create(pass(a.m_rep), 0, length);
     462    m_rep = Rep::create(a.m_rep, 0, length);
    463463  } else if (-bOffset == b.usedPreCapacity() && 4 * bSize >= aSize) {
    464464    // - b reaches the beginning of its buffer so it qualifies for shared prepend
     
    468468    y.expandPreCapacity(-bOffset + aSize);
    469469    memcpy(const_cast<UChar *>(b.data() - aSize), a.data(), aSize * sizeof(UChar));
    470     m_rep = Rep::create(pass(b.m_rep), -aSize, length);
     470    m_rep = Rep::create(b.m_rep, -aSize, length);
    471471  } else {
    472472    // a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string
     
    686686    expandCapacity(thisOffset + length);
    687687    memcpy(const_cast<UChar *>(data() + thisSize), t.data(), tSize * sizeof(UChar));
    688     m_rep = Rep::create(pass(m_rep), 0, length);
     688    m_rep = Rep::create(m_rep, 0, length);
    689689  } else {
    690690    // this is shared with someone using more capacity, gotta make a whole new string
     
    727727    for (int i = 0; i < tSize; ++i)
    728728      d[thisSize+i] = t[i];
    729     m_rep = Rep::create(pass(m_rep), 0, length);
     729    m_rep = Rep::create(m_rep, 0, length);
    730730  } else {
    731731    // this is shared with someone using more capacity, gotta make a whole new string
     
    767767    UChar *d = const_cast<UChar *>(data());
    768768    d[length] = c;
    769     m_rep = Rep::create(pass(m_rep), 0, length + 1);
     769    m_rep = Rep::create(m_rep, 0, length + 1);
    770770  } else {
    771771    // this is shared with someone using more capacity, gotta make a whole new string
     
    11231123    return *this;
    11241124
    1125   return UString(Rep::create(pass(m_rep), pos, len));
     1125  return UString(Rep::create(m_rep, pos, len));
    11261126}
    11271127
Note: See TracChangeset for help on using the changeset viewer.