/// replace the given area with no-data /// emits a lineDataChanged signal void TextLineDataManager::fillWithEmpty(int line, int length, int newLength) { destroyRange(line, length); textLineDataList_.fill( line, length, 0, newLength ); //qlog_info() << "- TextLineDataManager::fillWithEmpty( line: " << line << ", length " << length << " newLength: " << newLength << ") len:" << this->textLineDataList_.length(); emit lineDataChanged( line, length, newLength ); }
/// Replace the given items with /// emits a lineDataChanged signal void TextLineDataManager::replace(int line, int length, TextLineDataList** items, int newLength ) { destroyRange(line, length); textLineDataList_.replace( line, length, items, newLength ); emit lineDataChanged( line, length, newLength ); }
// BUG #673: This mem-platform may be shared by multiple threads (for example // one SPAD shared by 2 CEs. We therefore do the malloc/free and what not extremely early // on so that only the NODE_MASTER does it in a race free manner. u8 mallocSwitchRunlevel(ocrMemPlatform_t *self, ocrPolicyDomain_t *PD, ocrRunlevel_t runlevel, phase_t phase, u32 properties, void (*callback)(ocrPolicyDomain_t*, u64), u64 val) { u8 toReturn = 0; // This is an inert module, we do not handle callbacks (caller needs to wait on us) ASSERT(callback == NULL); // Verify properties for this call ASSERT((properties & RL_REQUEST) && !(properties & RL_RESPONSE) && !(properties & RL_RELEASE)); ASSERT(!(properties & RL_FROM_MSG)); switch(runlevel) { case RL_CONFIG_PARSE: // On bring-up: Update PD->phasesPerRunlevel on phase 0 // and check compatibility on phase 1 break; case RL_NETWORK_OK: // This should ideally be in MEMORY_OK // NOTE: This is serial because only thread is up until PD_OK if((properties & RL_BRING_UP) && RL_IS_FIRST_PHASE_UP(PD, RL_NETWORK_OK, phase)) { if(self->startAddr != 0ULL) break; // We break out early since we are already initialized // This is where we need to update the memory // using the sysboot functions self->startAddr = (u64)malloc(self->size); // Check that the mem-platform size in config file is reasonable ASSERT(self->startAddr); self->endAddr = self->startAddr + self->size; // rangeTracker will be located at self->startAddr, and it should be zero'ed // since initializeRange() assumes zero-ed 'lock' and 'inited' variables ASSERT(self->size >= MEM_PLATFORM_ZEROED_AREA_SIZE); // make sure no buffer overrun // zero beginning part to cover rangeTracker and pad, and allocator metadata part i.e. pool header (pool_t) memset((void *)self->startAddr , 0, MEM_PLATFORM_ZEROED_AREA_SIZE); ocrMemPlatformMalloc_t *rself = (ocrMemPlatformMalloc_t*)self; rself->pRangeTracker = initializeRange( 16, self->startAddr, self->endAddr, USER_FREE_TAG); } else if((properties & RL_TEAR_DOWN) && RL_IS_LAST_PHASE_DOWN(PD, RL_NETWORK_OK, phase)) { // This is also serial because after PD_OK we are down to one thread ocrMemPlatformMalloc_t *rself = (ocrMemPlatformMalloc_t*)self; // The first guy through here does this if(self->startAddr != 0ULL) { if(rself->pRangeTracker) // in case of mallocproxy, pRangeTracker==0 destroyRange(rself->pRangeTracker); // Here we can free the memory we allocated free((void*)(self->startAddr)); self->startAddr = 0ULL; } } break; case RL_PD_OK: if(properties & RL_BRING_UP) { // We can now set our PD (before this, we couldn't because // "our" PD might not have been started self->pd = PD; } break; case RL_MEMORY_OK: // Should ideally do what's in NETWORK_OK break; case RL_GUID_OK: break; case RL_COMPUTE_OK: break; case RL_USER_OK: break; default: // Unknown runlevel ASSERT(0); } return toReturn; }