[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog gui/Player.cpp server/vm/VM.cpp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog gui/Player.cpp server/vm/VM.cpp... |
Date: |
Fri, 07 Dec 2007 15:34:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/12/07 15:34:38
Modified files:
. : ChangeLog
gui : Player.cpp
server/vm : VM.cpp VM.h
testsuite : Makefile.am MovieTester.cpp MovieTester.h
testsuite/server: DisplayListTest.cpp PropertyListTest.cpp
utilities : processor.cpp
Added files:
testsuite : ManualClock.h
Log message:
Plug a VirtualClock in the VM, use a SystemClock in most cases for now.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5108&r2=1.5109
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.72&r2=1.73
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.cpp?cvsroot=gnash&r1=1.25&r2=1.26
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/VM.h?cvsroot=gnash&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/Makefile.am?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.60&r2=1.61
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.h?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/ManualClock.h?cvsroot=gnash&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/DisplayListTest.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/PropertyListTest.cpp?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/processor.cpp?cvsroot=gnash&r1=1.73&r2=1.74
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5108
retrieving revision 1.5109
diff -u -b -r1.5108 -r1.5109
--- ChangeLog 7 Dec 2007 14:39:19 -0000 1.5108
+++ ChangeLog 7 Dec 2007 15:34:36 -0000 1.5109
@@ -1,3 +1,18 @@
+2007-12-07 Sandro Santilli <address@hidden>
+
+ * server/vm/VM.{cpp,h}: take a VirtualClock at init time
+ and use it from getTimer().
+ * gui/Player.cpp: initialize the VM with SystemClock.
+ * testsuite/: Makefile.am, ManualClock.h: manual clock
+ for test runners.
+ * testsuite/MovieTester.{cpp,h}: initialize the VM
+ with a SystemClock.
+ * testsuite/server/: DisplayListTest.cpp,
+ PropertyListTest.cpp: initialize the VM
+ with a ManualClock.
+ * utilities/processor.cpp: initialize the VM with
+ SystemClock.
+
2007-12-07 Udo Giacomozzi <address@hidden>
* testsuite/misc-swfc.all/gotoFrameFromInterval2.sc:
Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- gui/Player.cpp 4 Dec 2007 11:45:22 -0000 1.72
+++ gui/Player.cpp 7 Dec 2007 15:34:36 -0000 1.73
@@ -41,6 +41,7 @@
#include "GnashException.h"
#include "noseek_fd_adapter.h"
#include "VM.h"
+#include "SystemClock.h"
#include "log.h"
#include <iostream>
@@ -308,7 +309,8 @@
// Now that we know about movie size, create gui window.
_gui->createWindow(_url.c_str(), width, height);
- movie_root& root = VM::init(*_movie_def).getRoot();
+ SystemClock clock; // use system clock here...
+ movie_root& root = VM::init(*_movie_def, clock).getRoot();
_gui->setStage(&root);
Index: server/vm/VM.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- server/vm/VM.cpp 4 Dec 2007 11:45:34 -0000 1.25
+++ server/vm/VM.cpp 7 Dec 2007 15:34:37 -0000 1.26
@@ -16,7 +16,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.25 2007/12/04 11:45:34 strk Exp $ */
+/* $Id: VM.cpp,v 1.26 2007/12/07 15:34:37 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -28,10 +28,10 @@
#include "movie_instance.h"
#include "movie_root.h"
#include "Global.h"
-#include "tu_timer.h" // for tu_timer::get_ticks()
#include "rc.h" //for overriding default version string with rcfile
#include "namedStrings.h"
#include "ClassHierarchy.h"
+#include "VirtualClock.h" // for getTime()
#include <memory>
@@ -45,12 +45,12 @@
std::auto_ptr<VM> VM::_singleton;
VM&
-VM::init(movie_definition& movie)
+VM::init(movie_definition& movie, VirtualClock& clock)
{
// Don't call more then once !
assert(!_singleton.get());
- _singleton.reset(new VM(movie));
+ _singleton.reset(new VM(movie, clock));
assert(_singleton.get());
NSV::load_strings(&_singleton->mStringTable,
_singleton->getSWFVersion());
@@ -76,14 +76,16 @@
return _singleton.get();
}
-VM::VM(movie_definition& topmovie)
+VM::VM(movie_definition& topmovie, VirtualClock& clock)
:
_root_movie(new movie_root()),
_swfversion(topmovie.get_version()),
_start_time(tu_timer::get_ticks()),
mClassHierarchy(0),
- mMachine(0)
+ mMachine(0),
+ _clock(clock)
{
+ _clock.restart();
}
VM::~VM()
@@ -138,10 +140,10 @@
_global = o;
}
-boost::uint64_t
-VM::getTime()
+unsigned long int
+VM::getTime() const
{
- return (tu_timer::get_ticks() - _start_time);
+ return _clock.elapsed();
}
void
Index: server/vm/VM.h
===================================================================
RCS file: /sources/gnash/gnash/server/vm/VM.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- server/vm/VM.h 4 Dec 2007 11:45:34 -0000 1.20
+++ server/vm/VM.h 7 Dec 2007 15:34:37 -0000 1.21
@@ -38,6 +38,7 @@
class builtin_function;
class as_object;
class Machine;
+ class VirtualClock;
}
namespace gnash {
@@ -95,7 +96,7 @@
//
/// Initializes the GC singleton
///
- VM(movie_definition& movie);
+ VM(movie_definition& movie, VirtualClock& clock);
/// Don't copy
VM(const VM&);
@@ -150,6 +151,8 @@
/// A running execution thread.
Machine *mMachine;
+ VirtualClock& _clock;
+
public:
/// \brief
@@ -166,7 +169,10 @@
/// used to fetch SWF version from.
/// TODO: take SWF version directly ?
///
- static VM& init(movie_definition& movie);
+ /// @param clock
+ /// Virtual clock used as system time.
+ ///
+ static VM& init(movie_definition& movie, VirtualClock& clock);
/// Return true if the singleton VM has been initialized
static bool isInitialized();
@@ -187,7 +193,7 @@
int getSWFVersion() const;
/// Get the number of milliseconds since VM was started
- boost::uint64_t getTime();
+ unsigned long int getTime() const;
/// Get a reference to the string table used by the VM.
string_table& getStringTable() const { return mStringTable; }
Index: testsuite/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/Makefile.am,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- testsuite/Makefile.am 28 Oct 2007 22:01:32 -0000 1.47
+++ testsuite/Makefile.am 7 Dec 2007 15:34:37 -0000 1.48
@@ -29,6 +29,7 @@
MovieTester.cpp \
FuzzyPixel.cpp \
FuzzyPixel.h \
+ ManualClock.h \
$(NULL)
libtestsuite_la_LIBADD = \
$(RENDERER_LIBS) \
Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- testsuite/MovieTester.cpp 24 Nov 2007 17:43:29 -0000 1.60
+++ testsuite/MovieTester.cpp 7 Dec 2007 15:34:37 -0000 1.61
@@ -36,6 +36,7 @@
#include "render.h"
#include "render_handler.h"
#include "render_handler_agg.h"
+#include "SystemClock.h"
#ifdef RENDERER_CAIRO
#include "render_handler_cairo.h"
#endif
@@ -56,7 +57,8 @@
MovieTester::MovieTester(const std::string& url)
:
- _forceRedraw(true)
+ _forceRedraw(true),
+ _clock(new SystemClock()) // TODO: use a manual clock
{
// Initialize gnash code lib
@@ -87,7 +89,7 @@
// Initialize the sound handler(s)
initTestingSoundHandlers();
- _movie_root = &(VM::init(*_movie_def).getRoot());
+ _movie_root = &(VM::init(*_movie_def, *_clock).getRoot());
// Initialize viewport size with the one advertised in the header
_width = unsigned(_movie_def->get_width_pixels());
Index: testsuite/MovieTester.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- testsuite/MovieTester.h 24 Nov 2007 17:21:45 -0000 1.33
+++ testsuite/MovieTester.h 7 Dec 2007 15:34:37 -0000 1.34
@@ -27,6 +27,7 @@
#include "types.h" // for rgba class
#include "render_handler.h" // for dtor visibility by auto_ptr
#include "movie_instance.h"
+#include "ManualClock.h" // for composition
#include <memory> // for auto_ptr
#include <string>
@@ -53,6 +54,7 @@
class sprite_instance;
class character;
class FuzzyPixel;
+ class VirtualClock;
}
namespace gnash {
@@ -107,6 +109,9 @@
/// Advance the movie by one frame
void advance();
+ /// Advance the clock by the given amount of milliseconds
+ void advanceClock(unsigned long ms);
+
/// Fully redraw of current frame
//
/// This function forces complete redraw in all testing
@@ -318,6 +323,10 @@
// When true, pass world invalidated ranges
// to the renderer(s) at ::render time.
bool _forceRedraw;
+
+ /// Virtual clock to use to let test runners
+ /// control time flow
+ std::auto_ptr<VirtualClock> _clock;
};
} // namespace gnash
Index: testsuite/server/DisplayListTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/DisplayListTest.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/server/DisplayListTest.cpp 7 Sep 2007 00:11:27 -0000
1.8
+++ testsuite/server/DisplayListTest.cpp 7 Dec 2007 15:34:37 -0000
1.9
@@ -27,6 +27,7 @@
#include "DummyMovieDefinition.h"
#include "DummyCharacter.h"
#include "movie_definition.h"
+#include "ManualClock.h"
#include <iostream>
#include <sstream>
@@ -55,7 +56,8 @@
boost::intrusive_ptr<movie_definition> md5 ( new
DummyMovieDefinition(5) );
boost::intrusive_ptr<movie_definition> md6 ( new
DummyMovieDefinition(6) );
- VM& vm = VM::init(*md5);
+ ManualClock clock;
+ VM& vm = VM::init(*md5, clock);
vm.getRoot().setRootMovie( md5->create_movie_instance() );
DisplayList dlist1;
Index: testsuite/server/PropertyListTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/PropertyListTest.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- testsuite/server/PropertyListTest.cpp 19 Sep 2007 14:20:52 -0000
1.19
+++ testsuite/server/PropertyListTest.cpp 7 Dec 2007 15:34:37 -0000
1.20
@@ -27,6 +27,7 @@
#include "log.h"
#include "smart_ptr.h"
#include "as_prop_flags.h"
+#include "ManualClock.h"
#include <iostream>
#include <sstream>
@@ -51,7 +52,8 @@
boost::intrusive_ptr<movie_definition> md5 ( new
DummyMovieDefinition(5) );
boost::intrusive_ptr<movie_definition> md6 ( new
DummyMovieDefinition(6) );
- VM& vm = VM::init(*md5);
+ ManualClock clock;
+ VM& vm = VM::init(*md5, clock);
vm.getRoot().setRootMovie( md5->create_movie_instance() );
log_debug("VM version %d", vm.getSWFVersion());
Index: utilities/processor.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/processor.cpp,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -b -r1.73 -r1.74
--- utilities/processor.cpp 4 Dec 2007 11:45:35 -0000 1.73
+++ utilities/processor.cpp 7 Dec 2007 15:34:37 -0000 1.74
@@ -16,7 +16,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: processor.cpp,v 1.73 2007/12/04 11:45:35 strk Exp $ */
+/* $Id: processor.cpp,v 1.74 2007/12/07 15:34:37 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -44,6 +44,7 @@
#include "debugger.h"
#include "VM.h"
#include "noseek_fd_adapter.h"
+#include "SystemClock.h"
extern "C"{
#include <unistd.h>
@@ -330,7 +331,9 @@
long localDelay = delay == -1 ? long(1000000/md->get_frame_rate())+1 :
delay; // microseconds
- gnash::movie_root& m = VM::init(*md).getRoot();
+ // TODO: use a fake clock if running at different then FPS rate
+ SystemClock cl;
+ gnash::movie_root& m = VM::init(*md, cl).getRoot();
md->completeLoad();
Index: testsuite/ManualClock.h
===================================================================
RCS file: testsuite/ManualClock.h
diff -N testsuite/ManualClock.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/ManualClock.h 7 Dec 2007 15:34:37 -0000 1.1
@@ -0,0 +1,65 @@
+/*
+ * 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 3 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
+ *
+ *
+ */
+
+#ifndef _GNASH_MANUAL_CLOCK_HH
+#define _GNASH_MANUAL_CLOCK_HH
+
+#include "VirtualClock.h" // for inheritance
+
+namespace gnash {
+
+/// A manually advanced clock
+class ManualClock : public VirtualClock
+{
+public:
+
+ /// Construct a manual clock
+ ManualClock()
+ :
+ _elapsed(0)
+ {}
+
+ // see dox in VirtualClock.h
+ unsigned long elapsed() const
+ {
+ return _elapsed;
+ }
+
+ // see dox in VirtualClock.h
+ void restart()
+ {
+ _elapsed=0;
+ }
+
+ /// Advance the clock by the given amount of milliseconds
+ void advance(unsigned long amount)
+ {
+ _elapsed += amount;
+ }
+
+private:
+
+ unsigned long _elapsed;
+};
+
+
+} // namespace gnash
+
+#endif // _GNASH_MANUAL_CLOCK_HH
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog gui/Player.cpp server/vm/VM.cpp...,
Sandro Santilli <=