gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. ddf7b5a6a645ed66aa77


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. ddf7b5a6a645ed66aa77ccae96582281303591a8
Date: Sun, 17 Oct 2010 16:21:10 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  ddf7b5a6a645ed66aa77ccae96582281303591a8 (commit)
       via  2f08ce39e26fb7e9580aefcf4fcafe38a782b60f (commit)
       via  2c6f9a412abefd5c58b560cf3f4fe946cc38061f (commit)
       via  64d39e29d21a75f6b0e7561b7b2dd981308d268b (commit)
      from  e7307b071088134806e1c74a55f7989575a42a47 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ddf7b5a6a645ed66aa77ccae96582281303591a8


commit ddf7b5a6a645ed66aa77ccae96582281303591a8
Merge: 2f08ce3 e7307b0
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Oct 17 18:21:00 2010 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=2f08ce39e26fb7e9580aefcf4fcafe38a782b60f


commit 2f08ce39e26fb7e9580aefcf4fcafe38a782b60f
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Oct 17 18:18:37 2010 +0200

    Document.

diff --git a/libcore/as_object.h b/libcore/as_object.h
index 9631447..0a49e31 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -578,15 +578,14 @@ public:
     /// change the object.
     //
     /// @param visitor  The visitor function. Will be invoked for each property
-    ///                 of this object with a string_table::key
-    ///                 reference as first argument and a const as_value
-    ///                 reference as second argument.
+    ///                 of this object with an ObjectURI as first argument and
+    ///                 a const as_value as second argument.
     template<typename T>
     void visitProperties(PropertyVisitor& visitor) const {
         _members.visitValues<T>(visitor);
     }
 
-    /// Visit all property visible keys.
+    /// Visit all visible property identifiers.
     //
     /// NB: this function does not access the property values, so callers
     /// can be certain no values will be changed.
@@ -595,6 +594,9 @@ public:
     /// implementation will keep track of visited object to avoid infinite
     /// loops in the prototype chain.  NOTE: the MM player just chokes in
     /// this case.
+    //
+    /// @param visitor  The visitor function. Will be invoked for each property
+    ///                 of this object with an ObjectURI as the only argument.
     void visitKeys(KeyVisitor& visitor) const;
 
     /// Add a getter/setter property if no member already has that name.
diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index 7289d5f..6f5156c 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -1005,6 +1005,7 @@ enumerateAttributes(const XMLNode_as& node,
         for (as_object::SortedPropertyList::const_iterator i=attrs.begin(), 
                 e=attrs.end(); i!=e; ++i)
         {
+            // TODO: second argument should take version.
             pairs.push_back(std::make_pair(i->first, i->second.to_string()));
         }
     }

http://git.savannah.gnu.org/cgit//commit/?id=2c6f9a412abefd5c58b560cf3f4fe946cc38061f


commit 2c6f9a412abefd5c58b560cf3f4fe946cc38061f
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Oct 17 17:39:31 2010 +0200

    Rename AbstractPropertyVisitor to match KeyVisitor.

