gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_object.h server/as_ob...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_object.h server/as_ob...
Date: Mon, 27 Nov 2006 00:49:54 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/27 00:49:54

Modified files:
        .              : ChangeLog 
        server         : as_object.h as_object.cpp 

Log message:
                * server/as_object.{h,cpp}: added getVM() function,
                  store a reference to the VM in class definition.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1775&r2=1.1776
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.18&r2=1.19

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1775
retrieving revision 1.1776
diff -u -b -r1.1775 -r1.1776
--- ChangeLog   27 Nov 2006 00:03:18 -0000      1.1775
+++ ChangeLog   27 Nov 2006 00:49:54 -0000      1.1776
@@ -1,5 +1,7 @@
 2006-11-26 Sandro Santilli <address@hidden>
 
+       * server/as_object.{h,cpp}: added getVM() function,
+         store a reference to the VM in class definition.
        * testsuite/misc-ming.all/ming_utils.c: add a note 
          function to dejagnu module interface.
        * doc/C/internals.xml: cleanups in the 'writing testcases'

Index: server/as_object.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/as_object.h  25 Nov 2006 14:27:44 -0000      1.21
+++ server/as_object.h  27 Nov 2006 00:49:54 -0000      1.22
@@ -31,13 +31,16 @@
 #include "ref_counted.h" // for inheritance 
 #include "PropertyList.h"
 
+// Forward declarations
 namespace gnash {
+       class as_function;
+       class sprite_instance;
+       class as_value;
+       class as_environment;
+       class VM;
+}
 
-// Forward declarations
-class as_function;
-class sprite_instance;
-class as_value;
-class as_environment;
+namespace gnash {
 
 /// \brief
 /// A generic bag of attributes. Base class for all ActionScript-able objects.
@@ -70,6 +73,13 @@
        ///
        Property* findProperty(const std::string& name);
 
+       /// \brief
+       /// Return a reference to the Virtual Machine that created
+       /// this object. 
+       VM& getVM() const {
+               return _vm;
+       }
+
 public:
 
        /// Dump all properties using log_msg
@@ -284,6 +294,8 @@
        ///
        void set_prototype(as_object* proto);
 
+       /// The Virtual Machine used to create this object
+       VM& _vm;
 };
 
 } // namespace gnash

Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/as_object.cpp        25 Nov 2006 14:27:44 -0000      1.18
+++ server/as_object.cpp        27 Nov 2006 00:49:54 -0000      1.19
@@ -47,13 +47,10 @@
 as_object::add_property(const std::string& key, as_function& getter,
                as_function& setter)
 {
-       // TODO: keep a refenrence in the class definition
-       //       rather then caling ::get() everytime ?
-       VM& vm = VM::get();
-       if ( vm.getSWFVersion() < 7 )
+       if ( _vm.getSWFVersion() < 7 )
        {
                std::string name = key;
-               boost::to_lower(name, vm.getLocale());
+               boost::to_lower(name, _vm.getLocale());
                return _members.addGetterSetter(name, getter, setter);
        }
        else
@@ -71,12 +68,9 @@
        // temp hack, should really update this method's interface instead
        std::string name = namei.c_str();
 
-       // TODO: keep a refenrence in the class definition
-       //       rather then caling ::get() everytime ?
-       VM& vm = VM::get();
-       if ( vm.getSWFVersion() < 7 )
+       if ( _vm.getSWFVersion() < 7 )
        {
-               boost::to_lower(name, vm.getLocale());
+               boost::to_lower(name, _vm.getLocale());
        }
 
        //log_msg("Getting member %s (SWF version:%d)", name.c_str(), 
vm.getSWFVersion());
@@ -171,12 +165,9 @@
 
         std::string key = name.c_str();
 
-       // TODO: keep a refenrence in the class definition
-       //       rather then caling ::get() everytime ?
-       VM& vm = VM::get();
-       if ( vm.getSWFVersion() < 7 )
+       if ( _vm.getSWFVersion() < 7 )
        {
-               boost::to_lower(key, vm.getLocale());
+               boost::to_lower(key, _vm.getLocale());
        }
 
        //log_msg("Setting member %s (SWF version:%d)", key.c_str(), 
vm.getSWFVersion());
@@ -219,12 +210,9 @@
 {
        std::string name(name_tu.c_str());
 
-       // TODO: keep a refenrence in the class definition
-       //       rather then caling ::get() everytime ?
-       VM& vm = VM::get();
-       if ( vm.getSWFVersion() < 7 )
+       if ( _vm.getSWFVersion() < 7 )
        {
-               boost::to_lower(name, vm.getLocale());
+               boost::to_lower(name, _vm.getLocale());
        }
 
        // TODO: accept a std::string directly
@@ -364,17 +352,17 @@
 as_object::as_object()
        :
        _members(),
-       m_prototype(NULL)
+       m_prototype(NULL),
+       _vm(VM::get())
 {
-       assert(VM::get().getSWFVersion());
 }
 
 as_object::as_object(as_object* proto)
        :
        _members(),
-       m_prototype(proto)
+       m_prototype(proto),
+       _vm(VM::get())
 {
-       assert(VM::get().getSWFVersion());
        if (m_prototype) m_prototype->add_ref();
 }
 
@@ -382,9 +370,9 @@
        :
        ref_counted(),
        _members(other._members),
-       m_prototype(other.m_prototype)
+       m_prototype(other.m_prototype),
+       _vm(VM::get())
 {
-       assert(VM::get().getSWFVersion());
        if (m_prototype) m_prototype->add_ref();
 }
 




reply via email to

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