Use state allocator for creating parallel validators
This commit is contained in:
parent
7ef7ba13f0
commit
87d1f95551
@ -288,7 +288,6 @@ struct SchemaValidationContext {
|
|||||||
ISchemaValidator** patternPropertiesValidators;
|
ISchemaValidator** patternPropertiesValidators;
|
||||||
SizeType patternPropertiesValidatorCount;
|
SizeType patternPropertiesValidatorCount;
|
||||||
const SchemaType** patternPropertiesSchemas;
|
const SchemaType** patternPropertiesSchemas;
|
||||||
//ISchemaValidator* notValidator;
|
|
||||||
SizeType patternPropertiesSchemaCount;
|
SizeType patternPropertiesSchemaCount;
|
||||||
PatternValidatorType valuePatternValidatorType;
|
PatternValidatorType valuePatternValidatorType;
|
||||||
PatternValidatorType objectPatternValidatorType;
|
PatternValidatorType objectPatternValidatorType;
|
||||||
@ -1286,8 +1285,10 @@ private:
|
|||||||
struct SchemaEntry {
|
struct SchemaEntry {
|
||||||
SchemaEntry(const PointerType& p, SchemaType* s, bool o) : pointer(p), schema(s), owned(o) {}
|
SchemaEntry(const PointerType& p, SchemaType* s, bool o) : pointer(p), schema(s), owned(o) {}
|
||||||
~SchemaEntry() {
|
~SchemaEntry() {
|
||||||
if (owned)
|
if (owned) {
|
||||||
schema->~SchemaType();
|
schema->~SchemaType();
|
||||||
|
Allocator::Free(schema);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PointerType pointer;
|
PointerType pointer;
|
||||||
SchemaType* schema;
|
SchemaType* schema;
|
||||||
@ -1551,25 +1552,17 @@ RAPIDJSON_MULTILINEMACRO_END
|
|||||||
|
|
||||||
// Implementation of ISchemaStateFactory<SchemaType>
|
// Implementation of ISchemaStateFactory<SchemaType>
|
||||||
virtual ISchemaValidator* CreateSchemaValidator(const SchemaType& root) {
|
virtual ISchemaValidator* CreateSchemaValidator(const SchemaType& root) {
|
||||||
return new GenericSchemaValidator(*schemaDocument_, root
|
return new (GetStateAllocator().Malloc(sizeof(GenericSchemaValidator))) GenericSchemaValidator(*schemaDocument_, root
|
||||||
#if RAPIDJSON_SCHEMA_VERBOSE
|
#if RAPIDJSON_SCHEMA_VERBOSE
|
||||||
, depth_ + 1
|
, depth_ + 1
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
// GenericSchemaValidator *validator = GetStateAllocator().Malloc(sizeof(GenericSchemaValidator));
|
|
||||||
// new (validator) GenericSchemaValidator(*schemaDocument_, root
|
|
||||||
// #if RAPIDJSON_SCHEMA_VERBOSE
|
|
||||||
// , depth_ + 1
|
|
||||||
// #endif
|
|
||||||
// );
|
|
||||||
// return validator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DestroySchemaValidator(ISchemaValidator* validator) {
|
virtual void DestroySchemaValidator(ISchemaValidator* validator) {
|
||||||
delete validator;
|
GenericSchemaValidator* v = static_cast<GenericSchemaValidator*>(validator);
|
||||||
// validator->~ISchemaValidator();
|
v->~GenericSchemaValidator();
|
||||||
// StateAllocator::Free(validator);
|
StateAllocator::Free(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user