GraphicsLayerUpdater.cpp [plain text]
#include "config.h"
#include "GraphicsLayerUpdater.h"
#include "DisplayRefreshMonitorManager.h"
#include "GraphicsLayer.h"
namespace WebCore {
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
GraphicsLayerUpdater::GraphicsLayerUpdater(GraphicsLayerUpdaterClient& client, PlatformDisplayID displayID)
: m_client(client)
{
DisplayRefreshMonitorManager::sharedManager().registerClient(*this);
DisplayRefreshMonitorManager::sharedManager().windowScreenDidChange(displayID, *this);
DisplayRefreshMonitorManager::sharedManager().scheduleAnimation(*this);
}
#else
GraphicsLayerUpdater::GraphicsLayerUpdater(GraphicsLayerUpdaterClient&, PlatformDisplayID)
{
}
#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
}
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
void GraphicsLayerUpdater::displayRefreshFired(double timestamp)
{
UNUSED_PARAM(timestamp);
m_scheduled = false;
m_client.flushLayersSoon(*this);
}
#endif
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
RefPtr<DisplayRefreshMonitor> GraphicsLayerUpdater::createDisplayRefreshMonitor(PlatformDisplayID displayID) const
{
return m_client.createDisplayRefreshMonitor(displayID);
}
#endif
}