[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. 3ddaf5d39bcb038b63ce
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. 3ddaf5d39bcb038b63ce884eafdd61d036e132c6 |
Date: |
Fri, 01 Oct 2010 09:10:28 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via 3ddaf5d39bcb038b63ce884eafdd61d036e132c6 (commit)
via a42722f0c6f4955c37c7223ec2bf1d1b6de00538 (commit)
via f86c8449a6f0e491c5b7fec980144b700751aabc (commit)
via cba5d378ea75b5475ae3997d831ee62a606b69b9 (commit)
via bf4e8690f4c4b55fa18feef0aefb4dd31450a1f2 (commit)
via aed70e3756adbc51c6df92ac32e57ed8fad2798b (commit)
via 98763acd02ed303c9ce199a1c0298fba9ddf6b76 (commit)
via 80442b0e72cf6b362c6891d4b28cf14fb6216ed6 (commit)
via f9a88189fc0189cd545d89bb29dc894b4fc20557 (commit)
via 48bbdb9e103de1234c581aeae9a6bed664632a8a (commit)
via cf2e88435792cdd4d3557b82d80597f65587a9b2 (commit)
from ecbfb67ed6c1bfa97947c380a47fee74b553695f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=3ddaf5d39bcb038b63ce884eafdd61d036e132c6
commit 3ddaf5d39bcb038b63ce884eafdd61d036e132c6
Author: Benjamin Wolsey <address@hidden>
Date: Fri Oct 1 10:26:27 2010 +0200
Add getOwnProperty() to match getMember() and make reducing lookups easier.
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 1b41c4a..23eb5b9 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -455,10 +455,12 @@ public:
/// otherwise (no such trigger exists).
bool unwatch(const ObjectURI& uri);
- /// Get a member as_value by name
+ /// Get a property by name if it exists.
//
- /// NOTE that this method is non-const because accessing a getter/setter
- /// property may modify the object.
+ /// NOTE: accessing a getter/setter property may modify the object.
+ //
+ /// See getMember() for a property accessor that corresponds to
+ /// ActionScript behaviour.
//
/// @param uri Property identifier.
/// @param val Variable to assign an existing value to.
@@ -795,6 +797,8 @@ void sendEvent(as_object& o, const as_environment& env,
const ObjectURI& name);
/// This is a wrapper round as_object::get_member that returns undefined if
/// the member is not found.
//
+/// Note: this is the only full lookup process available in ActionScript code.
+//
//
/// @param uri Property identifier. Note that
/// if you do not care about the namespace (AS2 does not),
@@ -811,6 +815,28 @@ getMember(as_object& o, const ObjectURI& uri)
return ret;
}
+/// Get an own member of an object.
+//
+/// This is a wrapper round as_object::getOwnProperty that returns undefined if
+/// the member is not found.
+//
+/// Note: this requires two steps in ActionScript (hasOwnProperty + lookup), so
+/// is probably only for use in native functions.
+//
+/// @param uri Property identifier. Note that
+/// if you do not care about the namespace (AS2 does not),
+/// you can call this function with the name key only.
+/// @param o The object whose own member is required.
+/// @return Value of the member (possibly undefined),
+/// or undefined if not found. Use get_member if you
+/// need to know whether it was found or not.
+inline as_value
+getOwnProperty(as_object& o, const ObjectURI& prop)
+{
+ Property* p = o.getOwnProperty(prop);
+ return p ? p->getValue(o) : as_value();
+}
+
/// Function objects for visiting properties.
class IsVisible
{
diff --git a/libcore/asobj/Array_as.cpp b/libcore/asobj/Array_as.cpp
index a676d23..31fb5ad 100644
--- a/libcore/asobj/Array_as.cpp
+++ b/libcore/asobj/Array_as.cpp
@@ -634,8 +634,8 @@ public:
assert(ao);
assert(bo);
- const as_value& av = arrayProperty(*ao, _prop);
- const as_value& bv = arrayProperty(*bo, _prop);
+ const as_value& av = getOwnProperty(*ao, _prop);
+ const as_value& bv = getOwnProperty(*bo, _prop);
return _comp(av, bv);
}
@@ -684,8 +684,8 @@ public:
for (Props::iterator pit = _prps.begin(), pend = _prps.end();
pit != pend; ++pit, ++cmp) {
- const as_value& av = arrayProperty(*ao, *pit);
- const as_value& bv = arrayProperty(*bo, *pit);
+ const as_value& av = getOwnProperty(*ao, *pit);
+ const as_value& bv = getOwnProperty(*bo, *pit);
if ((*cmp)(av, bv)) return true;
if ((*cmp)(bv, av)) return false;
@@ -721,8 +721,8 @@ public:
for (Props::iterator pit = _prps.begin(), pend = _prps.end();
pit != pend; ++pit, ++cmp)
{
- const as_value& av = arrayProperty(*ao, *pit);
- const as_value& bv = arrayProperty(*bo, *pit);
+ const as_value& av = getOwnProperty(*ao, *pit);
+ const as_value& bv = getOwnProperty(*bo, *pit);
if (!(*cmp)(av, bv)) return false;
}
@@ -845,13 +845,6 @@ arrayLength(as_object& array)
return size;
}
-as_value
-arrayProperty(as_object& array, const ObjectURI& prop)
-{
- Property* p = array.getOwnProperty(prop);
- return p ? p->getValue(array) : as_value();
-}
-
void
registerArrayNative(as_object& global)
{
@@ -986,7 +979,7 @@ array_splice(const fn_call& fn)
// Push removed elements to the new array.
for (size_t i = 0; i < remove; ++i) {
const size_t key = getKey(fn, start + i);
- callMethod(ret, NSV::PROP_PUSH, arrayProperty(*array, key));
+ callMethod(ret, NSV::PROP_PUSH, getOwnProperty(*array, key));
}
// Shift elements in 'this' array by simple assignment, not delete
@@ -1246,7 +1239,7 @@ array_unshift(const fn_call& fn)
const string_table::key nextkey = getKey(fn, i - shift);
const string_table::key currentkey = getKey(fn, i);
array->delProperty(currentkey);
- array->set_member(currentkey, arrayProperty(*array, nextkey));
+ array->set_member(currentkey, getOwnProperty(*array, nextkey));
}
for (size_t i = shift; i > 0; --i) {
@@ -1270,7 +1263,7 @@ array_pop(const fn_call& fn)
if (size < 1) return as_value();
const string_table::key ind = getKey(fn, size - 1);
- as_value ret = arrayProperty(*array, ind);
+ as_value ret = getOwnProperty(*array, ind);
array->delProperty(ind);
setArrayLength(*array, size - 1);
@@ -1288,13 +1281,13 @@ array_shift(const fn_call& fn)
// An array with no elements has nothing to return.
if (size < 1) return as_value();
- as_value ret = arrayProperty(*array, getKey(fn, 0));
+ as_value ret = getOwnProperty(*array, getKey(fn, 0));
for (size_t i = 0; i < static_cast<size_t>(size - 1); ++i) {
const string_table::key nextkey = getKey(fn, i + 1);
const string_table::key currentkey = getKey(fn, i);
array->delProperty(currentkey);
- array->set_member(currentkey, arrayProperty(*array, nextkey));
+ array->set_member(currentkey, getOwnProperty(*array, nextkey));
}
setArrayLength(*array, size - 1);
@@ -1315,8 +1308,8 @@ array_reverse(const fn_call& fn)
for (size_t i = 0; i < static_cast<size_t>(size) / 2; ++i) {
const string_table::key bottomkey = getKey(fn, i);
const string_table::key topkey = getKey(fn, size - i - 1);
- const as_value top = arrayProperty(*array, topkey);
- const as_value bottom = arrayProperty(*array, bottomkey);
+ const as_value top = getOwnProperty(*array, topkey);
+ const as_value bottom = getOwnProperty(*array, bottomkey);
array->delProperty(topkey);
array->delProperty(bottomkey);
array->set_member(bottomkey, top);
@@ -1465,7 +1458,7 @@ join(as_object* array, const std::string& separator)
for (size_t i = 0; i < size; ++i) {
if (i) s += separator;
const std::string& index = boost::lexical_cast<std::string>(i);
- const as_value& el = arrayProperty(*array, st.find(index));
+ const as_value& el = getOwnProperty(*array, st.find(index));
s += el.to_string(version);
}
return as_value(s);
@@ -1499,7 +1492,7 @@ void foreachArray(as_object& array, int start, int end,
T& pred)
string_table& st = getStringTable(array);
for (size_t i = start; i < static_cast<size_t>(end); ++i) {
- pred(arrayProperty(array, arrayKey(st, i)));
+ pred(getOwnProperty(array, arrayKey(st, i)));
}
}
diff --git a/libcore/asobj/Array_as.h b/libcore/asobj/Array_as.h
index 1ad5203..763a4b3 100644
--- a/libcore/asobj/Array_as.h
+++ b/libcore/asobj/Array_as.h
@@ -28,17 +28,6 @@ namespace gnash {
namespace gnash {
-/// Get an own property of an array, or undefined if it doesn't exist.
-//
-/// Array functions do not search the prototype chain or call __resolve to
-/// find a property. There is no need to use this function directly; it is
-/// here for foreachArray().
-//
-/// @param array The object whose array length is needed.
-/// @param prop The property to find.
-/// @return The value of the property, or undefined if it is not found.
-as_value arrayProperty(as_object& array, const ObjectURI& prop);
-
/// Get the length of an object as though it were an array
//
/// It may well be an array, but this also works on normal objects with a
@@ -94,7 +83,7 @@ void foreachArray(as_object& array, T& pred)
string_table& st = getStringTable(array);
for (size_t i = 0; i < static_cast<size_t>(size); ++i) {
- pred(arrayProperty(array, arrayKey(st, i)));
+ pred(getOwnProperty(array, arrayKey(st, i)));
}
}
http://git.savannah.gnu.org/cgit//commit/?id=a42722f0c6f4955c37c7223ec2bf1d1b6de00538
commit a42722f0c6f4955c37c7223ec2bf1d1b6de00538
Author: Benjamin Wolsey <address@hidden>
Date: Fri Oct 1 10:16:39 2010 +0200
Fix messed up log message.
diff --git a/libcore/asobj/Object.cpp b/libcore/asobj/Object.cpp
index fb88924..932a922 100644
--- a/libcore/asobj/Object.cpp
+++ b/libcore/asobj/Object.cpp
@@ -344,7 +344,7 @@ object_hasOwnProperty(const fn_call& fn)
if ( fn.nargs < 1 )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("hasOwnProperty(Object, ) requires one arg"));
+ log_aserror(_("Object.hasOwnProperty() requires one arg"));
);
return as_value(false);
}
@@ -353,7 +353,7 @@ object_hasOwnProperty(const fn_call& fn)
if (arg.is_undefined() || propname.empty())
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Invalid call to hasOwnProperty(Object, '%s')"), arg);
+ log_aserror(_("Invalid call to Object.hasOwnProperty('%s')"), arg);
);
return as_value(false);
}
http://git.savannah.gnu.org/cgit//commit/?id=f86c8449a6f0e491c5b7fec980144b700751aabc
commit f86c8449a6f0e491c5b7fec980144b700751aabc
Author: Benjamin Wolsey <address@hidden>
Date: Fri Oct 1 10:12:53 2010 +0200
Move trivial wrapper functions out of as_object class.
diff --git a/gui/pythonmod/gnash-view.cpp b/gui/pythonmod/gnash-view.cpp
index 787db2e..b93e7e3 100644
--- a/gui/pythonmod/gnash-view.cpp
+++ b/gui/pythonmod/gnash-view.cpp
@@ -108,8 +108,7 @@ gnash_view_call (GnashView *view, const gchar *func_name,
const gchar *input_dat
gnash::string_table& st = vm.getStringTable();
gnash::as_value obj;
- gnash::as_value func = getObject(view->movie)->getMember(
- st.find(func_name));
+ gnash::as_value func = getMember(*getObject(view->movie),
st.find(func_name));
if( !func.is_function() ) {
return NULL;
diff --git a/libcore/AMFConverter.cpp b/libcore/AMFConverter.cpp
index 6948ca6..9b1693c 100644
--- a/libcore/AMFConverter.cpp
+++ b/libcore/AMFConverter.cpp
@@ -210,7 +210,7 @@ Writer::writeObject(as_object* obj)
as_value elem;
for (size_t i = 0; i < len; ++i) {
- elem = obj->getMember(arrayKey(st, i));
+ elem = getMember(*obj, arrayKey(st, i));
if (!elem.writeAMF0(*this)) {
log_error("Problems serializing strict array "
"member %d=%s", i, elem);
@@ -392,7 +392,7 @@ as_value
Reader::readXML()
{
as_value str = readLongString(_pos, _end);
- as_function* ctor = _global.getMember(NSV::CLASS_XML).to_function();
+ as_function* ctor = getMember(_global, NSV::CLASS_XML).to_function();
as_value xml;
if (ctor) {
@@ -594,7 +594,7 @@ Reader::readDate()
log_debug("amf0 read date: %e", dub);
#endif
- as_function* ctor = _global.getMember(NSV::CLASS_DATE).to_function();
+ as_function* ctor = getMember(_global, NSV::CLASS_DATE).to_function();
VM& vm = getVM(_global);
as_value date;
diff --git a/libcore/Timers.cpp b/libcore/Timers.cpp
index 7209fd5..bfef844 100644
--- a/libcore/Timers.cpp
+++ b/libcore/Timers.cpp
@@ -108,7 +108,7 @@ Timer::execute()
VM& vm = getVM(*_object);
as_value timer_method = _function ? _function :
- _object->getMember(_methodName);
+ getMember(*_object, _methodName);
as_environment env(vm);
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index 8bda519..f560a2f 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -956,19 +956,12 @@ enumerateProperties(as_object& obj,
as_object::SortedPropertyList& to)
}
-
Property*
as_object::getOwnProperty(const ObjectURI& uri)
{
return _members.getProperty(uri);
}
-bool
-as_object::hasOwnProperty(const ObjectURI& uri)
-{
- return getOwnProperty(uri);
-}
-
as_object*
as_object::get_prototype() const
{
@@ -983,14 +976,6 @@ as_object::get_prototype() const
return proto.to_object(getGlobal(*this));
}
-as_value
-as_object::getMember(const ObjectURI& uri)
-{
- as_value ret;
- get_member(uri, &ret);
- return ret;
-}
-
as_object*
as_object::get_path_element(const ObjectURI& uri)
{
@@ -1153,9 +1138,9 @@ sendEvent(as_object& o, const as_environment& env, const
ObjectURI& name)
as_object*
getObjectWithPrototype(Global_as& gl, string_table::key c)
{
- as_object* ctor = gl.getMember(c).to_object(gl);
+ as_object* ctor = getMember(gl, c).to_object(gl);
as_object* proto = ctor ?
- ctor->getMember(NSV::PROP_PROTOTYPE).to_object(gl) : 0;
+ getMember(*ctor, NSV::PROP_PROTOTYPE).to_object(gl) : 0;
as_object* o = gl.createObject();
o->set_prototype(proto ? proto : as_value());
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 2bc8b5d..1b41c4a 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -485,21 +485,6 @@ public:
virtual as_object* get_super(const ObjectURI& fname);
as_object* get_super();
- /// Get a member as_value by name in an AS-compatible way
- //
- /// NOTE that this method is non-const becase a property
- /// could also be a getter/setter and we can't promise
- /// that the 'getter' won't change this object trough
- /// use of the 'this' reference.
- //
- /// @param uri Property identifier. Note that
- /// if you do not care about the namespace (AS2 does not),
- /// you can call this function with the name key only.
- /// @return Value of the member (possibly undefined),
- /// or undefined if not found. Use get_member if you
- /// need to know whether it was found or not.
- as_value getMember(const ObjectURI& uri);
-
/// Delete a property of this object, unless protected from deletion.
//
/// This function does *not* recurse in this object's prototype.
@@ -527,15 +512,6 @@ public:
/// contain the named property.
Property* getOwnProperty(const ObjectURI& uri);
- /// Return true if this object has the named property
- //
- /// @param uri Name and namespace of the property. Note that
- /// if you do not care about the namespace (AS2 does not),
- /// you can call this function with the name key only.
- ///
- /// @return true if the object has the property, false otherwise.
- bool hasOwnProperty(const ObjectURI& uri);
-
/// Set member flags (probably used by ASSetPropFlags)
//
/// @param name Name of the property. Must be all lowercase
@@ -727,7 +703,6 @@ protected:
/// @param vm The VM to associate the newly created as_object with.
explicit as_object(VM& vm);
-
/// Mark all reachable resources, override from GcResource.
//
/// The default implementation marks all properties
@@ -815,6 +790,27 @@ private:
/// @param name The name of the function to call.
void sendEvent(as_object& o, const as_environment& env, const ObjectURI& name);
+/// Get a member of an object using AS lookup rules
+//
+/// This is a wrapper round as_object::get_member that returns undefined if
+/// the member is not found.
+//
+//
+/// @param uri Property identifier. Note that
+/// if you do not care about the namespace (AS2 does not),
+/// you can call this function with the name key only.
+/// @param o The object whose member is required.
+/// @return Value of the member (possibly undefined),
+/// or undefined if not found. Use get_member if you
+/// need to know whether it was found or not.
+inline as_value
+getMember(as_object& o, const ObjectURI& uri)
+{
+ as_value ret;
+ o.get_member(uri, &ret);
+ return ret;
+}
+
/// Function objects for visiting properties.
class IsVisible
{
@@ -871,6 +867,20 @@ get(as_object* o)
return dynamic_cast<T*>(o->displayObject());
}
+/// Return true if this object has the named property
+//
+/// @param o The object whose property should be searched for.
+/// @param uri Name and namespace of the property. Note that
+/// if you do not care about the namespace (AS2 does not),
+/// you can call this function with the name key only.
+///
+/// @return true if the object has the property, false otherwise.
+inline bool
+hasOwnProperty(as_object& o, const ObjectURI& uri)
+{
+ return (o.getOwnProperty(uri));
+}
+
as_object* getObjectWithPrototype(Global_as& gl, string_table::key c);
/// Check whether the object is an instance of a known type.
diff --git a/libcore/asobj/ASConversions.cpp b/libcore/asobj/ASConversions.cpp
index 9e62af2..ff2bba1 100644
--- a/libcore/asobj/ASConversions.cpp
+++ b/libcore/asobj/ASConversions.cpp
@@ -45,13 +45,13 @@ SWFMatrix
toSWFMatrix(as_object& m)
{
// This is case sensitive.
- if (m.getMember(NSV::PROP_MATRIX_TYPE).to_string() == "box") {
+ if (getMember(m, NSV::PROP_MATRIX_TYPE).to_string() == "box") {
- const double x = pixelsToTwips(m.getMember(NSV::PROP_X).to_number());
- const double y = pixelsToTwips(m.getMember(NSV::PROP_Y).to_number());
- const double w = pixelsToTwips(m.getMember(NSV::PROP_W).to_number());
- const double h = pixelsToTwips(m.getMember(NSV::PROP_H).to_number());
- const double r = m.getMember(NSV::PROP_R).to_number();
+ const double x = pixelsToTwips(getMember(m, NSV::PROP_X).to_number());
+ const double y = pixelsToTwips(getMember(m, NSV::PROP_Y).to_number());
+ const double w = pixelsToTwips(getMember(m, NSV::PROP_W).to_number());
+ const double h = pixelsToTwips(getMember(m, NSV::PROP_H).to_number());
+ const double r = getMember(m, NSV::PROP_R).to_number();
const double a = std::cos(r) * w * 2;
const double b = std::sin(r) * h * 2;
const double c = -std::sin(r) * w * 2;
@@ -63,18 +63,18 @@ toSWFMatrix(as_object& m)
// Convert input matrix to SWFMatrix.
const boost::int32_t a = truncateWithFactor<65536>(
- m.getMember(NSV::PROP_A).to_number());
+ getMember(m, NSV::PROP_A).to_number());
const boost::int32_t b = truncateWithFactor<65536>(
- m.getMember(NSV::PROP_B).to_number());
+ getMember(m, NSV::PROP_B).to_number());
const boost::int32_t c = truncateWithFactor<65536>(
- m.getMember(NSV::PROP_C).to_number());
+ getMember(m, NSV::PROP_C).to_number());
const boost::int32_t d = truncateWithFactor<65536>(
- m.getMember(NSV::PROP_D).to_number());
+ getMember(m, NSV::PROP_D).to_number());
const boost::int32_t tx = pixelsToTwips(
- m.getMember(NSV::PROP_TX).to_number());
+ getMember(m, NSV::PROP_TX).to_number());
const boost::int32_t ty = pixelsToTwips(
- m.getMember(NSV::PROP_TY).to_number());
+ getMember(m, NSV::PROP_TY).to_number());
return SWFMatrix(a, b, c, d, tx, ty);
}
diff --git a/libcore/asobj/Accessibility_as.cpp
b/libcore/asobj/Accessibility_as.cpp
index 654bda6..0e98a93 100644
--- a/libcore/asobj/Accessibility_as.cpp
+++ b/libcore/asobj/Accessibility_as.cpp
@@ -50,7 +50,7 @@ accessibility_class_init(as_object& where, const ObjectURI&
uri)
// This object has unusual properties.
as_object* obj = gl.createObject();
obj->set_member_flags(NSV::PROP_uuPROTOuu, flags);
- obj->init_member(NSV::PROP_CONSTRUCTOR, gl.getMember(NSV::CLASS_OBJECT),
+ obj->init_member(NSV::PROP_CONSTRUCTOR, getMember(gl, NSV::CLASS_OBJECT),
flags);
attachAccessibilityStaticInterface(*obj);
diff --git a/libcore/asobj/AsBroadcaster.cpp b/libcore/asobj/AsBroadcaster.cpp
index 6dc36f2..92053db 100644
--- a/libcore/asobj/AsBroadcaster.cpp
+++ b/libcore/asobj/AsBroadcaster.cpp
@@ -149,7 +149,7 @@ AsBroadcaster::initialize(as_object& o)
// Find _global.AsBroadcaster.
as_object* asb =
- gl.getMember(NSV::CLASS_AS_BROADCASTER).to_object(gl);
+ getMember(gl, NSV::CLASS_AS_BROADCASTER).to_object(gl);
// If it's not an object, these are left undefined, but they are
// always attached to the initialized object.
@@ -158,8 +158,8 @@ AsBroadcaster::initialize(as_object& o)
const int flags = as_object::DefaultFlags;
if (asb) {
- al = asb->getMember(NSV::PROP_ADD_LISTENER);
- rl = asb->getMember(NSV::PROP_REMOVE_LISTENER);
+ al = getMember(*asb, NSV::PROP_ADD_LISTENER);
+ rl = getMember(*asb, NSV::PROP_REMOVE_LISTENER);
}
o.set_member(NSV::PROP_ADD_LISTENER, al);
@@ -358,14 +358,14 @@ asbroadcaster_removeListener(const fn_call& fn)
// This is an ActionScript-like implementation, which is why it looks
// like poor C++.
- const int length = toInt(listeners->getMember(NSV::PROP_LENGTH));
+ const int length = toInt(getMember(*listeners, NSV::PROP_LENGTH));
int i = 0;
string_table& st = getStringTable(fn);
while (i < length) {
std::ostringstream s;
s << i;
- as_value el = listeners->getMember(st.find(s.str()));
+ as_value el = getMember(*listeners, st.find(s.str()));
if (el.equals(listenerToRemove)) {
callMethod(listeners, NSV::PROP_SPLICE, s.str(), 1);
return as_value(true);
diff --git a/libcore/asobj/Camera_as.cpp b/libcore/asobj/Camera_as.cpp
index 1332b46..c7d7984 100644
--- a/libcore/asobj/Camera_as.cpp
+++ b/libcore/asobj/Camera_as.cpp
@@ -247,7 +247,7 @@ camera_get(const fn_call& fn)
// Properties are attached to the prototype (not __proto__) when get() is
// called.
as_object* proto =
- ptr->getMember(NSV::PROP_PROTOTYPE).to_object(getGlobal(fn));
+ getMember(*ptr, NSV::PROP_PROTOTYPE).to_object(getGlobal(fn));
attachCameraProperties(*proto);
diff --git a/libcore/asobj/Color_as.cpp b/libcore/asobj/Color_as.cpp
index b794153..a910231 100644
--- a/libcore/asobj/Color_as.cpp
+++ b/libcore/asobj/Color_as.cpp
@@ -69,7 +69,7 @@ color_class_init(as_object& where, const ObjectURI& uri)
attachColorInterface, 0, uri);
as_object* proto =
- cl->getMember(NSV::PROP_PROTOTYPE).to_object(getGlobal(where));
+ getMember(*cl, NSV::PROP_PROTOTYPE).to_object(getGlobal(where));
if (!proto) return;
@@ -272,7 +272,7 @@ parseColorTransProp (as_object& obj, string_table::key key,
boost::int16_t&
inline MovieClip*
getTarget(as_object* obj, const fn_call& fn)
{
- const as_value& target = obj->getMember(NSV::PROP_TARGET);
+ const as_value& target = getMember(*obj, NSV::PROP_TARGET);
MovieClip* sp = target.toMovieClip();
if (sp) return sp;
DisplayObject* o = fn.env().find_target(target.to_string());
diff --git a/libcore/asobj/ContextMenuItem_as.cpp
b/libcore/asobj/ContextMenuItem_as.cpp
index 1d60d41..8e56424 100644
--- a/libcore/asobj/ContextMenuItem_as.cpp
+++ b/libcore/asobj/ContextMenuItem_as.cpp
@@ -66,16 +66,16 @@ contextmenuitem_copy(const fn_call& fn)
string_table& st = getStringTable(fn);
as_function* ctor =
- gl.getMember(st.find("ContextMenuItem")).to_function();
+ getMember(gl, st.find("ContextMenuItem")).to_function();
if (!ctor) return as_value();
fn_call::Args args;
- args += ptr->getMember(st.find("caption")),
- ptr->getMember(NSV::PROP_ON_SELECT),
- ptr->getMember(st.find("separatorBefore")),
- ptr->getMember(NSV::PROP_ENABLED),
- ptr->getMember(st.find("visible"));
+ args += getMember(*ptr, st.find("caption")),
+ getMember(*ptr, NSV::PROP_ON_SELECT),
+ getMember(*ptr, st.find("separatorBefore")),
+ getMember(*ptr, NSV::PROP_ENABLED),
+ getMember(*ptr, st.find("visible"));
return constructInstance(*ctor, fn.env(), args);
}
diff --git a/libcore/asobj/ContextMenu_as.cpp b/libcore/asobj/ContextMenu_as.cpp
index b539f91..19e122e 100644
--- a/libcore/asobj/ContextMenu_as.cpp
+++ b/libcore/asobj/ContextMenu_as.cpp
@@ -123,7 +123,7 @@ contextmenu_copy(const fn_call& fn)
Global_as& gl = getGlobal(fn);
- as_function* ctor = gl.getMember(NSV::CLASS_CONTEXTMENU).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_CONTEXTMENU).to_function();
if (!ctor) {
return as_value();
}
diff --git a/libcore/asobj/Date_as.cpp b/libcore/asobj/Date_as.cpp
index f58900e..96209d4 100644
--- a/libcore/asobj/Date_as.cpp
+++ b/libcore/asobj/Date_as.cpp
@@ -377,7 +377,7 @@ attachDateInterface(as_object& o)
o.init_member("setUTCMilliseconds", vm.getNative(103, 143));
string_table& st = getStringTable(o);
- o.init_member("valueOf", o.getMember(st.find("getTime")));
+ o.init_member("valueOf", getMember(o, st.find("getTime")));
}
@@ -413,7 +413,7 @@ date_new(const fn_call& fn)
// date.
if (!fn.isInstantiation()) {
Global_as& gl = getGlobal(fn);
- as_function* ctor = gl.getMember(NSV::CLASS_DATE).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_DATE).to_function();
if (!ctor) return as_value();
fn_call::Args args;
return constructInstance(*ctor, fn.env(), args);
diff --git a/libcore/asobj/Globals.cpp b/libcore/asobj/Globals.cpp
index b58aca9..dbf1f8b 100644
--- a/libcore/asobj/Globals.cpp
+++ b/libcore/asobj/Globals.cpp
@@ -208,13 +208,13 @@ AVM1Global::createArray()
{
as_object* array = new as_object(*this);
- as_value ctor = getMember(NSV::CLASS_ARRAY);
+ as_value ctor = getMember(*this, NSV::CLASS_ARRAY);
as_object* obj = ctor.to_object(*this);
if (obj) {
as_value proto;
if (obj->get_member(NSV::PROP_PROTOTYPE, &proto)) {
array->init_member(NSV::PROP_CONSTRUCTOR, ctor);
- array->set_prototype(obj->getMember(NSV::PROP_PROTOTYPE));
+ array->set_prototype(getMember(*obj, NSV::PROP_PROTOTYPE));
}
}
@@ -292,7 +292,7 @@ AVM1Global::registerClasses()
init_member("showRedrawRegions", vm.getNative(1021, 1));
string_table& st = getStringTable(*this);
- init_member("clearTimeout", getMember(st.find("clearInterval")));
+ init_member("clearTimeout", getMember(*this, st.find("clearInterval")));
_classes.declareAll(avm1Classes());
@@ -964,7 +964,7 @@ global_assetuperror(const fn_call& fn)
string_table& st = getStringTable(fn);
- as_function* ctor = gl.getMember(NSV::CLASS_ERROR).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_ERROR).to_function();
if (ctor) {
fn_call::Args args;
as_object* proto = constructInstance(*ctor, fn.env(), args);
diff --git a/libcore/asobj/LocalConnection_as.cpp
b/libcore/asobj/LocalConnection_as.cpp
index c24d96f..4e6f1df 100644
--- a/libcore/asobj/LocalConnection_as.cpp
+++ b/libcore/asobj/LocalConnection_as.cpp
@@ -896,7 +896,7 @@ executeAMFFunction(as_object& o, amf::Reader& rd)
// Call the method on this LocalConnection object.
string_table& st = getStringTable(o);
- as_function* f = o.getMember(st.find(meth)).to_function();
+ as_function* f = getMember(o, st.find(meth)).to_function();
invoke(f, as_environment(getVM(o)), &o, args);
}
diff --git a/libcore/asobj/Microphone_as.cpp b/libcore/asobj/Microphone_as.cpp
index 4840aa8..7bc817b 100644
--- a/libcore/asobj/Microphone_as.cpp
+++ b/libcore/asobj/Microphone_as.cpp
@@ -247,7 +247,7 @@ microphone_get(const fn_call& fn)
// Properties are attached to the prototype (not __proto__) when get() is
// called.
- as_object* proto =
ptr->getMember(NSV::PROP_PROTOTYPE).to_object(getGlobal(fn));
+ as_object* proto = getMember(*ptr,
NSV::PROP_PROTOTYPE).to_object(getGlobal(fn));
attachMicrophoneProperties(*proto);
// TODO: this should return the same object when the same device is
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index ee69ce1..dd6c1a9 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -1808,11 +1808,11 @@ movieclip_beginGradientFill(const fn_call& fn)
string_table::key key = st.find(boost::lexical_cast<std::string>(i));
- as_value colVal = colors->getMember(key);
+ as_value colVal = getMember(*colors, key);
boost::uint32_t col = colVal.is_number() ? toInt(colVal) : 0;
/// Alpha is the range 0..100.
- as_value alpVal = alphas->getMember(key);
+ as_value alpVal = getMember(*alphas, key);
const double a = alpVal.is_number() ?
clamp<double>(alpVal.to_number(), 0, 100) : 0;
const boost::uint8_t alp = 0xff * (a / 100);
@@ -1825,7 +1825,7 @@ movieclip_beginGradientFill(const fn_call& fn)
// From looking it looks like the minimum adjustment is 2. Even
// steps of 1 appear to be adjusted.
const int step = 2;
- const as_value& ratVal = ratios->getMember(key);
+ const as_value& ratVal = getMember(*ratios, key);
const boost::uint32_t minRatio =
gradients.empty() ? 0 :
std::min<boost::uint32_t>(gradients[i - 1].ratio + step, 0xff);
diff --git a/libcore/asobj/Object.cpp b/libcore/asobj/Object.cpp
index 38ef6d5..fb88924 100644
--- a/libcore/asobj/Object.cpp
+++ b/libcore/asobj/Object.cpp
@@ -344,7 +344,7 @@ object_hasOwnProperty(const fn_call& fn)
if ( fn.nargs < 1 )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Object.hasOwnProperty() requires one arg"));
+ log_aserror(_("hasOwnProperty(Object, ) requires one arg"));
);
return as_value(false);
}
@@ -353,12 +353,12 @@ object_hasOwnProperty(const fn_call& fn)
if (arg.is_undefined() || propname.empty())
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("Invalid call to Object.hasOwnProperty('%s')"), arg);
+ log_aserror(_("Invalid call to hasOwnProperty(Object, '%s')"), arg);
);
return as_value(false);
}
- const bool found = obj->hasOwnProperty(getStringTable(fn).find(propname));
+ const bool found = hasOwnProperty(*obj, getStringTable(fn).find(propname));
return as_value(found);
}
diff --git a/libcore/asobj/SharedObject_as.cpp
b/libcore/asobj/SharedObject_as.cpp
index be8ca96..8bec63b 100644
--- a/libcore/asobj/SharedObject_as.cpp
+++ b/libcore/asobj/SharedObject_as.cpp
@@ -1005,7 +1005,7 @@ flushSOL(SharedObjectLibrary::SoLib::value_type& sol)
SharedObject_as*
createSharedObject(Global_as& gl)
{
- as_function* ctor = gl.getMember(NSV::CLASS_SHARED_OBJECT).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_SHARED_OBJECT).to_function();
if (!ctor) return 0;
as_environment env(getVM(gl));
fn_call::Args args;
diff --git a/libcore/asobj/TextField_as.cpp b/libcore/asobj/TextField_as.cpp
index d443708..078ff0d 100644
--- a/libcore/asobj/TextField_as.cpp
+++ b/libcore/asobj/TextField_as.cpp
@@ -90,7 +90,7 @@ namespace {
as_object*
createTextFieldObject(Global_as& gl)
{
- as_value tf(gl.getMember(NSV::CLASS_TEXT_FIELD));
+ as_value tf(getMember(gl, NSV::CLASS_TEXT_FIELD));
as_function* ctor = tf.to_function();
if (!ctor) return 0;
fn_call::Args args;
@@ -624,7 +624,7 @@ textfield_getTextFormat(const fn_call& fn)
TextField* text = ensure<IsDisplayObject<TextField> >(fn);
Global_as& gl = getGlobal(fn);
- as_function* ctor = gl.getMember(NSV::CLASS_TEXT_FORMAT).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_TEXT_FORMAT).to_function();
if (!ctor) return as_value();
diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index 9113f60..86b2213 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -124,9 +124,9 @@ XMLNode_as::object()
if (!_object) {
as_object* o = _global.createObject();
as_object* xn =
- _global.getMember(NSV::CLASS_XMLNODE).to_object(_global);
+ getMember(_global, NSV::CLASS_XMLNODE).to_object(_global);
if (xn) {
- o->set_prototype(xn->getMember(NSV::PROP_PROTOTYPE));
+ o->set_prototype(getMember(*xn, NSV::PROP_PROTOTYPE));
o->init_member(NSV::PROP_CONSTRUCTOR, xn);
}
o->setRelay(this);
diff --git a/libcore/asobj/XMLSocket_as.cpp b/libcore/asobj/XMLSocket_as.cpp
index da32d20..31d5b08 100644
--- a/libcore/asobj/XMLSocket_as.cpp
+++ b/libcore/asobj/XMLSocket_as.cpp
@@ -403,7 +403,7 @@ xmlsocket_onData(const fn_call& fn)
Global_as& gl = getGlobal(fn);
- as_function* ctor = gl.getMember(NSV::CLASS_XML).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_XML).to_function();
fn_call::Args args;
args += xmlin;
diff --git a/libcore/asobj/XML_as.cpp b/libcore/asobj/XML_as.cpp
index 8b096cb..a199948 100644
--- a/libcore/asobj/XML_as.cpp
+++ b/libcore/asobj/XML_as.cpp
@@ -537,7 +537,7 @@ xml_class_init(as_object& where, const ObjectURI& uri)
Global_as& gl = getGlobal(where);
as_object* cl = gl.createClass(&xml_new, 0);
- as_function* ctor = gl.getMember(NSV::CLASS_XMLNODE).to_function();
+ as_function* ctor = getMember(gl, NSV::CLASS_XMLNODE).to_function();
if (ctor) {
// XML.prototype is an XMLNode(1, "");
diff --git a/libcore/asobj/flash/display/BitmapData_as.cpp
b/libcore/asobj/flash/display/BitmapData_as.cpp
index a98be30..f4fc295 100644
--- a/libcore/asobj/flash/display/BitmapData_as.cpp
+++ b/libcore/asobj/flash/display/BitmapData_as.cpp
@@ -384,7 +384,7 @@ bitmapdata_clone(const fn_call& fn)
Global_as& gl = getGlobal(fn);
as_object* ret = gl.createObject();
- const as_value& proto = obj->getMember(NSV::PROP_uuPROTOuu);
+ const as_value& proto = getMember(*obj, NSV::PROP_uuPROTOuu);
if (proto.is_object()) {
ret->set_member(NSV::PROP_uuPROTOuu, proto);
}
@@ -846,7 +846,7 @@ bitmapdata_loadBitmap(const fn_call& fn)
// The properties come from the 'this' object.
Global_as& gl = getGlobal(fn);
as_object* ret = gl.createObject();
- ret->set_member(NSV::PROP_uuPROTOuu, ptr->getMember(NSV::PROP_PROTOTYPE));
+ ret->set_member(NSV::PROP_uuPROTOuu, getMember(*ptr, NSV::PROP_PROTOTYPE));
newImage->update(im.begin());
ret->setRelay(new BitmapData_as(ret, newImage));
diff --git a/libcore/asobj/flash/filters/BitmapFilter_as.cpp
b/libcore/asobj/flash/filters/BitmapFilter_as.cpp
index 2885b29..b48d093 100644
--- a/libcore/asobj/flash/filters/BitmapFilter_as.cpp
+++ b/libcore/asobj/flash/filters/BitmapFilter_as.cpp
@@ -79,7 +79,7 @@ registerBitmapClass(as_object& where, Global_as::ASFunction
ctor,
// it, so entering infinite recursion, we'll cheat and assume that
// the object 'where' is the filters package.
as_function* constructor =
- where.getMember(st.find("BitmapFilter")).to_function();
+ getMember(where, st.find("BitmapFilter")).to_function();
as_object* proto;
if (constructor) {
diff --git a/libcore/asobj/flash/geom/ColorTransform_as.cpp
b/libcore/asobj/flash/geom/ColorTransform_as.cpp
index b926e2b..4df58ae 100644
--- a/libcore/asobj/flash/geom/ColorTransform_as.cpp
+++ b/libcore/asobj/flash/geom/ColorTransform_as.cpp
@@ -280,14 +280,14 @@ colortransform_toString(const fn_call& fn)
string_table& st = getStringTable(fn);
- const as_value& am = ptr->getMember(st.find("alphaMultiplier"));
- const as_value& ao = ptr->getMember(st.find("alphaOffset"));
- const as_value& bm = ptr->getMember(st.find("blueMultiplier"));
- const as_value& bo = ptr->getMember(st.find("blueOffset"));
- const as_value& gm = ptr->getMember(st.find("greenMultiplier"));
- const as_value& go = ptr->getMember(st.find("greenOffset"));
- const as_value& rm = ptr->getMember(st.find("redMultiplier"));
- const as_value& ro = ptr->getMember(st.find("redOffset"));
+ const as_value& am = getMember(*ptr, st.find("alphaMultiplier"));
+ const as_value& ao = getMember(*ptr, st.find("alphaOffset"));
+ const as_value& bm = getMember(*ptr, st.find("blueMultiplier"));
+ const as_value& bo = getMember(*ptr, st.find("blueOffset"));
+ const as_value& gm = getMember(*ptr, st.find("greenMultiplier"));
+ const as_value& go = getMember(*ptr, st.find("greenOffset"));
+ const as_value& rm = getMember(*ptr, st.find("redMultiplier"));
+ const as_value& ro = getMember(*ptr, st.find("redOffset"));
VM& vm = getVM(fn);
diff --git a/libcore/parser/sprite_definition.cpp
b/libcore/parser/sprite_definition.cpp
index 2eb2261..824632d 100644
--- a/libcore/parser/sprite_definition.cpp
+++ b/libcore/parser/sprite_definition.cpp
@@ -140,7 +140,7 @@ sprite_definition::registerClass(as_function* the_class)
log_debug(_("Registered class %p for sprite_def %p"),
(void*)registeredClass.get(), (void*)this);
as_object* proto =
- registeredClass->getMember(NSV::PROP_PROTOTYPE).to_object(
+ getMember(*registeredClass, NSV::PROP_PROTOTYPE).to_object(
getGlobal(*registeredClass));
log_debug(_(" Exported interface: "));
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index 8d1917c..c57023d 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -2517,7 +2517,7 @@ ActionInitObject(ActionExec& thread)
Global_as& gl = getGlobal(env);
as_object* obj = gl.createObject();
- obj->init_member(NSV::PROP_CONSTRUCTOR, gl.getMember(NSV::CLASS_OBJECT));
+ obj->init_member(NSV::PROP_CONSTRUCTOR, getMember(gl, NSV::CLASS_OBJECT));
string_table& st = getStringTable(env);
@@ -3252,7 +3252,7 @@ ActionExtends(ActionExec& thread)
env.drop(2);
as_object* newproto = new as_object(gl);
- as_object* p = super->getMember(NSV::PROP_PROTOTYPE).to_object(gl);
+ as_object* p = getMember(*super, NSV::PROP_PROTOTYPE).to_object(gl);
newproto->set_prototype(p);
if (getSWFVersion(*super) > 5) {
diff --git a/libcore/vm/CallStack.cpp b/libcore/vm/CallStack.cpp
index 96f0817..07df061 100644
--- a/libcore/vm/CallStack.cpp
+++ b/libcore/vm/CallStack.cpp
@@ -72,7 +72,7 @@ void
declareLocal(CallFrame& c, string_table::key name)
{
as_object& locals = c.locals();
- if (!locals.hasOwnProperty(name)) {
+ if (!hasOwnProperty(locals, name)) {
locals.set_member(name, as_value());
}
}
diff --git a/libcore/vm/Machine.cpp b/libcore/vm/Machine.cpp
index fd975f9..af7de15 100644
--- a/libcore/vm/Machine.cpp
+++ b/libcore/vm/Machine.cpp
@@ -1441,7 +1441,7 @@ Machine::execute()
else {
as_value property =
- object->getMember(a.getGlobalName());
+ getMember(*object, a.getGlobalName());
if (!property.is_undefined() && !property.is_null()) {
log_abc("Calling method %s on object %s",
@@ -1552,7 +1552,7 @@ Machine::execute()
throw ASException();
}
- as_value c = super->getMember(NSV::PROP_CONSTRUCTOR);
+ as_value c = getMember(*super, NSV::PROP_CONSTRUCTOR);
pushCall(c.to_function(), super, mIgnoreReturn,
argc, -1);
break;
@@ -1596,7 +1596,7 @@ Machine::execute()
string_table::key ns = a.getNamespace() ?
a.getNamespace()->getURI() : 0;
- as_value c = object->getMember(
+ as_value c = getMember(*object,
ObjectURI(a.getGlobalName(), ns));
// TODO: don't do this. Scriptes should not be functions;
http://git.savannah.gnu.org/cgit//commit/?id=cba5d378ea75b5475ae3997d831ee62a606b69b9
commit cba5d378ea75b5475ae3997d831ee62a606b69b9
Author: Benjamin Wolsey <address@hidden>
Date: Fri Oct 1 09:13:10 2010 +0200
Use default (integer) rasterizer.
diff --git a/librender/Renderer_agg.cpp b/librender/Renderer_agg.cpp
index 3b05a94..32b99cd 100644
--- a/librender/Renderer_agg.cpp
+++ b/librender/Renderer_agg.cpp
@@ -1502,7 +1502,7 @@ public:
// Target renderer
renderer_base& rbase = *m_rbase;
- typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl> ras_type;
+ typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_int> ras_type;
ras_type rasc; // flash-like renderer
agg::renderer_scanline_aa_solid<
@@ -1616,7 +1616,7 @@ public:
sh_type sh;
// compound rasterizer used for flash shapes
- typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl>
rasc_type;
+ typedef agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_int> rasc_type;
rasc_type rasc;
diff --git a/librender/Renderer_agg_style.h b/librender/Renderer_agg_style.h
index b11733c..5b31868 100644
--- a/librender/Renderer_agg_style.h
+++ b/librender/Renderer_agg_style.h
@@ -355,11 +355,6 @@ public:
m_interpolator(m_tr),
m_sg(m_img_src, m_interpolator)
{
-
- // Convert the transformation SWFMatrix to AGG's class. It's basically the
- // same and we could even use SWFMatrix since AGG does not require
- // a real AGG descendant (templates!). However, it's better to use AGG's
- // class as this should be faster (avoid type conversion).
}
virtual ~BitmapStyle() {
http://git.savannah.gnu.org/cgit//commit/?id=bf4e8690f4c4b55fa18feef0aefb4dd31450a1f2
commit bf4e8690f4c4b55fa18feef0aefb4dd31450a1f2
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 17:21:01 2010 +0200
Inline Property::setReachable.
diff --git a/libcore/Property.cpp b/libcore/Property.cpp
index e7b55e4..4bfef61 100644
--- a/libcore/Property.cpp
+++ b/libcore/Property.cpp
@@ -58,17 +58,6 @@ struct SetCache : boost::static_visitor<>
}
};
-/// Mark the stored value reachable.
-struct SetReachable : boost::static_visitor<>
-{
- result_type operator()(const as_value& val) const {
- val.setReachable();
- }
- result_type operator()(const GetterSetter& gs) const {
- return gs.markReachableResources();
- }
-};
-
}
void
@@ -105,12 +94,6 @@ GetterSetter::UserDefinedGetterSetter::set(const fn_call&
fn)
_setter->call(fn);
}
-void
-Property::setReachable() const
-{
- return boost::apply_visitor(SetReachable(), _bound);
-}
-
as_value
Property::getValue(const as_object& this_ptr) const
{
diff --git a/libcore/Property.h b/libcore/Property.h
index 43f76a5..f5eead3 100644
--- a/libcore/Property.h
+++ b/libcore/Property.h
@@ -273,6 +273,18 @@ private:
/// changed.
class Property
{
+
+ /// Mark the stored value reachable.
+ struct SetReachable : boost::static_visitor<>
+ {
+ result_type operator()(const as_value& val) const {
+ val.setReachable();
+ }
+ result_type operator()(const GetterSetter& gs) const {
+ return gs.markReachableResources();
+ }
+ };
+
public:
Property(const ObjectURI& uri, const as_value& value,
@@ -381,7 +393,9 @@ public:
}
/// Mark this property as being reachable (for the GC)
- void setReachable() const;
+ void setReachable() const {
+ return boost::apply_visitor(SetReachable(), _bound);
+ }
private:
http://git.savannah.gnu.org/cgit//commit/?id=aed70e3756adbc51c6df92ac32e57ed8fad2798b
commit aed70e3756adbc51c6df92ac32e57ed8fad2798b
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 17:11:16 2010 +0200
Inline PropertyList::markReachableResources.
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index 95df428..90ab76a 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -338,12 +338,5 @@ PropertyList::clear()
_props.clear();
}
-void
-PropertyList::setReachable() const
-{
- std::for_each(_props.begin(), _props.end(),
- boost::mem_fn(&Property::setReachable));
-}
-
} // namespace gnash
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 61a78ad..6717ee5 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -19,8 +19,6 @@
#ifndef GNASH_PROPERTYLIST_H
#define GNASH_PROPERTYLIST_H
-#include "Property.h" // for templated functions
-
#include <set>
#include <map>
#include <string> // for use within map
@@ -32,6 +30,10 @@
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/key_extractors.hpp>
#include <boost/noncopyable.hpp>
+#include <boost/bind.hpp>
+#include <algorithm>
+
+#include "Property.h" // for templated functions
// Forward declaration
namespace gnash {
@@ -279,9 +281,14 @@ public:
///
void dump(std::map<std::string, as_value>& to);
- /// Mark all simple properties, getters and setters
- /// as being reachable (for the GC)
- void setReachable() const;
+ /// Mark all properties reachable
+ //
+ /// This can be called very frequently, so is inlined to allow the
+ /// compiler to optimize it.
+ void setReachable() const {
+ std::for_each(_props.begin(), _props.end(),
+ boost::mem_fn(&Property::setReachable));
+ }
private:
http://git.savannah.gnu.org/cgit//commit/?id=98763acd02ed303c9ce199a1c0298fba9ddf6b76
commit 98763acd02ed303c9ce199a1c0298fba9ddf6b76
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 16:39:50 2010 +0200
Inline trivial functions.
diff --git a/libcore/as_value.cpp b/libcore/as_value.cpp
index d84d762..3c9279a 100644
--- a/libcore/as_value.cpp
+++ b/libcore/as_value.cpp
@@ -246,29 +246,6 @@ as_value::to_string(int version) const
}
-/// This is only used in AVM2.
-primitive_types
-as_value::ptype() const
-{
-
- switch (_type)
- {
- case STRING:
- return PTYPE_STRING;
- case NUMBER:
- case UNDEFINED:
- case NULLTYPE:
- case DISPLAYOBJECT:
- case OBJECT:
- return PTYPE_NUMBER;
- case BOOLEAN:
- return PTYPE_BOOLEAN;
- default:
- break;
- }
- return PTYPE_NUMBER;
-}
-
as_value::AsType
as_value::defaultPrimitive(int version) const
{
@@ -757,13 +734,6 @@ as_value::toDebugString() const
}
void
-as_value::operator=(const as_value& v)
-{
- _type = v._type;
- _value = v._value;
-}
-
-void
as_value::setReachable() const
{
switch (_type)
@@ -825,34 +795,6 @@ as_value::set_bool(bool val)
_value = val;
}
-as_value::as_value(const char* str)
- :
- _type(STRING),
- _value(std::string(str))
-{
-}
-
-as_value::as_value(const std::string& str)
- :
- _type(STRING),
- _value(str)
-{
-}
-
-as_value::as_value(double num)
- :
- _type(NUMBER),
- _value(num)
-{
-}
-
-as_value::as_value(as_object* obj)
- :
- _type(UNDEFINED)
-{
- set_as_object(obj);
-}
-
bool
as_value::is_function() const
{
diff --git a/libcore/as_value.h b/libcore/as_value.h
index dc55333..b9d62cd 100644
--- a/libcore/as_value.h
+++ b/libcore/as_value.h
@@ -146,8 +146,18 @@ public:
~as_value() {}
/// Construct a primitive String value
- DSOEXPORT as_value(const char* str);
- DSOEXPORT as_value(const std::string& str);
+ DSOEXPORT as_value(const char* str)
+ :
+ _type(STRING),
+ _value(std::string(str))
+ {}
+
+ /// Construct a primitive String value
+ DSOEXPORT as_value(const std::string& str)
+ :
+ _type(STRING),
+ _value(std::string(str))
+ {}
/// Construct a primitive Boolean value
template <typename T>
@@ -161,19 +171,31 @@ public:
}
/// Construct a primitive Number value
- as_value(double val);
+ as_value(double num)
+ :
+ _type(NUMBER),
+ _value(num)
+ {}
/// Construct a null, Object, or DisplayObject value
- as_value(as_object* obj);
+ as_value(as_object* obj)
+ :
+ _type(UNDEFINED)
+ {
+ set_as_object(obj);
+ }
+
+
+ /// Assign to an as_value.
+ DSOEXPORT void operator=(const as_value& v)
+ {
+ _type = v._type;
+ _value = v._value;
+ }
/// Return the primitive type of this value as a string.
const char* typeOf() const;
- /// Get the primitive type of this value
- //
- /// Only used in AVM2
- primitive_types ptype() const;
-
/// Return true if this value is a function
bool is_function() const;
@@ -305,8 +327,6 @@ public:
/// Set this value to the NULL value
void set_null();
- DSOEXPORT void operator=(const as_value& v);
-
bool is_undefined() const {
return (_type == UNDEFINED);
}
http://git.savannah.gnu.org/cgit//commit/?id=80442b0e72cf6b362c6891d4b28cf14fb6216ed6
commit 80442b0e72cf6b362c6891d4b28cf14fb6216ed6
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 16:38:48 2010 +0200
Provide a dtor for good karma.
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 54b416e..2bc8b5d 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -193,6 +193,9 @@ public:
/// uses the resources of the Global object.
explicit as_object(Global_as& global);
+ /// The as_object dtor does nothing special.
+ virtual ~as_object() {}
+
/// Function dispatch
//
/// Various objects can be called, including functions and super objects.
http://git.savannah.gnu.org/cgit//commit/?id=f9a88189fc0189cd545d89bb29dc894b4fc20557
commit f9a88189fc0189cd545d89bb29dc894b4fc20557
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 14:41:05 2010 +0200
Inline ctor, cctor and dtor of as_value.
diff --git a/libcore/as_value.cpp b/libcore/as_value.cpp
index d7cf0e1..d84d762 100644
--- a/libcore/as_value.cpp
+++ b/libcore/as_value.cpp
@@ -825,20 +825,6 @@ as_value::set_bool(bool val)
_value = val;
}
-as_value::as_value()
- :
- _type(UNDEFINED),
- _value(boost::blank())
-{
-}
-
-as_value::as_value(const as_value& v)
- :
- _type(v._type),
- _value(v._value)
-{
-}
-
as_value::as_value(const char* str)
:
_type(STRING),
diff --git a/libcore/as_value.h b/libcore/as_value.h
index 06d839c..dc55333 100644
--- a/libcore/as_value.h
+++ b/libcore/as_value.h
@@ -128,7 +128,22 @@ public:
};
/// Construct an undefined value
- DSOEXPORT as_value();
+ DSOEXPORT as_value()
+ :
+ _type(UNDEFINED),
+ _value(boost::blank())
+ {
+ }
+
+ /// Copy constructor.
+ DSOEXPORT as_value(const as_value& v)
+ :
+ _type(v._type),
+ _value(v._value)
+ {
+ }
+
+ ~as_value() {}
/// Construct a primitive String value
DSOEXPORT as_value(const char* str);
@@ -142,7 +157,7 @@ public:
_type(BOOLEAN),
_value(val)
{
- UNUSED(dummy);
+ UNUSED(dummy);
}
/// Construct a primitive Number value
@@ -151,9 +166,6 @@ public:
/// Construct a null, Object, or DisplayObject value
as_value(as_object* obj);
- /// Copy constructor.
- DSOEXPORT as_value(const as_value& value);
-
/// Return the primitive type of this value as a string.
const char* typeOf() const;
http://git.savannah.gnu.org/cgit//commit/?id=48bbdb9e103de1234c581aeae9a6bed664632a8a
commit 48bbdb9e103de1234c581aeae9a6bed664632a8a
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 14:40:50 2010 +0200
Inline swf version call.
diff --git a/libcore/vm/VM.cpp b/libcore/vm/VM.cpp
index fe68e38..1ac1589 100644
--- a/libcore/vm/VM.cpp
+++ b/libcore/vm/VM.cpp
@@ -110,12 +110,6 @@ VM::clear()
_shLib.reset();
}
-int
-VM::getSWFVersion() const
-{
- return _swfversion;
-}
-
void
VM::setSWFVersion(int v)
{
diff --git a/libcore/vm/VM.h b/libcore/vm/VM.h
index cc96e21..3b3a8c7 100644
--- a/libcore/vm/VM.h
+++ b/libcore/vm/VM.h
@@ -152,7 +152,9 @@ public:
//
/// This information will drive operations of the virtual machine
///
- int getSWFVersion() const;
+ int getSWFVersion() const {
+ return _swfversion;
+ }
/// Set SWF version of the currently executing code
void setSWFVersion(int v);
http://git.savannah.gnu.org/cgit//commit/?id=cf2e88435792cdd4d3557b82d80597f65587a9b2
commit cf2e88435792cdd4d3557b82d80597f65587a9b2
Author: Benjamin Wolsey <address@hidden>
Date: Thu Sep 30 14:40:03 2010 +0200
Const correct.
diff --git a/libcore/as_environment.h b/libcore/as_environment.h
index 59cb3c0..9991406 100644
--- a/libcore/as_environment.h
+++ b/libcore/as_environment.h
@@ -64,7 +64,7 @@ public:
_original_target = target;
}
- DisplayObject* get_original_target() { return _original_target; }
+ DisplayObject* get_original_target() const { return _original_target; }
// Reset target to its original value
void reset_target() { m_target = _original_target; }
@@ -79,7 +79,8 @@ public:
{
try {
return _stack.pop();
- } catch (StackException&) {
+ }
+ catch (StackException&) {
return undefVal;
}
}
@@ -90,7 +91,7 @@ public:
///
/// Throw StackException if index is out of range
///
- as_value& top(size_t dist)
+ as_value& top(size_t dist) const
{
try {
return _stack.top(dist);
-----------------------------------------------------------------------
Summary of changes:
gui/pythonmod/gnash-view.cpp | 3 +-
libcore/AMFConverter.cpp | 6 +-
libcore/Property.cpp | 17 ----
libcore/Property.h | 16 ++++-
libcore/PropertyList.cpp | 7 --
libcore/PropertyList.h | 17 +++-
libcore/Timers.cpp | 2 +-
libcore/as_environment.h | 7 +-
libcore/as_object.cpp | 19 +----
libcore/as_object.h | 95 ++++++++++++++++-------
libcore/as_value.cpp | 72 -----------------
libcore/as_value.h | 62 +++++++++++----
libcore/asobj/ASConversions.cpp | 24 +++---
libcore/asobj/Accessibility_as.cpp | 2 +-
libcore/asobj/Array_as.cpp | 37 ++++-----
libcore/asobj/Array_as.h | 13 +---
libcore/asobj/AsBroadcaster.cpp | 10 +-
libcore/asobj/Camera_as.cpp | 2 +-
libcore/asobj/Color_as.cpp | 4 +-
libcore/asobj/ContextMenuItem_as.cpp | 12 ++--
libcore/asobj/ContextMenu_as.cpp | 2 +-
libcore/asobj/Date_as.cpp | 4 +-
libcore/asobj/Globals.cpp | 8 +-
libcore/asobj/LocalConnection_as.cpp | 2 +-
libcore/asobj/Microphone_as.cpp | 2 +-
libcore/asobj/MovieClip_as.cpp | 6 +-
libcore/asobj/Object.cpp | 2 +-
libcore/asobj/SharedObject_as.cpp | 2 +-
libcore/asobj/TextField_as.cpp | 4 +-
libcore/asobj/XMLNode_as.cpp | 4 +-
libcore/asobj/XMLSocket_as.cpp | 2 +-
libcore/asobj/XML_as.cpp | 2 +-
libcore/asobj/flash/display/BitmapData_as.cpp | 4 +-
libcore/asobj/flash/filters/BitmapFilter_as.cpp | 2 +-
libcore/asobj/flash/geom/ColorTransform_as.cpp | 16 ++--
libcore/parser/sprite_definition.cpp | 2 +-
libcore/vm/ASHandlers.cpp | 4 +-
libcore/vm/CallStack.cpp | 2 +-
libcore/vm/Machine.cpp | 6 +-
libcore/vm/VM.cpp | 6 --
libcore/vm/VM.h | 4 +-
librender/Renderer_agg.cpp | 4 +-
librender/Renderer_agg_style.h | 5 -
43 files changed, 238 insertions(+), 284 deletions(-)
hooks/post-receive
--
Gnash
- [Gnash-commit] [SCM] Gnash branch, master, updated. 3ddaf5d39bcb038b63ce884eafdd61d036e132c6,
Benjamin Wolsey <=