Cleanup Static{Result,Exception}WaitHandle construction interfaces

Provide a Static{Result,Exception}WaitHandle::Create() static method for
internal use, use it by GenArrayWaitHandle.

Avoids one inc/decref (Array -> Variant -> m_resultOrException) if
GenArray received an array of finished dependencies.
Esse commit está contido em:
jan
2013-03-27 19:13:01 -07:00
commit de Sara Golemon
commit 1da3705450
4 arquivos alterados com 17 adições e 4 exclusões
+5 -2
Ver Arquivo
@@ -99,9 +99,12 @@ Object c_GenArrayWaitHandle::ti_create(const char* cls, CArrRef dependencies) {
}
if (exception.isNull()) {
return c_StaticResultWaitHandle::t_create(deps);
TypedValue tv;
tv.m_type = KindOfArray;
tv.m_data.parr = deps.get();
return c_StaticResultWaitHandle::Create(&tv);
} else {
return c_StaticExceptionWaitHandle::t_create(exception);
return c_StaticExceptionWaitHandle::Create(exception.get());
}
}
@@ -47,8 +47,12 @@ Object c_StaticExceptionWaitHandle::ti_create(const char* cls, CObjRef exception
throw e;
}
return Create(exception.get());
}
p_StaticExceptionWaitHandle c_StaticExceptionWaitHandle::Create(ObjectData* exception) {
p_StaticExceptionWaitHandle wh = NEWOBJ(c_StaticExceptionWaitHandle)();
tvWriteObject(exception.get(), &wh->m_resultOrException);
tvWriteObject(exception, &wh->m_resultOrException);
return wh;
}
@@ -41,8 +41,12 @@ void c_StaticResultWaitHandle::t___construct() {
}
Object c_StaticResultWaitHandle::ti_create(const char* cls, CVarRef result) {
return Create(result.asTypedValue());
}
p_StaticResultWaitHandle c_StaticResultWaitHandle::Create(const TypedValue* result) {
p_StaticResultWaitHandle wh = NEWOBJ(c_StaticResultWaitHandle)();
tvReadCell(result.asTypedValue(), &wh->m_resultOrException);
tvReadCell(result, &wh->m_resultOrException);
return wh;
}
+2
Ver Arquivo
@@ -143,6 +143,7 @@ class c_StaticResultWaitHandle : public c_StaticWaitHandle {
public:
static p_StaticResultWaitHandle Create(const TypedValue* result);
String getName();
};
@@ -168,6 +169,7 @@ class c_StaticExceptionWaitHandle : public c_StaticWaitHandle {
public:
static p_StaticExceptionWaitHandle Create(ObjectData* exception);
String getName();
};