68 if (enableRecovery && chunkHeader->identifier == INITIALIZED_CHUNK_IDENTIFIER) { |
66 if (enableRecovery && chunkHeader->identifier == INITIALIZED_CHUNK_IDENTIFIER) { |
69 // just reconnect allocators to the shared chunk |
67 // just reconnect allocators to the shared chunk |
70 mainAllocator->initialize(chunk, chunkHeader->mainAllocatorOffset); |
68 mainAllocator->initialize(chunk, chunkHeader->mainAllocatorOffset); |
71 subAllocator->initialize(chunk, chunkHeader->subAllocatorOffset, mainAllocator); |
69 subAllocator->initialize(chunk, chunkHeader->subAllocatorOffset, mainAllocator); |
72 } else { |
70 } else { |
|
71 memset(chunkHeader, 0, sizeof(HbSharedChunkHeader)); |
73 chunkHeader->mainAllocatorOffset = sizeof(HbSharedChunkHeader); |
72 chunkHeader->mainAllocatorOffset = sizeof(HbSharedChunkHeader); |
74 // Clear also allocator identifier so that they will not try to re-connect |
73 // Clear also allocator identifier so that they will not try to re-connect |
75 qptrdiff *mainAllocatorIdentifier = reinterpret_cast<qptrdiff *>(static_cast<char *>(base()) + chunkHeader->mainAllocatorOffset); |
74 quint32 *mainAllocatorIdentifier = reinterpret_cast<quint32 *>(static_cast<char *>(base()) + chunkHeader->mainAllocatorOffset); |
76 *mainAllocatorIdentifier = 0; |
75 *mainAllocatorIdentifier = 0; |
77 mainAllocator->initialize(chunk, chunkHeader->mainAllocatorOffset); |
76 mainAllocator->initialize(chunk, chunkHeader->mainAllocatorOffset); |
78 chunkHeader->subAllocatorOffset = alloc(SPACE_NEEDED_FOR_MULTISEGMENT_ALLOCATOR); |
77 chunkHeader->subAllocatorOffset = alloc(SPACE_NEEDED_FOR_MULTISEGMENT_ALLOCATOR); |
79 qptrdiff *subAllocatorIdentifier = reinterpret_cast<qptrdiff *>(static_cast<char *>(base()) + chunkHeader->subAllocatorOffset); |
78 quint32 *subAllocatorIdentifier = reinterpret_cast<quint32 *>(static_cast<char *>(base()) + chunkHeader->subAllocatorOffset); |
80 *subAllocatorIdentifier = 0; |
79 *subAllocatorIdentifier = 0; |
81 subAllocator->initialize(chunk, chunkHeader->subAllocatorOffset, mainAllocator); |
80 subAllocator->initialize(chunk, chunkHeader->subAllocatorOffset, mainAllocator); |
82 chunkHeader->identifier = INITIALIZED_CHUNK_IDENTIFIER; |
81 chunkHeader->identifier = INITIALIZED_CHUNK_IDENTIFIER; |
83 |
82 |
84 // Create empty shared cache for unit test purposes |
83 // Create empty shared cache for unit test purposes |