void addToCache(const Fingerprint &fileId, const DenseDataPtr &data) { if (mNext) { mNext->addToCache(fileId, data); } else { populateCache(fileId, data); } }
PostgreSQLStore::PostgreSQLStore ( const SessionID& s, const DatabaseConnectionID& d, PostgreSQLConnectionPool* p ) : m_pConnectionPool( p ), m_sessionID( s ) { m_pConnection = m_pConnectionPool->create( d ); populateCache(); }
PostgreSQLStore::PostgreSQLStore ( const SessionID& s, const std::string& database, const std::string& user, const std::string& password, const std::string& host, short port ) : m_pConnectionPool( 0 ), m_sessionID( s ) { m_pConnection = new PostgreSQLConnection( database, user, password, host, port ); populateCache(); }
static void freeLogMmap( void * in_ptr ) { defaultVtable.free( in_ptr ); if( --cacheRemaining == 0 ) { populateCache(); } cache->type.free.pointer = (size_t) in_ptr; cache->header.mode = MPROF_MODE_FREE; mprofRecordTimeStamp( cache++ ); }
static void * mallocLogMmap( size_t in_size ) { void * ret = defaultVtable.malloc( in_size ); if( --cacheRemaining == 0 ) { populateCache(); } cache->type.malloc.size = in_size; cache->type.malloc.result = (size_t) ret; cache->header.mode = MPROF_MODE_MALLOC; mprofRecordTimeStamp( cache++ ); return ret; }
void FileStore::open( bool deleteFile ) { if ( m_msgFile ) fclose( m_msgFile ); if ( m_headerFile ) fclose( m_headerFile ); if ( m_seqNumsFile ) fclose( m_seqNumsFile ); if ( m_sessionFile ) fclose( m_sessionFile ); m_msgFile = 0; m_headerFile = 0; m_seqNumsFile = 0; m_sessionFile = 0; if ( deleteFile ) { file_unlink( m_msgFileName.c_str() ); file_unlink( m_headerFileName.c_str() ); file_unlink( m_seqNumsFileName.c_str() ); file_unlink( m_sessionFileName.c_str() ); } populateCache(); m_msgFile = file_fopen( m_msgFileName.c_str(), "r+" ); if ( !m_msgFile ) m_msgFile = file_fopen( m_msgFileName.c_str(), "w+" ); if ( !m_msgFile ) throw ConfigError( "Could not open body file: " + m_msgFileName ); m_headerFile = file_fopen( m_headerFileName.c_str(), "r+" ); if ( !m_headerFile ) m_headerFile = file_fopen( m_headerFileName.c_str(), "w+" ); if ( !m_headerFile ) throw ConfigError( "Could not open header file: " + m_headerFileName ); m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "r+" ); if ( !m_seqNumsFile ) m_seqNumsFile = file_fopen( m_seqNumsFileName.c_str(), "w+" ); if ( !m_seqNumsFile ) throw ConfigError( "Could not open seqnums file: " + m_seqNumsFileName ); bool setCreationTime = false; m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r" ); if ( !m_sessionFile ) setCreationTime = true; else fclose( m_sessionFile ); m_sessionFile = file_fopen( m_sessionFileName.c_str(), "r+" ); if ( !m_sessionFile ) m_sessionFile = file_fopen( m_sessionFileName.c_str(), "w+" ); if ( !m_sessionFile ) throw ConfigError( "Could not open session file" ); if ( setCreationTime ) setSession(); setNextSenderMsgSeqNum( getNextSenderMsgSeqNum() ); setNextTargetMsgSeqNum( getNextTargetMsgSeqNum() ); }
CacheContentsWidget::CacheContentsWidget(Window *window) : ContentsWidget(window), m_model(new QStandardItemModel(this)), m_isLoading(true), m_ui(new Ui::CacheContentsWidget) { m_ui->setupUi(this); m_ui->previewLabel->hide(); QTimer::singleShot(100, this, SLOT(populateCache())); connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterCache(QString))); connect(m_ui->cacheView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(openEntry(QModelIndex))); connect(m_ui->cacheView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); connect(m_ui->deleteButton, SIGNAL(clicked()), this, SLOT(removeDomainEntriesOrEntry())); }
void AdBlockSubscription::loadSubscription(const QStringList &disabledRules) { QFile file(m_filePath); if (!file.exists()) { QTimer::singleShot(0, this, SLOT(updateSubscription())); return; } if (!file.open(QFile::ReadOnly)) { qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "Unable to open adblock file for reading" << m_filePath; QTimer::singleShot(0, this, SLOT(updateSubscription())); return; } QTextStream textStream(&file); textStream.setCodec("UTF-8"); // Header is on 3rd line textStream.readLine(1024); textStream.readLine(1024); QString header = textStream.readLine(1024); if (!header.startsWith(QLatin1String("[Adblock")) || m_title.isEmpty()) { qWarning() << "AdBlockSubscription::" << __FUNCTION__ << "invalid format of adblock file" << m_filePath; QTimer::singleShot(0, this, SLOT(updateSubscription())); return; } m_rules.clear(); while (!textStream.atEnd()) { AdBlockRule* rule = new AdBlockRule(textStream.readLine(), this); if (disabledRules.contains(rule->filter())) { rule->setEnabled(false); } m_rules.append(rule); } populateCache(); // Initial update if (m_rules.isEmpty() && !m_updated) { QTimer::singleShot(0, this, SLOT(updateSubscription())); } }
const AdBlockRule* AdBlockSubscription::disableRule(int offset) { if (!QzTools::vectorContainsIndex(m_rules, offset)) { return 0; } AdBlockRule* rule = m_rules[offset]; rule->setEnabled(false); AdBlockManager::instance()->addDisabledRule(rule->filter()); if (rule->isCssRule()) { populateCache(); mApp->reloadUserStyleSheet(); } return rule; }
void PostgreSQLStore::refresh() throw ( IOException ) { m_cache.reset(); populateCache(); }