CacheClientBlackBerry.cpp [plain text]
#include "config.h"
#include "CacheClientBlackBerry.h"
#include "MemoryCache.h"
#include <BlackBerryPlatformMisc.h>
#include <BlackBerryPlatformSettings.h>
namespace WebCore {
CacheClientBlackBerry* CacheClientBlackBerry::get()
{
static CacheClientBlackBerry s_cacheClient;
return &s_cacheClient;
}
CacheClientBlackBerry::CacheClientBlackBerry()
: m_lastCapacity(0)
{
}
void CacheClientBlackBerry::initialize()
{
#if ENABLE(BLACKBERRY_DEBUG_MEMORY)
bool isDisabled = true;
#else
bool isDisabled = false;
#endif
memoryCache()->setDisabled(isDisabled);
if (!isDisabled) {
memoryCache()->setDeadDecodedDataDeletionInterval(0.01);
updateCacheCapacity();
}
}
void CacheClientBlackBerry::updateCacheCapacity()
{
#if ENABLE(BLACKBERRY_DEBUG_MEMORY)
#else
unsigned cacheCapacity = BlackBerry::Platform::Settings::get()->getSuggestedCacheCapacity(memoryCache()->totalSize());
if (m_lastCapacity == cacheCapacity) {
return;
}
m_lastCapacity = cacheCapacity;
memoryCache()->setCapacities(0, m_lastCapacity, m_lastCapacity);
#endif
}
}