gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r12233: GC cleanups: drop unneeded r


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r12233: GC cleanups: drop unneeded reachability markers
Date: Wed, 09 Jun 2010 16:39:48 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 12233
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2010-06-09 16:39:48 +0200
message:
  GC cleanups: drop unneeded reachability markers
modified:
  libbase/ref_counted.h
  libbase/smart_ptr.h
  libcore/Bitmap.h
  libcore/Button.cpp
  libcore/MorphShape.h
  libcore/MovieClip.cpp
  libcore/Shape.h
  libcore/StaticText.h
  libcore/TextField.cpp
  libcore/TextField.h
  libcore/parser/SWFMovieDefinition.cpp
  libcore/parser/SWFMovieDefinition.h
=== modified file 'libbase/ref_counted.h'
--- a/libbase/ref_counted.h     2010-01-25 18:52:20 +0000
+++ b/libbase/ref_counted.h     2010-06-09 14:39:48 +0000
@@ -85,16 +85,6 @@
        }
 
        long    get_ref_count() const { return m_ref_count; }
-
-       // These two methods are defined as a temporary hack to 
-       // easy transition to the GC model. Was added when introducing
-       // mixed ref-counted AND gc-collected classes to avoid touching
-       // all ref-counted classes when GNASH_USE_GC is defined.
-       // If this design convinces us we'll be removing these two
-       // methods and all the calls from ref-counted classes.
-       //
-       void setReachable() const { assert(m_ref_count > 0); }
-       bool isReachable() const { return true; }
 };
 
 } // namespace gnash

=== modified file 'libbase/smart_ptr.h'
--- a/libbase/smart_ptr.h       2010-03-11 20:01:11 +0000
+++ b/libbase/smart_ptr.h       2010-06-09 14:39:48 +0000
@@ -26,23 +26,12 @@
 #ifndef SMART_PTR_H
 #define SMART_PTR_H
 
-// Define the following macro to use garbage collecting rather
-// then ref-counting. Currenlty this would make ref_counted
-// derive from GcResource and intrusive_ptr never really messing
-// with the stored pointer (not calling add_ref/drop_ref, which would
-// be not defined for ref_counted.
-// Is is a temporary hack to allow quick switch between GC and REFCOUNT
-// mechanism till the GC is stable
-//
-#define GNASH_USE_GC 1
-
-// TODO: if GNASH_USE_GC is defined have smart_ptr map to intrusive_ptr
-//       else have it map to gc_ptr (yet to be defined)
-
 #include "ref_counted.h"
-
 #include <typeinfo>
 
+// TODO: drop all users of this macro, we _are_ using GC now
+#define GNASH_USE_GC 1
+
 namespace gnash {
     class GcResource;
 }
@@ -73,16 +62,7 @@
 inline void intrusive_ptr_add_ref(const GcResource* ) { }
 inline void intrusive_ptr_release(const GcResource* ) { }
 
-#ifdef GNASH_USE_GC
-class as_object;
-inline void intrusive_ptr_add_ref(const as_object* ) { }
-inline void intrusive_ptr_release(const as_object* ) { }
-#endif
-
-// The below thing won't work. We'll need a real templated class..
-//template <typename C> typedef C* gc_ptr;
-
-} 
+} // namespace boost||gnash 
 
 
 #endif // SMART_PTR_H

=== modified file 'libcore/Bitmap.h'
--- a/libcore/Bitmap.h  2010-06-06 10:17:39 +0000
+++ b/libcore/Bitmap.h  2010-06-09 14:39:48 +0000
@@ -77,8 +77,6 @@
 
     void markReachableObjects() const {
         if (_bitmapData) _bitmapData->setReachable();
-        if (_bitmapInfo) _bitmapInfo->setReachable();
-        if (_def) _def->setReachable();
     }
 
 private:

=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp        2010-06-06 10:17:39 +0000
+++ b/libcore/Button.cpp        2010-06-09 14:39:48 +0000
@@ -835,13 +835,10 @@
     // for Buttons
 }
 
-#ifdef GNASH_USE_GC
 void
 Button::markOwnResources() const
 {
 
-    _def->setReachable();
-
     // Mark state DisplayObjects as reachable
     for (DisplayObjects::const_iterator i = _stateCharacters.begin(),
             e = _stateCharacters.end(); i != e; ++i)
@@ -855,7 +852,6 @@
             std::mem_fun(&DisplayObject::setReachable));
 
 }
-#endif // GNASH_USE_GC
 
 bool
 Button::unload()

=== modified file 'libcore/MorphShape.h'
--- a/libcore/MorphShape.h      2010-03-11 17:03:04 +0000
+++ b/libcore/MorphShape.h      2010-06-09 14:39:48 +0000
@@ -64,16 +64,6 @@
         return _shape;
     }
 
-protected:
-
-#ifdef GNASH_USE_GC
-       /// Mark reachable resources (for the GC)
-       void markReachableResources() const
-       {
-        _def->setReachable();
-       }
-#endif
-
 private:
     
     void morph();

=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp     2010-06-06 10:17:39 +0000
+++ b/libcore/MovieClip.cpp     2010-06-09 14:39:48 +0000
@@ -2122,7 +2122,6 @@
     cleanup_textfield_variables();
 }
 
