[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10747: InterruptableVirtualClock se
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10747: InterruptableVirtualClock semantic change: do NOT take ownership of source clock. Makes more sense, as NetStream for instance hooks a time tap to the gnash source clock but doesn't want to destroy that clock afterwards (taps don't take ownerhip of water pumps!) |
Date: |
Sat, 28 Mar 2009 10:54:42 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10747
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sat 2009-03-28 10:54:42 +0100
message:
InterruptableVirtualClock semantic change: do NOT take ownership of source
clock. Makes more sense, as NetStream for instance hooks a time tap to the
gnash source clock but doesn't want to destroy that clock afterwards (taps
don't take ownerhip of water pumps!)
modified:
gui/gui.cpp
libcore/VirtualClock.h
libcore/asobj/NetStream_as.cpp
=== modified file 'gui/gui.cpp'
--- a/gui/gui.cpp 2009-03-28 09:31:01 +0000
+++ b/gui/gui.cpp 2009-03-28 09:54:42 +0000
@@ -103,7 +103,12 @@
,_stopped(false)
,_started(false)
,_showUpdatedRegions(false)
- ,_virtualClock(&_systemClock)
+
+ // NOTE: it's important that _systemClock is constructed
+ // before and destroyed after _virtualClock !
+ ,_systemClock()
+ ,_virtualClock(_systemClock)
+
#ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
,_xpointer(0)
,_ypointer(0)
@@ -146,7 +151,12 @@
,_stopped(false)
,_started(false)
,_showUpdatedRegions(false)
- ,_virtualClock(&_systemClock)
+
+ // NOTE: it's important that _systemClock is constructed
+ // before and destroyed after _virtualClock !
+ ,_systemClock()
+ ,_virtualClock(_systemClock)
+
#ifdef ENABLE_KEYBOARD_MOUSE_MOVEMENTS
,_xpointer(0)
,_ypointer(0)
=== modified file 'libcore/VirtualClock.h'
--- a/libcore/VirtualClock.h 2009-02-25 22:33:03 +0000
+++ b/libcore/VirtualClock.h 2009-03-28 09:54:42 +0000
@@ -63,16 +63,19 @@
/// Construct an InterruptableVirtualClock from a VirtualClock source
//
- /// The interruptable virtual clock starts in 'stop' mode
+ /// The interruptable virtual clock starts in 'stop' mode,
+ /// use resume() to start.
///
/// @param src
- /// A VirtualClock to use as source, ownership transferred
+ /// A VirtualClock to use as source, ownership is retained by caller
+ /// which should guarantee to keep the source alive for the whole
+ /// lifetime of this instance.
///
- InterruptableVirtualClock(VirtualClock* src)
+ InterruptableVirtualClock(VirtualClock& src)
:
_src(src),
_elapsed(0),
- _offset(_src->elapsed()),
+ _offset(_src.elapsed()),
_paused(true)
{
}
@@ -81,14 +84,14 @@
unsigned long int elapsed() const
{
if ( ! _paused ) // query source if not stopped
- _elapsed = _src->elapsed()-_offset;
+ _elapsed = _src.elapsed()-_offset;
return _elapsed;
}
void restart()
{
_elapsed = 0;
- _offset = _src->elapsed();
+ _offset = _src.elapsed();
}
void pause()
@@ -102,14 +105,14 @@
if ( ! _paused ) return; // nothing to do
_paused = false;
- unsigned long now = _src->elapsed();
+ unsigned long now = _src.elapsed();
_offset = ( now - _elapsed );
assert( now-_offset == _elapsed ); // check if we did the right
thing
}
private:
- std::auto_ptr<VirtualClock> _src;
+ VirtualClock& _src;
mutable unsigned long int _elapsed;
=== modified file 'libcore/asobj/NetStream_as.cpp'
--- a/libcore/asobj/NetStream_as.cpp 2009-03-28 09:31:01 +0000
+++ b/libcore/asobj/NetStream_as.cpp 2009-03-28 09:54:42 +0000
@@ -106,7 +106,7 @@
_audioInfoKnown(false),
// TODO: figure out if we should take another path to get to the clock
- _playbackClock(new InterruptableVirtualClock(&(getVM().getClock()))),
+ _playbackClock(new InterruptableVirtualClock(getVM().getClock())),
_playHead(_playbackClock.get()),
_soundHandler(_vm.getRoot().runInfo().soundHandler()),
_mediaHandler(media::MediaHandler::get()),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10747: InterruptableVirtualClock semantic change: do NOT take ownership of source clock. Makes more sense, as NetStream for instance hooks a time tap to the gnash source clock but doesn't want to destroy that clock afterwards (taps don't take ownerhip of water pumps!),
Sandro Santilli <=