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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário