GraphicsLayerUpdater.cpp [plain text]
#include "config.h"
#include "GraphicsLayerUpdater.h"
#include "DisplayRefreshMonitorManager.h"
#include "GraphicsLayer.h"
namespace WebCore {
GraphicsLayerUpdater::GraphicsLayerUpdater(GraphicsLayerUpdaterClient* client, PlatformDisplayID displayID)
: m_client(client)
, m_scheduled(false)
{
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
DisplayRefreshMonitorManager::sharedManager().registerClient(this);
DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, this);
DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(this);
#else
UNUSED_PARAM(displayID);
#endif
}
GraphicsLayerUpdater::~GraphicsLayerUpdater()
{
}
void GraphicsLayerUpdater::scheduleUpdate()
{
if (m_scheduled)
return;
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(this);
#endif
m_scheduled = true;
}
void GraphicsLayerUpdater::screenDidChange(PlatformDisplayID displayID)
{
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, this);
#else
UNUSED_PARAM(displayID);
#endif
}
void GraphicsLayerUpdater::displayRefreshFired(double timestamp)
{
UNUSED_PARAM(timestamp);
m_scheduled = false;
if (m_client)
m_client->flushLayersSoon(this);
}
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
PassRefPtr<DisplayRefreshMonitor> GraphicsLayerUpdater::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
{
return m_client ? m_client->createDisplayRefreshMonitor(displayID) : nullptr;
}
#endif
}