[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/vm/VM.h server/vm/VM.cpp...
From: |
Zou Lunkai |
Subject: |
[Gnash-commit] gnash ChangeLog server/vm/VM.h server/vm/VM.cpp... |
Date: |
Thu, 17 May 2007 09:23:28 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Zou Lunkai <zoulunkai> 07/05/17 09:23:27
Modified files:
. : ChangeLog
server/vm : VM.h VM.cpp ASHandlers.cpp
libbase : tu_timer.h tu_timer.cpp
testsuite/misc-ming.all: Makefile.am
Added files:
testsuite/misc-ming.all: getTimer_test.c
Log message:
fix ActionGetTimer, attempt to deprecate get_timer(), set_timer() in
movie_root
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3246&r2=1.3247
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.104&r2=1.105
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_timer.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/tu_timer.cpp?cvsroot=gnash&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/Makefile.am?cvsroot=gnash&r1=1.117&r2=1.118
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/getTimer_test.c?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3246
retrieving revision 1.3247
diff -u -b -r1.3246 -r1.3247
--- ChangeLog 16 May 2007 19:58:55 -0000 1.3246
+++ ChangeLog 17 May 2007 09:23:26 -0000 1.3247
@@ -1,3 +1,15 @@
+2007-05-17 Zou Lunkai <address@hidden>
+
+ * testsuite/misc-ming.all: getTimer_test.c, Makefile.am
+ add a new testcase; activate action_execution_order_test9.c
+ * server/vm/VM.{h,cpp}:
+ add a getStartTime() for VM.
+ * server/vm/ASHandlers.cpp:
+ use new "getStartTime()" interface, fix ActionGetTimer;
+ * libbase/tu_timer.{h,cpp}:
+ change time unit for non-win32 version "get_ticks()";
+
+
2007-05-16 Rob Savoye <address@hidden>
* macros/boost.m4: Look for shared libs with version numbers after
Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/vm/VM.h 15 Mar 2007 22:39:54 -0000 1.6
+++ server/vm/VM.h 17 May 2007 09:23:27 -0000 1.7
@@ -23,6 +23,7 @@
#include "smart_ptr.h" // for boost::intrusive_ptr
#include "movie_root.h" // for composition
+#include "tu_types.h" // for uint64_t
#include <memory> // for auto_ptr
#include <locale>
@@ -85,6 +86,9 @@
/// Target SWF version
int _swfversion;
+ /// Time when the VM get started
+ static uint64_t _start_time;
+
/// Set the current Root movie.
//
/// Will be called by the init() function
@@ -137,6 +141,9 @@
///
int getSWFVersion() const;
+ /// Get the time when VM was started
+ static uint64_t getStartTime();
+
/// Get version of the player, in a compatible representation
//
/// This information will be used for the System.capabilities.version
Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- server/vm/VM.cpp 28 Apr 2007 00:04:26 -0000 1.6
+++ server/vm/VM.cpp 17 May 2007 09:23:27 -0000 1.7
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: VM.cpp,v 1.6 2007/04/28 00:04:26 rsavoye Exp $ */
+/* $Id: VM.cpp,v 1.7 2007/05/17 09:23:27 zoulunkai Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -25,6 +25,7 @@
#include "movie_instance.h"
#include "movie_root.h"
#include "Global.h"
+#include "tu_timer.h" // for tu_timer::get_ticks()
#include <memory>
@@ -33,6 +34,7 @@
// Pointer to our singleton
std::auto_ptr<VM> VM::_singleton;
+uint64_t VM::_start_time;
VM&
VM::init(movie_definition& movie)
@@ -51,6 +53,9 @@
_singleton->setGlobal(new Global(*_singleton));
assert(_singleton->getGlobal());
+ // init singleton start time
+ _start_time = tu_timer::get_ticks();
+
return *_singleton;
}
@@ -138,6 +143,11 @@
_global = o;
}
+uint64_t
+VM::getStartTime()
+{
+ return _start_time;
+}
} // end of namespace gnash
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- server/vm/ASHandlers.cpp 14 May 2007 20:06:48 -0000 1.104
+++ server/vm/ASHandlers.cpp 17 May 2007 09:23:27 -0000 1.105
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: ASHandlers.cpp,v 1.104 2007/05/14 20:06:48 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.105 2007/05/17 09:23:27 zoulunkai Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -49,6 +49,7 @@
#include "movie_root.h" // for set_drag_state (ActionStartDragMovie)
#include "debugger.h"
#include "sound_handler.h"
+#include "tu_timer.h" // for tu_timer::get_ticks()
#include <string>
#include <map>
@@ -1436,7 +1437,7 @@
// movies in multiple windows using the same executable)
as_environment& env = thread.env;
- env.push(floorf(VM::get().getRoot().get_timer() * 1000.0f));
+ env.push(floorf(tu_timer::get_ticks() - VM::getStartTime()));
}
void
Index: libbase/tu_timer.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_timer.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- libbase/tu_timer.h 11 Apr 2007 17:54:21 -0000 1.4
+++ libbase/tu_timer.h 17 May 2007 09:23:27 -0000 1.5
@@ -15,8 +15,10 @@
namespace tu_timer
{
// General-purpose wall-clock timer. May not be hi-res enough
- // for profiling.
+ // for profiling. Time Unit: millisecond
uint64_t get_ticks();
+
+ // Time Unit: second
double ticks_to_seconds(uint64_t ticks);
// Hi-res timer for CPU profiling.
Index: libbase/tu_timer.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/tu_timer.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- libbase/tu_timer.cpp 2 May 2007 16:24:12 -0000 1.7
+++ libbase/tu_timer.cpp 17 May 2007 09:23:27 -0000 1.8
@@ -61,7 +61,7 @@
uint64_t tu_timer::get_ticks()
{
- return get_profile_ticks();
+ return get_profile_ticks()/1000.0;
}
@@ -82,7 +82,7 @@
uint64_t result = tv.tv_sec * 1000000;
result += tv.tv_usec;
-
+ // Time Unit: microsecond
return result;
}
Index: testsuite/misc-ming.all/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/Makefile.am,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -b -r1.117 -r1.118
--- testsuite/misc-ming.all/Makefile.am 16 May 2007 16:13:06 -0000 1.117
+++ testsuite/misc-ming.all/Makefile.am 17 May 2007 09:23:27 -0000 1.118
@@ -110,6 +110,7 @@
action_execution_order_test6 \
action_execution_order_test7 \
action_execution_order_test8 \
+ action_execution_order_test9 \
reverse_execute_PlaceObject2_test1 \
reverse_execute_PlaceObject2_test2 \
loadMovieTest \
@@ -128,6 +129,7 @@
key_event_testrunner \
static_vs_dynamic1 \
static_vs_dynamic2 \
+ getTimer_test \
Video-EmbedSquareTest \
Video-EmbedSquareTestRunner \
NetStream-SquareTest \
@@ -165,6 +167,7 @@
action_execution_order_test6runner \
action_execution_order_test7runner \
action_execution_order_test8runner \
+ action_execution_order_test9runner \
reverse_execute_PlaceObject2_test1runner \
reverse_execute_PlaceObject2_test2runner \
displaylist_depths_testrunner \
@@ -185,6 +188,7 @@
matrix_testrunner \
static_vs_dynamic1_testrunner \
static_vs_dynamic2_testrunner \
+ getTimer_testrunner \
$(NULL)
if MAKESWF_SUPPORTS_PREBUILT_CLIPS
@@ -924,6 +928,20 @@
sh $< -f8 $(top_builddir) action_execution_order_test8.swf > $@
chmod 755 $@
+action_execution_order_test9_SOURCES = \
+ action_execution_order_test9.c \
+ ming_utils.h \
+ ming_utils.c \
+ $(NULL)
+action_execution_order_test9_LDADD = $(MING_LIBS)
+
+action_execution_order_test9.swf: action_execution_order_test9
+ ./action_execution_order_test9 $(top_srcdir)/testsuite/media
+
+action_execution_order_test9runner: $(srcdir)/../generic-testrunner.sh
action_execution_order_test9.swf
+ sh $< -f8 $(top_builddir) action_execution_order_test9.swf > $@
+ chmod 755 $@
+
reverse_execute_PlaceObject2_test1_SOURCES = \
reverse_execute_PlaceObject2_test1.c \
ming_utils.h \
@@ -1225,6 +1243,21 @@
chmod 755 $@
+getTimer_test_SOURCES = \
+ getTimer_test.c \
+ ming_utils.h \
+ ming_utils.c \
+ $(NULL)
+
+getTimer_test_LDADD = $(MING_LIBS)
+
+getTimer_test.swf: getTimer_test
+ ./getTimer_test $(srcdir)/../media
+
+getTimer_testrunner: $(srcdir)/../generic-testrunner.sh getTimer_test.swf
+ sh $< $(top_builddir) getTimer_test.swf > $@
+ chmod 755 $@
+
NetStream_SquareTest_SOURCES = \
NetStream-SquareTest.c \
ming_utils.h \
@@ -1329,6 +1362,7 @@
action_execution_order_test6runner \
action_execution_order_test7runner \
action_execution_order_test8runner \
+ action_execution_order_test9runner \
reverse_execute_PlaceObject2_test1runner \
reverse_execute_PlaceObject2_test2runner \
displaylist_depths_testrunner \
@@ -1351,6 +1385,7 @@
key_event_testrunner \
static_vs_dynamic1_testrunner \
static_vs_dynamic2_testrunner \
+ getTimer_testrunner \
Video-EmbedSquareTestRunner \
NetStream-SquareTestRunner \
$(NULL)
Index: testsuite/misc-ming.all/getTimer_test.c
===================================================================
RCS file: testsuite/misc-ming.all/getTimer_test.c
diff -N testsuite/misc-ming.all/getTimer_test.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/misc-ming.all/getTimer_test.c 17 May 2007 09:23:27 -0000
1.1
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+/*
+ * test ActionGetTimer, getTimer returns the time in milliseconds
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ming.h>
+
+#include "ming_utils.h"
+
+#define OUTPUT_VERSION 6
+#define OUTPUT_FILENAME "getTimer_test.swf"
+
+
+int
+main(int argc, char** argv)
+{
+ SWFMovie mo;
+ SWFMovieClip dejagnuclip;
+
+ const char *srcdir=".";
+ if ( argc>1 )
+ srcdir=argv[1];
+ else
+ {
+ fprintf(stderr, "Usage: %s <mediadir>\n", argv[0]);
+ return 1;
+ }
+
+ Ming_init();
+ mo = newSWFMovieWithVersion(OUTPUT_VERSION);
+ SWFMovie_setDimension(mo, 800, 600);
+ SWFMovie_setRate (mo, 10.0);
+
+ dejagnuclip = get_dejagnu_clip((SWFBlock)get_default_font(srcdir), 10, 0, 0,
800, 600);
+ SWFMovie_add(mo, (SWFBlock)dejagnuclip);
+ SWFMovie_nextFrame(mo); // frame1
+
+ add_actions(mo, "x1 = getTimer();");
+ // check that the timer was properly initialized
+ check(mo, "x1 > 0" );
+ SWFMovie_nextFrame(mo); // frame2
+
+ add_actions(mo, "x2 = getTimer();");
+
+ // check that the timer is working
+ check(mo, "x2 > x1" );
+
+ // this is dependent on frame rate(current setting is 100ms per frame)
+ // check(mo, "x2 > 100");
+ check(mo, "x2 < 400");
+
+ // check that "getTimer" return a intergral number
+ check(mo, "x2 == Math.ceil(x2)");
+ check(mo, "x2 == Math.floor(x2)");
+ SWFMovie_nextFrame(mo); // frame3
+
+ add_actions(mo, "_root.totals(); stop();");
+ SWFMovie_nextFrame(mo);
+
+ //Output movie
+ puts("Saving " OUTPUT_FILENAME );
+ SWFMovie_save(mo, OUTPUT_FILENAME);
+
+ return 0;
+}
- [Gnash-commit] gnash ChangeLog server/vm/VM.h server/vm/VM.cpp...,
Zou Lunkai <=