CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/10/04 12:01:35
Modified files: . : ChangeLog server : dlist.cpp dlist.h sprite_instance.cpp Log message: * server/dlist.{cpp,h}: remove unused functions, call destroy() on characters whos unload() returned false. * server/sprite_instance.cpp (dtor): remove useless call to DisplayList::clear() CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4522&r2=1.4523 http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.94&r2=1.95 http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.53&r2=1.54 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.365&r2=1.366 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4522 retrieving revision 1.4523 diff -u -b -r1.4522 -r1.4523 --- ChangeLog 4 Oct 2007 11:25:30 -0000 1.4522 +++ ChangeLog 4 Oct 2007 12:01:35 -0000 1.4523 @@ -1,3 +1,10 @@ +2007-10-04 Sandro Santilli <[EMAIL PROTECTED]> + + * server/dlist.{cpp,h}: remove unused functions, call destroy() + on characters whos unload() returned false. + * server/sprite_instance.cpp (dtor): remove useless call to + DisplayList::clear() + 2007-10-04 Tomas Groth Christensen <[EMAIL PROTECTED]> * libbase/BitsReader.h: Added doc. Index: server/dlist.cpp =================================================================== RCS file: /sources/gnash/gnash/server/dlist.cpp,v retrieving revision 1.94 retrieving revision 1.95 diff -u -b -r1.94 -r1.95 --- server/dlist.cpp 21 Sep 2007 08:29:02 -0000 1.94 +++ server/dlist.cpp 4 Oct 2007 12:01:35 -0000 1.95 @@ -229,6 +229,10 @@ // reinsert removed character if needed reinsertRemovedCharacter(oldCh); } + else + { + oldCh->destroy(); + } // extend invalidated bounds ch->extend_invalidated_bounds(old_ranges); @@ -355,6 +359,10 @@ // reinsert removed character if needed reinsertRemovedCharacter(oldch); } + else + { + oldch->destroy(); + } // extend invalidated bounds // WARNING: when a new Button character is added, @@ -472,6 +480,10 @@ // reinsertRemovedCharacter(oldCh); } + else + { + oldCh->destroy(); + } } #ifndef NDEBUG @@ -628,6 +640,10 @@ { toReinsert.push_back(di); } + else + { + di->destroy(); + } continue; } @@ -640,7 +656,7 @@ // Call set_invalidated before changing the DisplayList owner.set_invalidated(); - // TODO: no unload() call needed here ? would help GC ? + // TODO: no unload() or destroy() call needed here ? would help GC ? // (I guess there can't be any as_value pointing at this // if it's not ActionScriptReferenceable after all...) // @@ -664,6 +680,10 @@ { toReinsert.push_back(di); } + else + { + di->destroy(); + } continue; } @@ -685,121 +705,6 @@ testInvariant(); } -void -DisplayList::clear_except(const DisplayList& exclude, bool call_unload) -{ - //log_debug("clear_except(DislpayList, %d) called", call_unload); - //GNASH_REPORT_FUNCTION; - - testInvariant(); - //log_debug("First invariant test worked"); - - - assert(&exclude != this); - const container_type& keepchars = exclude._charsByDepth; - - std::vector<DisplayItem> toReinsert; - - const_iterator keepStart = beginNonRemoved(keepchars); - const_iterator keepEnd = keepchars.end(); - - //int called=0; - for (iterator it = _charsByDepth.begin(), itEnd = _charsByDepth.end(); it != itEnd; ) - { - - testInvariant(); // TODO: expensive - //log_debug("Invariant test in iteration %d worked", called++); - - // make a copy of the pointer here, don't take a reference - DisplayItem di = *it; - - bool is_affected = false; - for (const_iterator kit = keepStart; kit != keepEnd; ++kit) - { - if ( *kit == di ) - { - is_affected = true; - break; - } - } - - if (is_affected == false) - { - it = _charsByDepth.erase(it); - - if ( call_unload ) - { - if ( di->unload() ) - { - toReinsert.push_back(di); - } - } - - continue; - } - it++; - } - - testInvariant(); - //log_debug("Invariant test after cleanup worked"); - - std::for_each(toReinsert.begin(), toReinsert.end(), - boost::bind(&DisplayList::reinsertRemovedCharacter, this, _1)); - - testInvariant(); - //log_debug("Invariant test after reinsertion worked"); -} - -void -DisplayList::clear(const DisplayList& from, bool call_unload) -{ - //GNASH_REPORT_FUNCTION; - - testInvariant(); - - const container_type dropchars = from._charsByDepth; - - std::vector<DisplayItem> toReinsert; - - for (iterator it = _charsByDepth.begin(), itEnd = _charsByDepth.end(); it != itEnd; ) - { - // make a copy - DisplayItem di = *it; - - bool is_affected = false; - for (const_iterator kit = dropchars.begin(), kitEnd = dropchars.end(); kit != kitEnd; ++kit) - { - if ( *kit == di ) - { - is_affected = true; - break; - } - } - - if (is_affected) - { - it = _charsByDepth.erase(it); - - if ( call_unload ) - { - if ( di->unload() ) - { - toReinsert.push_back(di); - } - } - continue; - } - it++; - } - - testInvariant(); - - std::for_each(toReinsert.begin(), toReinsert.end(), - boost::bind(&DisplayList::reinsertRemovedCharacter, this, _1)); - - testInvariant(); -} - bool DisplayList::unload() { @@ -817,12 +722,14 @@ // skip if already unloaded if ( di->isUnloaded() ) { + // TODO: call di->destroy(); ? ++it; continue; } if ( ! di->unload() ) // no event handler queued, we remove { + di->destroy(); it = _charsByDepth.erase(it); } else Index: server/dlist.h =================================================================== RCS file: /sources/gnash/gnash/server/dlist.h,v retrieving revision 1.53 retrieving revision 1.54 diff -u -b -r1.53 -r1.54 --- server/dlist.h 21 Sep 2007 12:12:33 -0000 1.53 +++ server/dlist.h 4 Oct 2007 12:01:35 -0000 1.54 @@ -208,12 +208,6 @@ /// void removeUnloaded(); - /// Clear the display list. - void clear() - { - _charsByDepth.clear(); - } - /// Unload the characters in this DisplayList removing /// all but the ones with on onUnload event defined /// (checked by calling ::unload on them) and keeping @@ -223,35 +217,6 @@ /// bool unload(); - /// \brief - /// Clear all characters in this DisplayList that are also found - /// in the given DisplayList - // - /// @param from - /// A DisplayList containing character instances to clear. - /// Any instance found in in will be removed from this DisplayList. - /// - /// @param call_unload - /// If true, UNLOAD event will be invoked on the characters being - /// removed. False by default. - /// - void clear(const DisplayList& from, bool call_unload=false); - - /// \brief - /// Clear all characters in this DisplayList except the ones - /// contained in the given DisplayList and not unloaded - // - /// @param exclude - /// A DisplayList containing character instances to keep. - /// Any instance not found in in will be removed - /// from this DisplayList. - /// - /// @param call_unload - /// If true, UNLOAD event will be invoked on the characters being - /// removed. False by default. - /// - void clear_except(const DisplayList& exclude, bool call_unload=false); - /// Add all characters in the list, maintaining depth-order // /// @param chars @@ -301,11 +266,6 @@ /// void reset(movie_definition& movieDef, size_t targetFrame, sprite_instance& owner); - /// Just an alias for clear() - void reset() { - clear(); - } - /// \brief /// Display the referenced characters. /// Lower depths are obscured by higher depths. Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.365 retrieving revision 1.366 diff -u -b -r1.365 -r1.366 --- server/sprite_instance.cpp 4 Oct 2007 09:47:36 -0000 1.365 +++ server/sprite_instance.cpp 4 Oct 2007 12:01:35 -0000 1.366 @@ -1743,7 +1743,7 @@ _vm.getRoot().remove_mouse_listener(this); } - m_display_list.clear(); + //m_display_list.clear(); for (LoadVariablesThreads::iterator it=_loadVariableRequests.begin(); it != _loadVariableRequests.end(); ++it) _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit