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. 32a0a6f93c061c8fb750


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 32a0a6f93c061c8fb7507305922c45cf4c34d64a
Date: Thu, 07 Oct 2010 13:37:52 +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  32a0a6f93c061c8fb7507305922c45cf4c34d64a (commit)
       via  620116ebc15bf1a540d1750dbcbe34113cc5fece (commit)
      from  6c40fe14ed58e2217b17a1e6ab05e64869f530e9 (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=32a0a6f93c061c8fb7507305922c45cf4c34d64a


commit 32a0a6f93c061c8fb7507305922c45cf4c34d64a
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 7 15:28:11 2010 +0200

    Store movie_root in CharacterProxy to avoid using VM singleton.

diff --git a/libcore/CharacterProxy.cpp b/libcore/CharacterProxy.cpp
index c7ba39e..6ff5881 100644
--- a/libcore/CharacterProxy.cpp
+++ b/libcore/CharacterProxy.cpp
@@ -26,27 +26,17 @@
 
 #include <string>
 
-namespace gnash
-{
-
-/* static private */
-DisplayObject*
-CharacterProxy::findDisplayObjectByTarget(const std::string& tgtstr)
-{
-       if ( tgtstr.empty() ) return NULL;
-
-       return VM::get().getRoot().findCharacterByTarget(tgtstr);
-}
+namespace gnash {
 
 void
 CharacterProxy::checkDangling() const
 {
-       if ( _ptr && _ptr->isDestroyed() ) 
-       {
+       if (_ptr && _ptr->isDestroyed()) {
                _tgt = _ptr->getOrigTarget();
 #ifdef GNASH_DEBUG_SOFT_REFERENCES
-               log_debug("char %s (%s) was destroyed, stored it's orig target 
(%s) for later rebinding", _ptr->getTarget(),
-                       typeName(*_ptr), _tgt);
+               log_debug("char %s (%s) was destroyed, stored its orig target "
+                "(%s) for later rebinding", _ptr->getTarget(), typeName(*_ptr),
+                _tgt);
 #endif
                _ptr = 0;
        }
@@ -55,9 +45,10 @@ CharacterProxy::checkDangling() const
 std::string
 CharacterProxy::getTarget() const
 {
-       checkDangling(); // set _ptr to NULL and _tgt to original target if 
destroyed
+    // set _ptr to NULL and _tgt to original target if destroyed
+       checkDangling(); 
        if ( _ptr ) return _ptr->getTarget();
-       else return _tgt;
+       return _tgt;
 }
 
 void
@@ -67,6 +58,12 @@ CharacterProxy::setReachable() const
        if ( _ptr ) _ptr->setReachable();
 }
 
+DisplayObject*
+findDisplayObjectByTarget(const std::string& tgtstr, movie_root& mr)
+{
+       if (tgtstr.empty()) return 0;
+       return mr.findCharacterByTarget(tgtstr);
+}
 
 } // namespace gnash
 
diff --git a/libcore/CharacterProxy.h b/libcore/CharacterProxy.h
index 093e9f1..bfc76d7 100644
--- a/libcore/CharacterProxy.h
+++ b/libcore/CharacterProxy.h
@@ -21,39 +21,35 @@
 #define GNASH_CHARACTER_PROXY_H
 
 #include <string>
+#include <cassert>
 #include "dsodefs.h"
 
 // Forward declarations
 namespace gnash {
        class DisplayObject;
+    class movie_root;
 }
 
 namespace gnash {
 
+DisplayObject* findDisplayObjectByTarget(const std::string& target,
+            movie_root& mr);
+
 /// A proxy for DisplayObject pointers.
 //
 /// The proxy will store a pointer to a DisplayObject until the 
 /// DisplayObject is destroyed, in which case it will only store the original
 /// target path of it and always use that for rebinding when needed.
 ///
-class CharacterProxy {
-
-       mutable DisplayObject* _ptr;
-
-       mutable std::string _tgt;
-
-       static DisplayObject* findDisplayObjectByTarget(const std::string& 
target);
-
-       /// If we still have a sprite pointer check if it was destroyed
-       /// in which case we drop the pointer and only keep the target.
-       DSOEXPORT void checkDangling() const;
-
+class CharacterProxy
+{
 public:
 
        /// Construct a CharacterProxy pointing to the given sprite
-       CharacterProxy(DisplayObject* sp)
+       CharacterProxy(DisplayObject* sp, movie_root& mr)
                :
-               _ptr(sp)
+               _ptr(sp),
+        _mr(&mr)
        {
                checkDangling();
        }
@@ -69,10 +65,12 @@ public:
        ///           as in CharacterProxy newProxy(oldProxy.get())
        ///
        CharacterProxy(const CharacterProxy& sp)
+        :
+        _mr(sp._mr)
        {
                sp.checkDangling();
-               _ptr=sp._ptr;
-               if ( ! _ptr ) _tgt=sp._tgt;
+               _ptr = sp._ptr;
+               if (!_ptr) _tgt = sp._tgt;
        }
 
        /// Make this proxy a copy of the given one
@@ -84,12 +82,11 @@ public:
        ///           create a non-dangling proxy you can
        ///           use the constructor taking a DisplayObject
        ///           as in CharacterProxy newProxy(oldProxy.get())
-       ///
        CharacterProxy& operator=(const CharacterProxy& sp)
        {
                sp.checkDangling();
-               _ptr=sp._ptr;
-               if ( ! _ptr ) _tgt=sp._tgt;
+               _ptr = sp._ptr;
+               if (!_ptr) _tgt = sp._tgt;
                return *this;
        }
 
@@ -97,14 +94,14 @@ public:
        //
        /// @return the currently bound sprite, NULL if none
        ///
-       DisplayObject* get(bool skipRebinding=false) const
+       DisplayObject* get(bool skipRebinding = false) const
        {
-               if ( skipRebinding ) return _ptr;
+               if (skipRebinding) return _ptr;
 
         // set _ptr to NULL and _tgt to original target if destroyed
                checkDangling(); 
-               if ( _ptr ) return _ptr;
-               else return findDisplayObjectByTarget(_tgt);
+               if (_ptr) return _ptr;
+               return findDisplayObjectByTarget(_tgt, *_mr);
        }
 
        /// Get the sprite target, either current (if not dangling) or
@@ -139,6 +136,19 @@ public:
        ///       alive.
        ///
        void setReachable() const;
+
+private:
+
+       /// If we still have a sprite pointer check if it was destroyed
+       /// in which case we drop the pointer and only keep the target.
+       DSOEXPORT void checkDangling() const;
+
+       mutable DisplayObject* _ptr;
+
+       mutable std::string _tgt;
+
+    movie_root* _mr;
+
 };
 
 } // end namespace gnash
diff --git a/libcore/as_value.cpp b/libcore/as_value.cpp
index 4ded229..4c1ca9f 100644
--- a/libcore/as_value.cpp
+++ b/libcore/as_value.cpp
@@ -525,7 +525,7 @@ as_value::set_null()
 void
 as_value::set_as_object(as_object* obj)
 {
-    if ( ! obj )
+    if (!obj)
     {
         set_null();
         return;
@@ -534,7 +534,7 @@ as_value::set_as_object(as_object* obj)
         // The static cast is fine as long as the as_object is genuinely
         // a DisplayObject.
         _type = DISPLAYOBJECT;
-        _value = CharacterProxy(obj->displayObject());
+        _value = CharacterProxy(obj->displayObject(), getRoot(*obj));
         return;
     }
 
diff --git a/libcore/asobj/NetStream_as.cpp b/libcore/asobj/NetStream_as.cpp
index 94a7c01..11231c6 100644
--- a/libcore/asobj/NetStream_as.cpp
+++ b/libcore/asobj/NetStream_as.cpp
@@ -273,7 +273,7 @@ NetStream_as::getStatusObject(StatusCode code)
 void
 NetStream_as::setAudioController(DisplayObject* ch)
 {
-    _audioController.reset(new CharacterProxy(ch));
+    _audioController.reset(new CharacterProxy(ch, getRoot(owner())));
 }
 
 #ifdef GNASH_USE_GC
diff --git a/libcore/asobj/Sound_as.cpp b/libcore/asobj/Sound_as.cpp
index b065502..60bbe98 100644
--- a/libcore/asobj/Sound_as.cpp
+++ b/libcore/asobj/Sound_as.cpp
@@ -421,7 +421,7 @@ Sound_as::markSoundCompleted(bool completed)
 void
 Sound_as::attachCharacter(DisplayObject* attachTo) 
 {
-    _attachedCharacter.reset(new CharacterProxy(attachTo));
+    _attachedCharacter.reset(new CharacterProxy(attachTo, getRoot(owner())));
 }
 
 void

http://git.savannah.gnu.org/cgit//commit/?id=620116ebc15bf1a540d1750dbcbe34113cc5fece


commit 620116ebc15bf1a540d1750dbcbe34113cc5fece
Author: Benjamin Wolsey <address@hidden>
Date:   Thu Oct 7 15:27:48 2010 +0200

    Fix incorrect header in extensions.

diff --git a/extensions/dbus/dbus_ext.cpp b/extensions/dbus/dbus_ext.cpp
index d75f499..bc17213 100644
--- a/extensions/dbus/dbus_ext.cpp
+++ b/extensions/dbus/dbus_ext.cpp
@@ -32,7 +32,7 @@
 #include "dbus_ext.h"
 #include "fn_call.h"
 #include "as_object.h"
-#include "Globals.h"
+#include "Global_as.h"
 #include "builtin_function.h" // need builtin_function
 
 using namespace std;
diff --git a/extensions/dejagnu/dejagnu.cpp b/extensions/dejagnu/dejagnu.cpp
index 91ebb12..35ef855 100644
--- a/extensions/dejagnu/dejagnu.cpp
+++ b/extensions/dejagnu/dejagnu.cpp
@@ -27,7 +27,7 @@
 #include "dejagnu.h"
 #include "fn_call.h"
 #include "as_object.h"
-#include "Globals.h"
+#include "Global_as.h"
 #include "builtin_function.h" // need builtin_function
 
 using namespace std;
diff --git a/extensions/fileio/fileio.cpp b/extensions/fileio/fileio.cpp
index e9c4905..f38793a 100644
--- a/extensions/fileio/fileio.cpp
+++ b/extensions/fileio/fileio.cpp
@@ -35,7 +35,7 @@
 #include "fn_call.h"
 #include "as_object.h"
 #include "builtin_function.h" // need builtin_function
-#include "Globals.h"
+#include "Global_as.h"
 #include "fileio.h"
 #include "Array_as.h"  // used by scandir()
 
diff --git a/extensions/lirc/lirc_ext.cpp b/extensions/lirc/lirc_ext.cpp
index a561c9d..dfcfa6a 100644
--- a/extensions/lirc/lirc_ext.cpp
+++ b/extensions/lirc/lirc_ext.cpp
@@ -33,7 +33,7 @@
 #include "lirc_ext.h"
 #include "fn_call.h"
 #include "as_object.h"
-#include "Globals.h"
+#include "Global_as.h"
 #include "builtin_function.h" // need builtin_function
 
 using namespace std;
diff --git a/extensions/mysql/mysql_db.cpp b/extensions/mysql/mysql_db.cpp
index 16f56e5..ef47da9 100644
--- a/extensions/mysql/mysql_db.cpp
+++ b/extensions/mysql/mysql_db.cpp
@@ -21,26 +21,21 @@
 #include "gnashconfig.h"
 #endif
 
-#include "namedStrings.h"
-#include <cstdarg>
+#include "mysql_db.h"
 
+#include "namedStrings.h"
 #include <mysql/errmsg.h>
 #include <mysql/mysql.h>
-#include <iostream>
 #include <vector>
 
 #include "log.h"
 #include "Array_as.h"
 #include "as_value.h"
 #include "fn_call.h"
-#include "mysql_db.h"
-#include "Globals.h"
+#include "Global_as.h"
 #include "builtin_function.h" // need builtin_function
 
-using namespace std;
-
-namespace gnash
-{
+namespace gnash {
 
 as_value mysql_connect(const fn_call& fn);
 as_value mysql_qetData(const fn_call& fn);
@@ -273,7 +268,7 @@ MySQL::getData(const char *sql, query_t &qresult)
 #endif
     
     while((_row = mysql_fetch_row(_result))) {
-       vector<const char *> row_vec;
+       std::vector<const char *> row_vec;
        for (size_t i=0; i<mysql_num_fields(_result); i++) {
 //         log_debug("Column[%d] is: \"%s\"", i, row[i]);
            row_vec.push_back(_row[i]);
@@ -306,10 +301,10 @@ mysql_connect(const fn_call& fn)
     MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
 
     if (fn.nargs == 4) {
-        string host = fn.arg(0).to_string();
-        string db = fn.arg(1).to_string();
-        string user = fn.arg(2).to_string();
-        string passwd = fn.arg(3).to_string(); 
+        std::string host = fn.arg(0).to_string();
+        std::string db = fn.arg(1).to_string();
+        std::string user = fn.arg(2).to_string();
+        std::string passwd = fn.arg(3).to_string();    
         return as_value(ptr->connect(host.c_str(), db.c_str(),
                          user.c_str(), passwd.c_str()));
     } 
@@ -323,13 +318,13 @@ mysql_qetData(const fn_call& fn)
 //    GNASH_REPORT_FUNCTION;
 
     if (fn.nargs > 0) {
-        string sql = fn.arg(0).to_string();
+        std::string sql = fn.arg(0).to_string();
            as_object* arr = fn.arg(1).to_object(getGlobal(fn));
 
         MySQL::query_t qresult;
 
         for (size_t i=0; i<qresult.size(); i++) {
-            vector<const char *> row;
+            std::vector<const char *> row;
             row = qresult[i];
             for (size_t j=0; j< row.size(); j++) {
                 as_value entry = row[j];
@@ -390,7 +385,7 @@ mysql_query(const fn_call& fn)
 //    GNASH_REPORT_FUNCTION;
     MySQL* ptr = ensure<ThisIsNative<MySQL> >(fn);
     if (fn.nargs > 0) {
-        string sql = fn.arg(0).to_string();
+        std::string sql = fn.arg(0).to_string();
         return as_value(ptr->guery(sql.c_str()));
     }
     log_aserror("Missing arguments to MySQL.query");

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

Summary of changes:
 extensions/dbus/dbus_ext.cpp   |    2 +-
 extensions/dejagnu/dejagnu.cpp |    2 +-
 extensions/fileio/fileio.cpp   |    2 +-
 extensions/lirc/lirc_ext.cpp   |    2 +-
 extensions/mysql/mysql_db.cpp  |   29 ++++++++------------
 libcore/CharacterProxy.cpp     |   31 ++++++++++------------
 libcore/CharacterProxy.h       |   56 +++++++++++++++++++++++----------------
 libcore/as_value.cpp           |    4 +-
 libcore/asobj/NetStream_as.cpp |    2 +-
 libcore/asobj/Sound_as.cpp     |    2 +-
 10 files changed, 67 insertions(+), 65 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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