MCPcopy Create free account
hub / github.com/buggins/coolreader / createCacheFile

Method createCacheFile

crengine/src/lvtinydom.cpp:1554–1590  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1552}
1553
1554bool tinyNodeCollection::createCacheFile()
1555{
1556 if ( _cacheFile )
1557 return true;
1558 CacheFile * f = new CacheFile();
1559 //lString16 cacheFileName("/tmp/cr3swap.tmp");
1560
1561 lString16 fname = getProps()->getStringDef( DOC_PROP_FILE_NAME, "noname" );
1562 lUInt32 sz = (lUInt32)getProps()->getInt64Def(DOC_PROP_FILE_SIZE, 0);
1563 lUInt32 crc = getProps()->getIntDef(DOC_PROP_FILE_CRC32, 0);
1564
1565 if ( !ldomDocCache::enabled() ) {
1566 CRLog::error("Cannot swap: cache dir is not initialized");
1567 return false;
1568 }
1569
1570 CRLog::info("ldomDocument::createCacheFile() - initialized swapping of document %s to cache file", UnicodeToUtf8(fname).c_str() );
1571
1572 LVStreamRef map = ldomDocCache::createNew( fname, crc, getPersistenceFlags(), sz );
1573 if ( map.isNull() ) {
1574 delete f;
1575 return false;
1576 }
1577
1578 if ( !f->create( map ) ) {
1579 delete f;
1580 return false;
1581 }
1582 _cacheFile = f;
1583 _mapped = true;
1584 _textStorage.setCache( f );
1585 _elemStorage.setCache( f );
1586 _rectStorage.setCache( f );
1587 _styleStorage.setCache( f );
1588 _blobCache.setCacheFile( f );
1589 return true;
1590}
1591
1592void tinyNodeCollection::clearNodeStyle( lUInt32 dataIndex )
1593{

Callers 1

compactMethod · 0.80

Calls 10

getPropsFunction · 0.85
UnicodeToUtf8Function · 0.85
getInt64DefMethod · 0.80
setCacheMethod · 0.80
setCacheFileMethod · 0.80
getStringDefMethod · 0.45
getIntDefMethod · 0.45
c_strMethod · 0.45
isNullMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected