#include "config.h"
#if ENABLE(TIZEN_WEBKIT2_TILED_AC_SHARED_PLATFORM_SURFACE)
-#include "PlatformSurfacePoolEfl.h"
+#include "PlatformSurfacePoolTizen.h"
#include <WebCore/Logging.h>
#include <wtf/HashMap.h>
#include "WebProcess.h"
return (usedSize > static_cast<int>(static_cast<float>(totalSize) * 0.9));
}
-PlatformSurfacePoolEfl::PlatformSurfaceInfo::PlatformSurfaceInfo(const IntSize& size)
+PlatformSurfacePoolTizen::PlatformSurfaceInfo::PlatformSurfaceInfo(const IntSize& size)
: m_used(false)
, m_willBeRemoved(false)
, m_age(0)
m_SharedPlatformSurfaceTizen = WebCore::SharedPlatformSurfaceTizen::create(size, true);
}
-PlatformSurfacePoolEfl::PlatformSurfacePoolEfl()
+PlatformSurfacePoolTizen::PlatformSurfacePoolTizen()
: m_sizeInByte(0)
, m_maxSizeInByte(128 * MB) // 128 MB
, m_usedSizeInByte(0)
, m_usedSizeInCount(0)
- , m_removePlaformSurfaceTimer(this, &PlatformSurfacePoolEfl::removePlaformSurfaceTimerFired)
+ , m_removePlaformSurfaceTimer(this, &PlatformSurfacePoolTizen::removePlaformSurfaceTimerFired)
{
// FIXME : Create this workqueue and a pixmap temporarily to avoid a crash issue.
// The crash occur in cairo gl used by 2dCanvas. It will be removed if the issue is fixed.
newPlatformSurfaceInfo = createPlatformSurface(IntSize(384,384));
}
-PlatformSurfacePoolEfl::~PlatformSurfacePoolEfl()
+PlatformSurfacePoolTizen::~PlatformSurfacePoolTizen()
{
m_platformSurfacesToFree.clear();
m_platformSurfaces.clear();
}
-SharedPlatformSurfaceTizen* PlatformSurfacePoolEfl::acquirePlatformSurface(const IntSize& size, int tileID)
+SharedPlatformSurfaceTizen* PlatformSurfacePoolTizen::acquirePlatformSurface(const IntSize& size, int tileID)
{
freePlatformSurfacesIfNeeded();
removePlatformSurfacesIfNeeded();
m_usedSizeInCount++;
LOG(TiledAC, "XPlatformSurface pool size : %u MB (%u tiles) used : %u MB (%u tiles) at [%s]",
- m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolEfl::acquirePlatformSurface");
+ m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolTizen::acquirePlatformSurface");
return platformSurfaceInfo->m_SharedPlatformSurfaceTizen.get();
}
}
if (canCreatePlatformSurface()) {
RefPtr<PlatformSurfaceInfo> newPlatformSurfaceInfo = createPlatformSurface(size);
if (!newPlatformSurfaceInfo) {
- LOG(TiledAC, "can't create new platformSurface(%dx%d) at [%s]", size.width(), size.height(), "PlatformSurfacePoolEfl::acquirePlatformSurface");
+ LOG(TiledAC, "can't create new platformSurface(%dx%d) at [%s]", size.width(), size.height(), "PlatformSurfacePoolTizen::acquirePlatformSurface");
return 0;
}
newPlatformSurfaceInfo->m_used = true;
m_usedSizeInByte += newPlatformSurfaceInfo->sizeInByte();
LOG(TiledAC, "acquire platformSurface(%dx%d) XPlatformSurface pool size : %u MB (%u tiles) used : %u MB (%u tiles) at [%s]",
- size.width(), size.height(), m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolEfl::acquirePlatformSurface");
+ size.width(), size.height(), m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolTizen::acquirePlatformSurface");
return newPlatformSurfaceInfo->m_SharedPlatformSurfaceTizen.get();
}
- LOG(TiledAC, "No more platformSurface allowed: can't acquire platformSurface(%dx%d) at [%s]", size.width(), size.height(), "PlatformSurfacePoolEfl::acquirePlatformSurface");
+ LOG(TiledAC, "No more platformSurface allowed: can't acquire platformSurface(%dx%d) at [%s]", size.width(), size.height(), "PlatformSurfacePoolTizen::acquirePlatformSurface");
return 0;
}
-void PlatformSurfacePoolEfl::freePlatformSurfaceByTileID(int tileID)
+void PlatformSurfacePoolTizen::freePlatformSurfaceByTileID(int tileID)
{
int platformSurfaceId = 0;
PlatformSurfaceMap::iterator end = m_platformSurfaces.end();
freePlatformSurface(platformSurfaceId);
}
-void PlatformSurfacePoolEfl::freePlatformSurface(int platformSurfaceId)
+void PlatformSurfacePoolTizen::freePlatformSurface(int platformSurfaceId)
{
RefPtr<PlatformSurfaceInfo> platformSurfaceInfo = m_platformSurfaces.get(platformSurfaceId);
if (platformSurfaceInfo && platformSurfaceInfo->m_used)
LOG(TiledAC, "WARNING: no matching or freed PlatformSurfaceInfo for %d at [%s]", platformSurfaceId, __PRETTY_FUNCTION__);
}
-void PlatformSurfacePoolEfl::freePlatformSurfacesIfNeeded()
+void PlatformSurfacePoolTizen::freePlatformSurfacesIfNeeded()
{
if (m_platformSurfacesToFree.isEmpty())
return;
shrink();
}
-void PlatformSurfacePoolEfl::removePlatformSurface(int platformSurfaceId)
+void PlatformSurfacePoolTizen::removePlatformSurface(int platformSurfaceId)
{
/*FIXME : platformSurfaceId must not be zero.
But sometimes zero id was added to platformSurfaceMap.
m_platformSurfaces.remove(foundSurface);
LOG(TiledAC, "remove platformSurface(%dx%d) XPlatformSurface pool size : %u MB (%u tiles) used : %u MB (%u tiles) at [%s]",
- width, height, m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolEfl::removePlatformSurface");
+ width, height, m_sizeInByte/MB, m_platformSurfaces.size(), m_usedSizeInByte/MB, m_usedSizeInCount, "PlatformSurfacePoolTizen::removePlatformSurface");
}
-void PlatformSurfacePoolEfl::willRemovePlatformSurface(int platformSurfaceId)
+void PlatformSurfacePoolTizen::willRemovePlatformSurface(int platformSurfaceId)
{
WebProcess::shared().connection()->send(Messages::WebProcessProxy::RemovePlatformSurfaceTextureFromPool(platformSurfaceId), 0);
}
-bool PlatformSurfacePoolEfl::canCreatePlatformSurface()
+bool PlatformSurfacePoolTizen::canCreatePlatformSurface()
{
if (m_sizeInByte >= m_maxSizeInByte)
shrink();
return m_sizeInByte < m_maxSizeInByte;
}
-RefPtr<PlatformSurfacePoolEfl::PlatformSurfaceInfo> PlatformSurfacePoolEfl::createPlatformSurface(const IntSize& size)
+RefPtr<PlatformSurfacePoolTizen::PlatformSurfaceInfo> PlatformSurfacePoolTizen::createPlatformSurface(const IntSize& size)
{
RefPtr<PlatformSurfaceInfo> newPlatformSurface = adoptRef(new PlatformSurfaceInfo(size));
if (!newPlatformSurface->m_SharedPlatformSurfaceTizen)
return newPlatformSurface.get();
}
-void PlatformSurfacePoolEfl::shrink()
+void PlatformSurfacePoolTizen::shrink()
{
Vector<int> platformSurfacesToRemove;
{
}
if (platformSurfacesToRemove.size())
- LOG(TiledAC, "remove %d platformSurfaces @PlatformSurfacePoolEfl::shrink", platformSurfacesToRemove.size());
+ LOG(TiledAC, "remove %d platformSurfaces @PlatformSurfacePoolTizen::shrink", platformSurfacesToRemove.size());
for (size_t index = 0; index < platformSurfacesToRemove.size(); index++) {
// FIXME: we should send willRemovePlatformSurface to UIProcess before destroying xplatformSurface itself
}
}
-void PlatformSurfacePoolEfl::startRemovePlaformSurfaceTimer()
+void PlatformSurfacePoolTizen::startRemovePlaformSurfaceTimer()
{
if (m_removePlaformSurfaceTimer.isActive())
return;
m_removePlaformSurfaceTimer.startOneShot(0.01);
}
-void PlatformSurfacePoolEfl::removePlaformSurfaceTimerFired(Timer<PlatformSurfacePoolEfl>*)
+void PlatformSurfacePoolTizen::removePlaformSurfaceTimerFired(Timer<PlatformSurfacePoolTizen>*)
{
freePlatformSurfacesIfNeeded();
removePlatformSurfacesIfNeeded();
}
-void PlatformSurfacePoolEfl::removePlatformSurfacesIfNeeded()
+void PlatformSurfacePoolTizen::removePlatformSurfacesIfNeeded()
{
Vector<int> platformSurfacesIdToRemove = m_platformSurfacesIdToRemove;
m_platformSurfacesIdToRemove.clear();