Apparently the WireType Marshaller is no longer necessary??

This commit is contained in:
Chad Austin 2013-02-28 13:25:31 -08:00 коммит произвёл Jukka Jylänki
Родитель 612076a7cd
Коммит f22f586787
3 изменённых файлов: 36 добавлений и 25 удалений

Просмотреть файл

@ -833,7 +833,6 @@ function __embind_register_class_constructor(
) {
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
invoker = FUNCTION_TABLE[invoker];
rawConstructor = rawConstructor;
requestDeferredRegistration(function() {
var classType = requireRegisteredType(rawClassType, 'class');
@ -858,6 +857,39 @@ function __embind_register_class_constructor(
});
}
function __embind_register_class_smart_ptr_constructor(
rawClassType,
argCount,
rawArgTypesAddr,
invoker,
rawConstructor
) {
var rawArgTypes = heap32VectorToArray(argCount, rawArgTypesAddr);
invoker = FUNCTION_TABLE[invoker];
requestDeferredRegistration(function() {
var classType = requireRegisteredType(rawClassType, 'class');
var humanName = 'constructor ' + classType.name;
var argTypes = requireArgumentTypes(rawArgTypes, humanName);
classType.constructor.body = function() {
if (arguments.length !== argCount - 1) {
throwBindingError(humanName + ' + called with ' + arguments.length + ' arguments, expected ' + (argCount-1));
}
var destructors = [];
var args = new Array(argCount);
args[0] = rawConstructor;
for (var i = 1; i < argCount; ++i) {
args[i] = argTypes[i].toWireType(destructors, arguments[i - 1]);
}
var ptr = invoker.apply(null, args);
runDestructors(destructors);
return argTypes[0].fromWireType(ptr);
};
});
}
function __embind_register_class_method(
rawClassType,
methodName,

Просмотреть файл

@ -650,7 +650,7 @@ namespace emscripten {
// todo: generate unique name
smart_ptr<SmartPtr>("SmartPtr");
typename WithPolicies<>::template ArgTypeList<void, Args...> args;
typename WithPolicies<>::template ArgTypeList<SmartPtr, Args...> args;
_embind_register_class_smart_ptr_constructor(
TypeID<ClassType>::get(),
args.count,

Просмотреть файл

@ -261,33 +261,12 @@ namespace emscripten {
typedef typename std::remove_reference<T>::type ActualT;
typedef ActualT* WireType;
struct Marshaller {
explicit Marshaller(WireType wt)
: wireType(wt)
{}
Marshaller(Marshaller&& wt)
: wireType(wt.wireType)
{
wt.wireType = 0;
}
operator ActualT&() const {
return *wireType;
}
private:
Marshaller() = delete;
Marshaller(const Marshaller&) = delete;
ActualT* wireType;
};
static WireType toWireType(T v) {
return new T(v);
}
static Marshaller fromWireType(WireType p) {
return Marshaller(p);
static ActualT& fromWireType(WireType p) {
return *p;
}
static void destroy(WireType p) {