Use WrappedMap copyOnWrite feature to do lazy copying of parameter map only

when it is actually modified by the macro.
This commit is contained in:
hns 2003-07-30 17:06:04 +00:00
parent 4a72e955ac
commit 08b50f7c59

View file

@ -22,6 +22,7 @@ import helma.objectmodel.INode;
import helma.scripting.*; import helma.scripting.*;
import helma.util.HtmlEncoder; import helma.util.HtmlEncoder;
import helma.util.SystemMap; import helma.util.SystemMap;
import helma.util.WrappedMap;
import java.io.*; import java.io.*;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.*; import java.util.*;
@ -478,14 +479,14 @@ public final class Skin {
} }
// System.err.println ("Getting macro from function"); // System.err.println ("Getting macro from function");
// pass a clone of the parameter map so if the script changes it, // pass a clone/copy of the parameter map so if the script changes it,
// Map param = ; Object[] arguments = new Object[1];
// if (parameters == null) if (parameters == null) {
// parameters = new HashMap (); arguments[0] = new SystemMap(0);
Object[] arguments = { } else {
(parameters == null) ? new SystemMap() arguments[0] = new WrappedMap(parameters, WrappedMap.COPY_ON_WRITE);
: new SystemMap(parameters) // arguments[0] = new SystemMap(parameters);
}; }
Object value = reval.scriptingEngine.invoke(handlerObject, Object value = reval.scriptingEngine.invoke(handlerObject,
funcName, arguments, funcName, arguments,