-#ifdef GNASH_USE_GC
 struct ReachableMarker {
     void operator() (DisplayObject *ch)
     {
@@ -2138,9 +2137,6 @@
 
     _environment.markReachableResources();
 
-    // Mark our own definition
-    if (_def.get()) _def->setReachable();
-
     // Mark textfields in the TextFieldIndex
     if ( _text_variables.get() )
     {
@@ -2158,7 +2154,6 @@
     _swf->setReachable();
 
 }
-#endif // GNASH_USE_GC
 
 void
 MovieClip::destroy()

=== modified file 'libcore/Shape.h'
--- a/libcore/Shape.h   2010-03-11 20:01:11 +0000
+++ b/libcore/Shape.h   2010-06-09 14:39:48 +0000
@@ -66,14 +66,6 @@
     
     virtual bool pointInShape(boost::int32_t x, boost::int32_t y) const;
 
-protected:
-
-       /// Mark reachable resources (for the GC)
-       virtual void markReachableResources() const
-       {
-        if (_def) _def->setReachable();
-       }
-
 private:
        
     const boost::intrusive_ptr<const SWF::DefineShapeTag> _def;

=== modified file 'libcore/StaticText.h'
--- a/libcore/StaticText.h      2010-03-12 15:42:07 +0000
+++ b/libcore/StaticText.h      2010-06-09 14:39:48 +0000
@@ -98,16 +98,6 @@
         return _selectionColor;
     }
 
-protected:
-
-#ifdef GNASH_USE_GC
-       /// Mark reachable resources (for the GC)
-       void markReachableResources() const
-       {
-        _def->setReachable();
-       }
-#endif
-
 private:
 
     const boost::intrusive_ptr<const SWF::DefineTextTag> _def;

=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp     2010-04-03 20:36:18 +0000
+++ b/libcore/TextField.cpp     2010-06-09 14:39:48 +0000
@@ -2640,13 +2640,6 @@
 }
 
 void
-TextField::markOwnResources() const
-{
-    if (_tag) _tag->setReachable();
-    if (_font) _font->setReachable();
-}
-
-void
 TextField::setWidth(double newwidth)
 {
        const SWFRect& bounds = getBounds();

=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h       2010-03-11 17:03:04 +0000
+++ b/libcore/TextField.h       2010-06-09 14:39:48 +0000
@@ -587,17 +587,6 @@
        //
        void setHtmlTextValue(const std::wstring& wstr);
 
-protected:
-
-       /// Mark reachable reosurces (for GC)
-       //
-       /// Reachable resources are:
-       ///  - The font being used (m_font) 
-       ///  - Our definition
-       ///  - Common DisplayObject resources
-       ///
-       void markOwnResources() const;
-
 private:
 
     void init();

=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp     2010-05-20 10:48:28 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp     2010-06-09 14:39:48 +0000
@@ -746,29 +746,6 @@
     return true;
 }
 
-#ifdef GNASH_USE_GC
-void
-SWFMovieDefinition::markReachableResources() const
-{
-    markMappedResources(m_fonts);
-    markMappedResources(_bitmaps);
-    markMappedResources(m_sound_samples);
-
-    // Mutex scope.
-    {
-        boost::mutex::scoped_lock lock(_exportedResourcesMutex);
-        markMappedResources(_exportedResources);
-    }
-
-    std::for_each(m_import_source_movies.begin(), m_import_source_movies.end(),
-           boost::mem_fn(&movie_definition::setReachable));
-
-    boost::mutex::scoped_lock lock(_dictionaryMutex);
-    _dictionary.markReachableResources();
-
-}
-#endif // GNASH_USE_GC
-
 void
 SWFMovieDefinition::importResources(
         boost::intrusive_ptr<movie_definition> source, Imports& imports)

=== modified file 'libcore/parser/SWFMovieDefinition.h'
--- a/libcore/parser/SWFMovieDefinition.h       2010-05-20 10:57:04 +0000
+++ b/libcore/parser/SWFMovieDefinition.h       2010-06-09 14:39:48 +0000
@@ -147,15 +147,6 @@
     friend std::ostream& operator<<(std::ostream& o,
             const CharacterDictionary& cd);
 
-#ifdef GNASH_USE_GC
-    /// Mark all dictionary items to be reachable (for GC)
-    void markReachableResources() const
-    {
-        foreachSecond(_map.begin(), _map.end(), 
-                      &SWF::DefinitionTag::setReachable);
-    }
-#endif 
-
 private:
 
     CharacterContainer _map;
@@ -532,27 +523,6 @@
     /// Movies we import resources from
     std::set< boost::intrusive_ptr<movie_definition> > _importSources;
 
-
-protected:
-
-#ifdef GNASH_USE_GC
-    /// Mark reachable resources of a SWFMovieDefinition
-    //
-    /// Reachable resources are:
-    ///    - fonts (m_fonts)
-    ///    - bitmaps (_bitmaps)
-    ///    - bitmaps (m_bitmap_list) [ what's the difference with bitmap
-    ///   DisplayObjects ?? ]
-    ///    - sound samples (m_sound_samples)
-    ///    - exports (m_exports)
-    ///    - imported movies (m_import_source_movies)
-    ///    - DisplayObject dictionary (_dictionary)
-    ///
-    /// TODO: do we really need all this stuff to be a GcResource ??
-    void markReachableResources() const;
-
-#endif
-
 private:
 
     /// Used to retrieve the sound::sound_handler and other resources


reply via email to

[Prev in Thread] Current Thread [Next in Thread]