Working version that still bypasses memorypools

This commit is contained in:
Alexander Bock
2020-08-04 11:43:16 +02:00
parent c3cb10453b
commit 33df5b9fd3
4 changed files with 41 additions and 16 deletions

View File

@@ -83,8 +83,14 @@ Connection::Connection(std::unique_ptr<ghoul::io::Socket> s,
_topicFactory.registerClass(
AuthenticationTopicKey,
[password](bool, const ghoul::Dictionary&) {
return new AuthorizationTopic(password);
[password](bool, const ghoul::Dictionary&, ghoul::MemoryPoolBase* pool) {
if (pool) {
void* ptr = pool->alloc(sizeof(AuthorizationTopic));
return new (ptr) AuthorizationTopic(password);
}
else {
return new AuthorizationTopic(password);
}
}
);

View File

@@ -78,22 +78,41 @@ void SyncModule::internalInitialize(const ghoul::Dictionary& configuration) {
fSynchronization->registerClass(
"HttpSynchronization",
[this](bool, const ghoul::Dictionary& dictionary) {
return new HttpSynchronization(
dictionary,
_synchronizationRoot,
_synchronizationRepositories
);
[this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) {
if (pool) {
void* ptr = pool->alloc(sizeof(HttpSynchronization));
return new (ptr) HttpSynchronization(
dictionary,
_synchronizationRoot,
_synchronizationRepositories
);
}
else {
return new HttpSynchronization(
dictionary,
_synchronizationRoot,
_synchronizationRepositories
);
}
}
);
fSynchronization->registerClass(
"UrlSynchronization",
[this](bool, const ghoul::Dictionary& dictionary) {
return new UrlSynchronization(
dictionary,
_synchronizationRoot
);
[this](bool, const ghoul::Dictionary& dictionary, ghoul::MemoryPoolBase* pool) {
if (pool) {
void* ptr = pool->alloc(sizeof(UrlSynchronization));
return new (ptr) UrlSynchronization(
dictionary,
_synchronizationRoot
);
}
else {
return new UrlSynchronization(
dictionary,
_synchronizationRoot
);
}
}
);