gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r9715: More cleanups to SharedObject


From: Sandro Santilli
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r9715: More cleanups to SharedObject and normalization tests.
Date: Wed, 10 Sep 2008 16:02:57 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 9715
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Wed 2008-09-10 16:02:57 +0200
message:
  More cleanups to SharedObject and normalization tests.
modified:
  libcore/asobj/SharedObject.cpp
  libcore/asobj/SharedObject.h
  testsuite/actionscript.all/SharedObject.as
    ------------------------------------------------------------
    revno: 9714.1.1
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 15:53:00 +0200
    message:
      test SharedObject name 'normalization'
    modified:
      testsuite/actionscript.all/SharedObject.as
    ------------------------------------------------------------
    revno: 9714.1.2
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 15:53:20 +0200
    message:
      create SharedObject dir on flush, not read
    modified:
      libcore/asobj/SharedObject.cpp
    ------------------------------------------------------------
    revno: 9714.1.3
    committer: Sandro Santilli <address@hidden>
    branch nick: mybranch
    timestamp: Wed 2008-09-10 15:55:34 +0200
    message:
      add a clear() method to SharedObjectLibrary class
    modified:
      libcore/asobj/SharedObject.h
=== modified file 'libcore/asobj/SharedObject.cpp'
--- a/libcore/asobj/SharedObject.cpp    2008-09-10 13:32:57 +0000
+++ b/libcore/asobj/SharedObject.cpp    2008-09-10 13:53:20 +0000
@@ -170,6 +170,8 @@
 {
 public:
 
+    ~SharedObject();
+
     SharedObject()
         :
         as_object(getSharedObjectInterface())
@@ -351,12 +353,6 @@
 
     log_debug("SharedObject path: %s", newspec);
         
-    if ( ! createDirForFile(newspec) )
-    {
-        log_error("Couldn't create dir for SharedObject %s", newspec);
-        return 0;
-    }
-
     if ( ! obj->readSOL(newspec) )
     {
         log_error("Couldn't read SOL %s, will create on flush/exit", newspec);
@@ -432,11 +428,23 @@
     return true;
 }
 
+
+SharedObject::~SharedObject()
+{
+    // flush(); // needs more care, if destroyed after VM we get killed
+}
+
 bool
 SharedObject::flush() const
 {
     const std::string& filespec = _sol.getFilespec();
 
+    if ( ! createDirForFile(filespec) )
+    {
+        log_error("Couldn't create dir for flushing SharedObject %s", 
filespec);
+        return false;
+    }
+
 #ifdef USE_SOL_READONLY
     log_debug(_("SharedObject %s not flushed (compiled as read-only mode)"), 
filespec);
     return false;

=== modified file 'libcore/asobj/SharedObject.h'
--- a/libcore/asobj/SharedObject.h      2008-09-10 13:32:57 +0000
+++ b/libcore/asobj/SharedObject.h      2008-09-10 13:55:34 +0000
@@ -46,6 +46,9 @@
 
     void markReachableResources() const;
 
+    // Drop all library items
+    void clear() { _soLib.clear(); }
+
 private:
 
     VM& _vm;

=== modified file 'testsuite/actionscript.all/SharedObject.as'
--- a/testsuite/actionscript.all/SharedObject.as        2008-09-10 13:32:57 
+0000
+++ b/testsuite/actionscript.all/SharedObject.as        2008-09-10 13:53:00 
+0000
@@ -82,6 +82,14 @@
 so2 = SharedObject.getLocal("level1/level2/settings", "/");
 check_equals(so2.data.tmp, "custom value");
 check_equals(so, so2);
+
+so2bis = SharedObject.getLocal("level1//level2/settings", "/");
+xcheck_equals(typeof(so2bis), 'null'); // invalid path
+
+so2bis = SharedObject.getLocal("level1/./level2/settings", "/");
+check_equals(typeof(so2bis), 'object'); // valid path
+check(so2bis != so2); // but not recognized as the same as 
level1/./level2/settings
+
 delete so.data.tmp;
 
 // But a getLocal call using a *different* "id" returns
@@ -195,6 +203,6 @@
 // END OF TESTS
 //------------------------------------------
 
-check_totals(48);
+check_totals(51);
 
 #endif // OUTPUT_VERSION >= 6


reply via email to

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