diff --git a/libcore/AMFConverter.cpp b/libcore/AMFConverter.cpp
index e892071..9aaa727 100644
--- a/libcore/AMFConverter.cpp
+++ b/libcore/AMFConverter.cpp
@@ -47,7 +47,7 @@ namespace amf {
 namespace {
 
 /// Class used to serialize properties of an object to a buffer
-class ObjectSerializer : public AbstractPropertyVisitor
+class ObjectSerializer : public PropertyVisitor
 {
 
 public:
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 6d0a6e8..72c8546 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -48,12 +48,12 @@ namespace gnash {
 namespace gnash {
 
 /// An abstract property visitor
-class AbstractPropertyVisitor {
+class PropertyVisitor {
 public:
 
     /// This function should return false if no further visits are needed.
     virtual bool accept(const ObjectURI& uri, const as_value& val) = 0;
-    virtual ~AbstractPropertyVisitor() {}
+    virtual ~PropertyVisitor() {}
 };
 
 /// An abstract key visitor
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index 22dfe6d..dd588da 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -233,7 +233,7 @@ as_super::get_super(const ObjectURI& fname)
 }
 
 /// A PropertyList visitor copying properties to an object
-class PropsCopier : public AbstractPropertyVisitor
+class PropsCopier : public PropertyVisitor
 {
 
 public:
@@ -257,7 +257,7 @@ private:
     as_object& _tgt;
 };
 
-class PropertyEnumerator : public AbstractPropertyVisitor
+class PropertyEnumerator : public PropertyVisitor
 {
 public:
     PropertyEnumerator(const as_object& this_ptr,
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 1c4d668..9631447 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -582,7 +582,7 @@ public:
     ///                 reference as first argument and a const as_value
     ///                 reference as second argument.
     template<typename T>
-    void visitProperties(AbstractPropertyVisitor& visitor) const {
+    void visitProperties(PropertyVisitor& visitor) const {
         _members.visitValues<T>(visitor);
     }
 
diff --git a/libcore/asobj/Array_as.h b/libcore/asobj/Array_as.h
index 763a4b3..1f1e9be 100644
--- a/libcore/asobj/Array_as.h
+++ b/libcore/asobj/Array_as.h
@@ -51,7 +51,7 @@ string_table::key arrayKey(string_table& st, size_t i);
 //
 /// Strict arrays have no non-hidden non-numeric properties. Only real arrays
 /// are strict arrays; any users of this functor should check that first.
-class IsStrictArray : public AbstractPropertyVisitor
+class IsStrictArray : public PropertyVisitor
 {
 public:
     IsStrictArray(string_table& st) : _strict(true), _st(st) {}
diff --git a/libcore/asobj/SharedObject_as.cpp 
b/libcore/asobj/SharedObject_as.cpp
index 2521c9e..db87da1 100644
--- a/libcore/asobj/SharedObject_as.cpp
+++ b/libcore/asobj/SharedObject_as.cpp
@@ -105,7 +105,7 @@ namespace {
 namespace { 
 
 /// Class used to serialize properties of an object to a buffer in SOL format
-class SOLPropsBufSerializer : public AbstractPropertyVisitor
+class SOLPropsBufSerializer : public PropertyVisitor
 {
 
 public:
diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index b08a37c..2e6adac 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -90,7 +90,7 @@ void attachExternalInterfaceStaticInterface(as_object& o);
 namespace {
 
 /// Class used to serialize properties of an object to a buffer
-class PropsSerializer : public AbstractPropertyVisitor
+class PropsSerializer : public PropertyVisitor
 {
 
 public:

http://git.savannah.gnu.org/cgit//commit/?id=64d39e29d21a75f6b0e7561b7b2dd981308d268b


commit 64d39e29d21a75f6b0e7561b7b2dd981308d268b
Author: Benjamin Wolsey <address@hidden>
Date:   Sun Oct 17 17:37:44 2010 +0200

    Resimplify as_object interface using a visitor.

diff --git a/libcore/DisplayObject.h b/libcore/DisplayObject.h
index 1ee0a9c..68d9df1 100644
--- a/libcore/DisplayObject.h
+++ b/libcore/DisplayObject.h
@@ -63,6 +63,7 @@ namespace gnash {
     class as_value;
     class as_environment;
     class DisplayObject;
+    class KeyVisitor;
     namespace SWF {
         class TextRecord;
     }
@@ -241,13 +242,11 @@ public:
 
     /// Enumerate any non-proper properties
     //
-    /// This function is called by enumerateProperties(as_environment&) 
-    /// to allow for enumeration of properties that are derived from the
-    /// DisplayObject type, e.g. DisplayList members.
+    /// This function allows enumeration of properties that are
+    /// derived from the DisplayObject type, e.g. DisplayList members.
     ///
     /// The default implementation adds nothing
-    ///
-    virtual void enumerateNonProperties(std::vector<ObjectURI>&) const {}
+    virtual void visitNonProperties(KeyVisitor&) const {}
 
     /// \brief
     /// Return the parent of this DisplayObject, or NULL if
diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index a9126a2..49ff8e2 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -49,15 +49,20 @@
 
 namespace gnash {
 
-#if 0
-class ExternalExecutor: public movie_root::AbstractExternalCallback {
+namespace {
+
+class Enumerator : public KeyVisitor
+{
 public:
-       void notify()
-       {
-           log_debug(_("external_callback()"));
-       }
+    Enumerator(std::vector<ObjectURI>& uris) : _uris(uris) {}
+    void operator()(const ObjectURI& u) {
+        _uris.push_back(u);
+    }
+private:
+    std::vector<ObjectURI>& _uris;
 };
-#endif
+
+}
 
 /// Convert an AS object to an XML string.
 std::string
@@ -79,9 +84,10 @@ ExternalInterface::_objectToXML(as_object *obj)
         string_table& st = vm.getStringTable();
         typedef std::vector<ObjectURI> URIs;
         URIs uris;
-        obj->enumeratePropertyKeys(uris);
-        for (URIs::const_reverse_iterator i=uris.rbegin(), e=uris.rend();
-                i!=e; ++i) {
+        Enumerator en(uris);
+        obj->visitKeys(en);
+        for (URIs::const_reverse_iterator i = uris.rbegin(), e = uris.rend();
+                i != e; ++i) {
             as_value val = getMember(*obj, *i); 
             const std::string& id = i->toString(st);
             ss << "<property id=\"" << id << "\">";
diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 3084231..27c5019 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -339,7 +339,7 @@ class BoundsFinder
 public:
     explicit BoundsFinder(SWFRect& b) : _bounds(b) {}
 
-    void operator() (DisplayObject* ch) {
+    void operator()(DisplayObject* ch) {
         // don't include bounds of unloaded DisplayObjects
         if (ch->unloaded()) return;
         SWFRect chb = ch->getBounds();
@@ -351,6 +351,146 @@ private:
     SWFRect& _bounds;
 };
 
+struct ReachableMarker
+{
+    void operator()(DisplayObject *ch) const {
+        ch->setReachable();
+    }
+};
+
+/// Find the first visible DisplayObject whose shape contain the point
+/// and is not the DisplayObject being dragged or any of its childs
+//
+/// Point coordinates in world TWIPS
+///
+class DropTargetFinder {
+
+    /// Highest depth hidden by a mask
+    //
+    /// This will be -1 initially, and set
+    /// the the depth of a mask when the mask
+    /// doesn't contain the query point, while
+    /// scanning a DisplayList bottom-up
+    ///
+    int _highestHiddenDepth;
+
+    boost::int32_t _x;
+    boost::int32_t _y;
+    DisplayObject* _dragging;
+    mutable const DisplayObject* _dropch;
+
+    typedef std::vector<const DisplayObject*> Candidates;
+    Candidates _candidates;
+
+    mutable bool _checked;
+
+public:
+
+    DropTargetFinder(boost::int32_t x, boost::int32_t y, DisplayObject* 
dragging)
+        :
+        _highestHiddenDepth(std::numeric_limits<int>::min()),
+        _x(x),
+        _y(y),
+        _dragging(dragging),
+        _dropch(0),
+        _candidates(),
+        _checked(false)
+    {}
+
+    void operator() (const DisplayObject* ch)
+    {
+        assert(!_checked);
+        if ( ch->get_depth() <= _highestHiddenDepth )
+        {
+            if ( ch->isMaskLayer() )
+            {
+                log_debug(_("CHECKME: nested mask in DropTargetFinder. "
+                        "This mask is %s at depth %d outer mask masked "
+                        "up to depth %d."),
+                        ch->getTarget(), ch->get_depth(), _highestHiddenDepth);
+                // Hiding mask still in effect...
+            }
+            return;
+        }
+
+        if ( ch->isMaskLayer() )
+        {
+            if ( ! ch->visible() )
+            {
+                log_debug(_("FIXME: invisible mask in MouseEntityFinder."));
+            }
+            if ( ! ch->pointInShape(_x, _y) )
+            {
+#ifdef DEBUG_MOUSE_ENTITY_FINDING
+                log_debug(_("Character %s at depth %d is a mask not hitting "
+                        "the query point %g,%g and masking up to depth %d"),
+                    ch->getTarget(), ch->get_depth(), _x, _y,
+                    ch->get_clip_depth());
+#endif 
+                _highestHiddenDepth = ch->get_clip_depth();
+            }
+            else
+            {
+#ifdef DEBUG_MOUSE_ENTITY_FINDING
+                log_debug(_("Character %s at depth %d is a mask "
+                            "hitting the query point %g,%g"),
+                            ch->getTarget(), ch->get_depth(), _x, _y);
+#endif
+            }
+
+            return;
+        }
+
+        _candidates.push_back(ch);
+
+    }
+
+    void checkCandidates() const
+    {
+        if ( _checked ) return;
+        for (Candidates::const_reverse_iterator i=_candidates.rbegin(),
+                        e=_candidates.rend(); i!=e; ++i)
+        {
+            const DisplayObject* ch = *i;
+            const DisplayObject* dropChar = ch->findDropTarget(_x, _y, 
_dragging);
+            if ( dropChar )
+            {
+                _dropch = dropChar;
+                break;
+            }
+        }
+        _checked = true;
+    }
+
+    const DisplayObject* getDropChar() const
+    {
+        checkCandidates();
+        return _dropch;
+    }
+};
+
+class DisplayListVisitor
+{
+public:
+    DisplayListVisitor(KeyVisitor& v) : _v(v) {}
+
+    void operator()(DisplayObject* ch) const {
+         if (!isReferenceable(*ch)) return;
+         // Don't enumerate unloaded DisplayObjects
+         if (ch->unloaded()) return;
+          
+         const ObjectURI& name = ch->get_name();
+         // Don't enumerate unnamed DisplayObjects
+         if (name.empty()) return;
+          
+         // Referenceable DisplayObject always have an object.
+         assert(getObject(ch));
+         _v(name);
+    }
+private:
+    KeyVisitor& _v;
+};
+
 } // anonymous namespace
 
 
@@ -1401,117 +1541,6 @@ MovieClip::topmostMouseEntity(boost::int32_t x, 
boost::int32_t y)
     return ch; 
 }
 
-/// Find the first visible DisplayObject whose shape contain the point
-/// and is not the DisplayObject being dragged or any of its childs
-//
-/// Point coordinates in world TWIPS
-///
-class DropTargetFinder {
-
-    /// Highest depth hidden by a mask
-    //
-    /// This will be -1 initially, and set
-    /// the the depth of a mask when the mask
-    /// doesn't contain the query point, while
-    /// scanning a DisplayList bottom-up
-    ///
-    int _highestHiddenDepth;
-
-    boost::int32_t _x;
-    boost::int32_t _y;
-    DisplayObject* _dragging;
-    mutable const DisplayObject* _dropch;
-
-    typedef std::vector<const DisplayObject*> Candidates;
-    Candidates _candidates;
-
-    mutable bool _checked;
-
-public:
-
-    DropTargetFinder(boost::int32_t x, boost::int32_t y, DisplayObject* 
dragging)
-        :
-        _highestHiddenDepth(std::numeric_limits<int>::min()),
-        _x(x),
-        _y(y),
-        _dragging(dragging),
-        _dropch(0),
-        _candidates(),
-        _checked(false)
-    {}
-
-    void operator() (const DisplayObject* ch)
-    {
-        assert(!_checked);
-        if ( ch->get_depth() <= _highestHiddenDepth )
-        {
-            if ( ch->isMaskLayer() )
-            {
-                log_debug(_("CHECKME: nested mask in DropTargetFinder. "
-                        "This mask is %s at depth %d outer mask masked "
-                        "up to depth %d."),
-                        ch->getTarget(), ch->get_depth(), _highestHiddenDepth);
-                // Hiding mask still in effect...
-            }
-            return;
-        }
-
-        if ( ch->isMaskLayer() )
-        {
-            if ( ! ch->visible() )
-            {
-                log_debug(_("FIXME: invisible mask in MouseEntityFinder."));
-            }
-            if ( ! ch->pointInShape(_x, _y) )
-            {
-#ifdef DEBUG_MOUSE_ENTITY_FINDING
-                log_debug(_("Character %s at depth %d is a mask not hitting "
-                        "the query point %g,%g and masking up to depth %d"),
-                    ch->getTarget(), ch->get_depth(), _x, _y,
-                    ch->get_clip_depth());
-#endif 
-                _highestHiddenDepth = ch->get_clip_depth();
-            }
-            else
-            {
-#ifdef DEBUG_MOUSE_ENTITY_FINDING
-                log_debug(_("Character %s at depth %d is a mask "
-                            "hitting the query point %g,%g"),
-                            ch->getTarget(), ch->get_depth(), _x, _y);
-#endif
-            }
-
-            return;
-        }
-
-        _candidates.push_back(ch);
-
-    }
-
-    void checkCandidates() const
-    {
-        if ( _checked ) return;
-        for (Candidates::const_reverse_iterator i=_candidates.rbegin(),
-                        e=_candidates.rend(); i!=e; ++i)
-        {
-            const DisplayObject* ch = *i;
-            const DisplayObject* dropChar = ch->findDropTarget(_x, _y, 
_dragging);
-            if ( dropChar )
-            {
-                _dropch = dropChar;
-                break;
-            }
-        }
-        _checked = true;
-    }
-
-    const DisplayObject* getDropChar() const
-    {
-        checkCandidates();
-        return _dropch;
-    }
-};
-
 const DisplayObject*
 MovieClip::findDropTarget(boost::int32_t x, boost::int32_t y,
         DisplayObject* dragging) const
@@ -2036,56 +2065,21 @@ MovieClip::isEnabled() const
     return toBool(enabled, getVM(*obj));
 }
 
-class EnumerateVisitor {
-
-    std::vector<ObjectURI>& _dst;
-
-public:
-    explicit EnumerateVisitor(std::vector<ObjectURI>& dst)
-        :
-        _dst(dst)
-    {}
-
-    void operator() (DisplayObject* ch) {
-
-        if (!isReferenceable(*ch)) return;
-
-        // Don't enumerate unloaded DisplayObjects
-        if (ch->unloaded()) return;
-        
-        const ObjectURI& name = ch->get_name();
-        // Don't enumerate unnamed DisplayObjects
-        if (name.empty()) return;
-        
-        // Referenceable DisplayObject always have an object.
-        assert(getObject(ch));
-        _dst.push_back(name);
-    }
-};
 
 void
-MovieClip::enumerateNonProperties(std::vector<ObjectURI>& uris) const
+MovieClip::visitNonProperties(KeyVisitor& v) const
 {
-    EnumerateVisitor visitor(uris);
-    _displayList.visitAll(visitor);
+    DisplayListVisitor dv(v);
+    _displayList.visitAll(dv);
 }
 
 void
 MovieClip::cleanupDisplayList()
 {
-    //log_debug("%s.cleanDisplayList() called, current dlist is %p", 
-    //getTarget(), (void*)&_displayList);
     _displayList.removeUnloaded();
-
     cleanup_textfield_variables();
 }
 
-struct ReachableMarker {
-    void operator() (DisplayObject *ch)
-    {
-        ch->setReachable();
-    }
-};
 void
 MovieClip::markOwnResources() const
 {
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 390f17e..9a07bff 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -573,8 +573,7 @@ public:
     /// Enumerate child DisplayObjects
     //
     /// See DisplayObject::enumerateNonProperties for more info.
-    ///
-    void enumerateNonProperties(std::vector<ObjectURI>&) const;
+    virtual void visitNonProperties(KeyVisitor& v) const;
 
     /// Delete DisplayObjects removed from the stage
     /// from the display lists
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index 5f60283..cb55cf6 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -189,32 +189,9 @@ PropertyList::dump(std::map<std::string, as_value>& to)
 }
 
 void
-PropertyList::enumerateKeys(as_environment& env, PropertyTracker& donelist)
+PropertyList::visitKeys(KeyVisitor& visitor, PropertyTracker& donelist)
     const
 {
-       string_table& st = getStringTable(_owner);
-
-    // We should enumerate in order of creation, not lexicographically.
-       for (const_iterator i = _props.begin(),
-            ie = _props.end(); i != ie; ++i) {
-
-               if (i->getFlags().get_dont_enum()) continue;
-
-        const ObjectURI& uri = i->uri();
-
-               if (donelist.insert(uri).second) {
-            const std::string& qname = st.value(getName(uri));
-                       env.push(qname);
-               }
-       }
-}
-
-void
-PropertyList::enumerateKeys(std::vector<ObjectURI>& uris, PropertyTracker& 
donelist)
-    const
-{
-       string_table& st = getStringTable(_owner);
-
     // We should enumerate in order of creation, not lexicographically.
        for (const_iterator i = _props.begin(),
             ie = _props.end(); i != ie; ++i) {
@@ -224,7 +201,7 @@ PropertyList::enumerateKeys(std::vector<ObjectURI>& uris, 
PropertyTracker& donel
         const ObjectURI& uri = i->uri();
 
                if (donelist.insert(uri).second) {
-                       uris.push_back(uri);
+                       visitor(uri);
                }
        }
 }
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 2bf97a7..6d0a6e8 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -47,6 +47,25 @@ namespace gnash {
 
 namespace gnash {
 
+/// An abstract property visitor
+class AbstractPropertyVisitor {
+public:
+
+    /// This function should return false if no further visits are needed.
+    virtual bool accept(const ObjectURI& uri, const as_value& val) = 0;
+    virtual ~AbstractPropertyVisitor() {}
+};
+
+/// An abstract key visitor
+class KeyVisitor {
+public:
+
+    /// This function should return false if no further visits are needed.
+    virtual void operator()(const ObjectURI& uri) = 0;
+    virtual ~KeyVisitor() {}
+};
+
+
 /// Set of properties associated with an ActionScript object.
 //
 /// The PropertyList container is the sole owner of the Property
@@ -154,8 +173,7 @@ public:
     ///
     /// @param donelist     Don't enumerate properties in donelist.
     ///                     Enumerated properties are added to donelist.
-    void enumerateKeys(as_environment& env, PropertyTracker& donelist) const;
-    void enumerateKeys(std::vector<ObjectURI>& uris, PropertyTracker& 
donelist) const;
+    void visitKeys(KeyVisitor& v, PropertyTracker& donelist) const;
 
     /// Set the value of a property, creating a new one if it doesn't exist.
     //
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index 89445c9..22dfe6d 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -916,25 +916,11 @@ as_object::copyProperties(const as_object& o)
 }
 
 void
-as_object::enumeratePropertyKeys(as_environment& env) const
-{
-    typedef std::vector<ObjectURI> URIs;
-    URIs uris;
-    enumeratePropertyKeys(uris);
-    string_table& st = getVM(*this).getStringTable();
-    for (URIs::const_iterator i=uris.begin(), e=uris.end();
-            i!=e; ++i)
-    {
-        env.push(i->toString(st));
-    }
-}
-
-void
-as_object::enumeratePropertyKeys(std::vector<ObjectURI>& uris) const
+as_object::visitKeys(KeyVisitor& visitor) const
 {
     // Hack to handle MovieClips.
     if (displayObject()) {
-        displayObject()->enumerateNonProperties(uris);
+        displayObject()->visitNonProperties(visitor);
     }
 
     // this set will keep track of visited objects,
@@ -945,7 +931,7 @@ as_object::enumeratePropertyKeys(std::vector<ObjectURI>& 
uris) const
        
     const as_object* current(this);
     while (current && visited.insert(current).second) {
-        current->_members.enumerateKeys(uris, doneList);
+        current->_members.visitKeys(visitor, doneList);
         current = current->get_prototype();
     }
 }
diff --git a/libcore/as_object.h b/libcore/as_object.h
index d48c544..1c4d668 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -57,15 +57,6 @@ namespace gnash {
 namespace gnash {
 
 
-/// An abstract property visitor
-class AbstractPropertyVisitor {
-public:
-
-    /// This function should return false if no further visits are needed.
-    virtual bool accept(const ObjectURI& uri, const as_value& val) = 0;
-    virtual ~AbstractPropertyVisitor() {}
-};
-
 /// A trigger that can be associated with a property name
 class Trigger
 {
@@ -425,22 +416,6 @@ public:
     void init_readonly_property(const std::string& key,
             as_c_function_ptr getter, int flags = DefaultFlags);
 
-    /// Enumerate all non-hidden property keys to the given as_environment.
-    //
-    /// NB: this function does not access the property values, so callers
-    /// can be certain no values will be changed.
-    //
-    /// The enumeration recurses through the prototype chain. This
-    /// implementation will keep track of visited object to avoid infinite
-    /// loops in the prototype chain.  NOTE: the MM player just chokes in
-    /// this case.
-    ///
-    /// @deprecate use the version taking vector<ObjectURI>
-    ///
-    void enumeratePropertyKeys(as_environment& env) const;
-
-    void enumeratePropertyKeys(std::vector<ObjectURI>& uris) const;
-
     /// Add a watch trigger, overriding any other defined for same name.
     //
     /// @param uri      property identifier
@@ -611,6 +586,17 @@ public:
         _members.visitValues<T>(visitor);
     }
 
+    /// Visit all property visible keys.
+    //
+    /// NB: this function does not access the property values, so callers
+    /// can be certain no values will be changed.
+    //
+    /// The enumeration recurses through the prototype chain. This
+    /// implementation will keep track of visited object to avoid infinite
+    /// loops in the prototype chain.  NOTE: the MM player just chokes in
+    /// this case.
+    void visitKeys(KeyVisitor& visitor) const;
+
     /// Add a getter/setter property if no member already has that name.
     //
     /// @param key      Property identifier.
diff --git a/libcore/asobj/LoadVars_as.cpp b/libcore/asobj/LoadVars_as.cpp
index 1bd5029..8184616 100644
--- a/libcore/asobj/LoadVars_as.cpp
+++ b/libcore/asobj/LoadVars_as.cpp
@@ -132,7 +132,7 @@ loadvars_tostring(const fn_call& fn)
     as_object* global = &getGlobal(*ptr);
     std::ostringstream o;
     
-    int ver = getSWFVersion(*global);
+    const int ver = getSWFVersion(*global);
 
     // LoadVars.toString() calls _global.escape().
        for (VarMap::const_iterator it=vars.begin(), itEnd=vars.end();
@@ -141,8 +141,8 @@ loadvars_tostring(const fn_call& fn)
         if (it != vars.begin()) o << "&";
         const std::string& var = 
             callMethod(global, NSV::PROP_ESCAPE, it->first).to_string();
-        const std::string& val = 
-            callMethod(global, NSV::PROP_ESCAPE, 
it->second.to_string(ver)).to_string();
+        const std::string& val = callMethod(global, NSV::PROP_ESCAPE,
+            it->second.to_string(ver)).to_string();
         o << var << "=" << val;
        }
     return as_value(o.str()); 
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index b582922..b7bf656 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -226,6 +226,21 @@ namespace {
     void ActionUnsupported(ActionExec& thread);
 }
 
+namespace {
+
+class Enumerator : public KeyVisitor
+{
+public:
+    explicit Enumerator(as_environment& env) : _env(env) {}
+    virtual void operator()(const ObjectURI& uri) {
+        _env.push(uri.toString(getStringTable(_env)));
+    }
+private:
+    as_environment& _env;
+};
+
+}
+
 namespace SWF { 
 
 ActionHandler::ActionHandler()
@@ -2574,7 +2589,8 @@ static void
 enumerateObject(as_environment& env, const as_object& obj)
 {
     assert(env.top(0).is_undefined());
-    obj.enumeratePropertyKeys(env);
+    Enumerator en(env);
+    obj.visitKeys(en);
 }
 
 void

-----------------------------------------------------------------------

Summary of changes:
 libcore/AMFConverter.cpp                           |    2 +-
 libcore/DisplayObject.h                            |    9 +-
 libcore/ExternalInterface.cpp                      |   26 +-
 libcore/MovieClip.cpp                              |  294 ++++++++++----------
 libcore/MovieClip.h                                |    3 +-
 libcore/PropertyList.cpp                           |   27 +--
 libcore/PropertyList.h                             |   22 ++-
 libcore/as_object.cpp                              |   24 +--
 libcore/as_object.h                                |   46 ++--
 libcore/asobj/Array_as.h                           |    2 +-
 libcore/asobj/LoadVars_as.cpp                      |    6 +-
 libcore/asobj/SharedObject_as.cpp                  |    2 +-
 libcore/asobj/XMLNode_as.cpp                       |    1 +
 .../asobj/flash/external/ExternalInterface_as.cpp  |    2 +-
 libcore/vm/ASHandlers.cpp                          |   18 ++-
 15 files changed, 234 insertions(+), 250 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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