[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9584: Fix remoting for GC, cleanups
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9584: Fix remoting for GC, cleanups, fix support for short PLACEOBJECT tag |
Date: |
Tue, 12 Aug 2008 17:57:41 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9584
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Tue 2008-08-12 17:57:41 +0200
message:
Fix remoting for GC, cleanups, fix support for short PLACEOBJECT tag
modified:
libcore/asobj/NetConnection.cpp
libcore/asobj/NetConnection.h
libcore/matrix.cpp
libcore/swf/PlaceObject2Tag.cpp
------------------------------------------------------------
revno: 9582.1.3
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Tue 2008-08-12 16:47:21 +0200
message:
Drop unused code, more vebose debugging
modified:
libcore/asobj/NetConnection.cpp
------------------------------------------------------------
revno: 9582.1.4
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Tue 2008-08-12 17:03:00 +0200
message:
Mark resources reachable from NetConnection (remoting response handlers)
modified:
libcore/asobj/NetConnection.cpp
libcore/asobj/NetConnection.h
------------------------------------------------------------
revno: 9582.1.5
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Tue 2008-08-12 17:30:31 +0200
message:
Handle premature end of stream locally while parsing matrix.
Fixes bug reported in comment #27 of bug #21756.
modified:
libcore/matrix.cpp
------------------------------------------------------------
revno: 9582.1.6
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Tue 2008-08-12 17:31:43 +0200
message:
fix stop_thicking
modified:
libcore/asobj/NetConnection.cpp
------------------------------------------------------------
revno: 9582.1.7
committer: Sandro Santilli <address@hidden>
branch nick: mybranch
timestamp: Tue 2008-08-12 17:54:32 +0200
message:
revert the local-catch in matrix parser. rather check tag boundaries
in PlaceObject parser, similarly to what's done with color transform,
so that flags match reality.
modified:
libcore/matrix.cpp
libcore/swf/PlaceObject2Tag.cpp
=== modified file 'libcore/asobj/NetConnection.cpp'
--- a/libcore/asobj/NetConnection.cpp 2008-08-12 14:32:12 +0000
+++ b/libcore/asobj/NetConnection.cpp 2008-08-12 15:31:43 +0000
@@ -498,7 +498,10 @@
private:
NetConnection& _nc;
static const int NCCALLREPLYMAX=200000;
- std::map<std::string, boost::intrusive_ptr<as_object> > callbacks;
+
+ typedef std::map<std::string, boost::intrusive_ptr<as_object> >
CallbacksMap;
+ CallbacksMap callbacks;
+
SimpleBuffer postdata;
URL url;
boost::scoped_ptr<IOChannel> connection;
@@ -754,6 +757,14 @@
return as_value();
};
+ void markReachableResources() const
+ {
+ for (CallbacksMap::const_iterator i=callbacks.begin(),
e=callbacks.end(); i!=e; ++i)
+ {
+ i->second->setReachable();
+ }
+ }
+
private:
void start_ticking() {
@@ -767,14 +778,15 @@
ticker = _nc.getVM().getRoot().add_interval_timer(timer, true);
}
void push_amf(const SimpleBuffer &amf) {
- log_debug("pushing amf");
+ GNASH_REPORT_FUNCTION;
+
postdata.append(amf.data(), amf.size());
queued_count++;
- log_debug("pushed amf");
+
start_ticking();
}
void stop_ticking() {
- if(ticker) return;
+ if(!ticker) return;
_nc.getVM().getRoot().clear_interval_timer(ticker);
ticker=0;
}
@@ -782,7 +794,7 @@
callbacks.insert(std::pair<std::string,
boost::intrusive_ptr<as_object> >(id, callback));
}
boost::intrusive_ptr<as_object> pop_callback(std::string id) {
- std::map<std::string, boost::intrusive_ptr<as_object>
>::iterator it = callbacks.find(id);
+ CallbacksMap::iterator it = callbacks.find(id);
if(it != callbacks.end()) {
boost::intrusive_ptr<as_object> callback = it->second;
//boost::intrusive_ptr<as_object> callback;
@@ -812,18 +824,25 @@
as_value& methodName_as = fn.arg(0);
if (!methodName_as.is_string()) {
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("NetConnection.call(): first argument
(methodName) must be a string"));
+ std::stringstream ss; fn.dump_args(ss);
+ log_aserror(_("NetConnection.call(%s): first argument
(methodName) must be a string"), ss.str());
);
return as_value(false); // FIXME should we return true anyway?
}
+ std::stringstream ss; fn.dump_args(ss);
+ log_debug("NetConnection.call(%s)", ss.str());
+
// TODO: arg(1) is the response object. let it know when data comes back
boost::intrusive_ptr<as_object> asCallback = 0;
if(fn.nargs > 1) {
if(fn.arg(1).is_object()) {
asCallback = (fn.arg(1).to_object());
} else {
- log_aserror("NetConnection::call(): called with a
non-object as the callback");
+ IF_VERBOSE_ASCODING_ERRORS(
+ std::stringstream ss; fn.dump_args(ss);
+ log_aserror("NetConnection::call(%s): second argument
must be an object", ss.str());
+ );
}
}
@@ -891,7 +910,6 @@
URL url(ptr->validateURL(std::string()));
-
// FIXME check if it's possible for the URL of a NetConnection to
change between call()s
if(ptr->call_queue == 0) {
ptr->call_queue = new AMFQueue(*ptr, url);
@@ -908,105 +926,6 @@
}
log_debug("called enqueue");
-#if 0
-
- std::string postdata(reinterpret_cast<char*>(buf->data()), buf->size());
- std::auto_ptr<IOChannel>
stream(StreamProvider::getDefaultInstance().getStream(url, postdata));
- SimpleBuffer reply(256);
- int count = 0;
- int read_size;
-
- // FIXME this needs to be in a thread, as does the getStream() above
- //while(!stream->eof()) {
- // reply.reserve(count + 256);
- // read_size = stream->readNonBlocking(reply.data() + count, 256);
- // if(read_size > 0) { // currently readNonBlocking returns -1 on
error
- // count += read_size;
- // }
- //}
- while(!stream->eof()) {
- reply.reserve(count + 50000);
- read_size = stream->read(reply.data() + count, 50000);
- log_debug("stream->read() returned: %i", read_size);
- if(read_size > 0) { // currently readNonBlocking returns -1 on
error
- if(read_size == 50000) { // ?????
- log_error("stream->read() said that it read
50000 characters... seems unlikely");
- } else {
- count += read_size;
- }
- }
- }
- reply.resize(count);
-
- // if they didn't pass an object to be notified of the reply, exit now
- // ( ne need to parse the server response
- if(asCallback == 0) {
- // TODO check if there's any cleanup needed here
- return as_value();
- }
-
-
- log_debug(_("NetConnection.call(): response: "));
- log_debug("%s", hexify(reply.data(), reply.size(), false));
-
- // parse server reply
- if(reply.size() < 21) {
- log_error(_("NetConnection.call(): response from server too
short to be valid"));
- // TODO call onStatus callback
- } else {
- boost::uint8_t *b = reply.data();
- boost::uint8_t *end = b + reply.size();
- boost::uint16_t si;
- boost::uint16_t li;
-
- b += 2; // skip header bytes (version, client_id)
- si = readNetworkShort(b); b += 2;
- if(si != 0) {
- // FIXME just skip them. but make sure the buffer is
long enough to at least have the type byte for the value in the body.
- log_unimpl("NetConnection.call(): server sent back
headers");
- } else {
- si = readNetworkShort(b); b += 2;
- if(si != 1) {
- // TODO decide what to do in this case
- log_error(_("NetConnection.call(): server sent
back a weird number of bodies"));
- } else {
- // scan past response message (something like
/1/onResult)
- si = readNetworkShort(b); b += 2;
- b += si; // TODO make sure this ends with
onResult, not onStatus
-
- // scan past "null"
- si = readNetworkShort(b); b += 2;
- b += si; // FIXME check if this is bigger than
4. if so check that the buffer is long enouggh for the rest of the header
-
- // read length
- li = readNetworkLong(b); b += 4;
- if(li != end - b) {
- if(li < end - b) {
-
log_error(_("NetConnection.call(): server sent us a length that's less than the
number of bytes it sent. Continuing anyway."));
- } else {
- // note: potlatch (which works
in the proprietary player) gets 0xffffffff here
-
log_error(_("NetConnection.call(): server sent us a length that's more than the
number of bytes it sent. Continuing anyway."));
- }
- }
-
- as_value response;
- if ( amf0_read_value(b, end, response) )
- {
-
asCallback->callMethod(NSV::PROP_ON_RESULT, response);
- }
- else
- {
- // TODO construct an object with info
about the failure to pass to onStatus
- // see:
http://livedocs.adobe.com/fms/2/docs/00000742.html
- log_unimpl("NetConnection.call() :
triggering responder's onStatus on decoding error");
-
//asCallback->callMethod(NSV::PROP_ON_STATUS, TODO);
- }
- }
- }
- }
-
- log_unimpl("NetConnection.call()");
-#endif
return as_value();
}
@@ -1130,6 +1049,13 @@
delete call_queue;
}
+void
+NetConnection::markReachableResources() const
+{
+ if ( call_queue ) call_queue->markReachableResources();
+ markAsObjectReachable();
+}
+
} // end of gnash namespace
=== modified file 'libcore/asobj/NetConnection.h'
--- a/libcore/asobj/NetConnection.h 2008-08-12 09:59:57 +0000
+++ b/libcore/asobj/NetConnection.h 2008-08-12 15:03:00 +0000
@@ -155,6 +155,11 @@
///
bool loadCompleted();
+protected:
+
+ /// Mark responders associated with remoting calls
+ void markReachableResources() const;
+
private:
friend class AMFQueue;
=== modified file 'libcore/matrix.cpp'
--- a/libcore/matrix.cpp 2008-08-10 17:08:19 +0000
+++ b/libcore/matrix.cpp 2008-08-12 15:54:32 +0000
@@ -27,6 +27,7 @@
#include "matrix.h"
#include "SWFStream.h" // for reading from SWF
+#include "log.h"
#include <cmath>
#include <iomanip>
=== modified file 'libcore/swf/PlaceObject2Tag.cpp'
--- a/libcore/swf/PlaceObject2Tag.cpp 2008-08-10 17:08:19 +0000
+++ b/libcore/swf/PlaceObject2Tag.cpp 2008-08-12 15:54:32 +0000
@@ -35,36 +35,34 @@
in.ensureBytes(2 + 2);
m_character_id = in.read_u16();
m_depth = in.read_u16() + character::staticDepthOffset;
- m_matrix.read(in);
- IF_VERBOSE_PARSE
- (
- log_parse(_(" PLACEOBJECT: depth=%d(%d) char=%d"),
- m_depth, m_depth - character::staticDepthOffset,
- m_character_id);
- log_parse(" matrix: %s", m_matrix);
- );
+ // PlaceObject doesn't know about masks.
+ m_clip_depth = character::noClipDepthValue;
// If these flags2 values aren't set here, nothing will
// ever be displayed.
- m_has_flags2 |= ( HAS_CHARACTER_MASK
- | HAS_MATRIX_MASK );
-
- // PlaceObject doesn't know about masks.
- m_clip_depth = character::noClipDepthValue;
+ m_has_flags2 = HAS_CHARACTER_MASK;
if (in.tell() < in.get_tag_end_position())
{
- m_color_transform.read_rgb(in);
-
- m_has_flags2 |= HAS_CXFORM_MASK;
-
- IF_VERBOSE_PARSE
- (
- log_parse(_(" cxform: %s"), m_color_transform);
- );
-
+ m_matrix.read(in);
+ m_has_flags2 |= HAS_MATRIX_MASK;
+ if (in.tell() < in.get_tag_end_position())
+ {
+ m_color_transform.read_rgb(in);
+ m_has_flags2 |= HAS_CXFORM_MASK;
+ }
}
+
+ IF_VERBOSE_PARSE
+ (
+ log_parse(_(" PLACEOBJECT: depth=%d(%d) char=%d"),
+ m_depth, m_depth - character::staticDepthOffset,
+ m_character_id);
+ if (hasMatrix()) log_parse(" matrix: %s", m_matrix);
+ if (hasCxform()) log_parse(_(" cxform: %s"), m_color_transform);
+ );
+
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9584: Fix remoting for GC, cleanups, fix support for short PLACEOBJECT tag,
Sandro Santilli <=