AcceleratedBackingStore.cpp [plain text]
#include "config.h"
#include "AcceleratedBackingStore.h"
#include "HardwareAccelerationManager.h"
#include "WebPageProxy.h"
#include <WebCore/CairoUtilities.h>
#include <WebCore/PlatformDisplay.h>
#if PLATFORM(WAYLAND)
#include "AcceleratedBackingStoreWayland.h"
#endif
#if PLATFORM(X11)
#include "AcceleratedBackingStoreX11.h"
#endif
namespace WebKit {
using namespace WebCore;
bool AcceleratedBackingStore::checkRequirements()
{
#if PLATFORM(WAYLAND) && USE(EGL)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
return AcceleratedBackingStoreWayland::checkRequirements();
#endif
#if PLATFORM(X11)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
return AcceleratedBackingStoreX11::checkRequirements();
#endif
return false;
}
std::unique_ptr<AcceleratedBackingStore> AcceleratedBackingStore::create(WebPageProxy& webPage)
{
if (!HardwareAccelerationManager::singleton().canUseHardwareAcceleration())
return nullptr;
#if PLATFORM(WAYLAND) && USE(EGL)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::Wayland)
return AcceleratedBackingStoreWayland::create(webPage);
#endif
#if PLATFORM(X11)
if (PlatformDisplay::sharedDisplay().type() == PlatformDisplay::Type::X11)
return AcceleratedBackingStoreX11::create(webPage);
#endif
RELEASE_ASSERT_NOT_REACHED();
return nullptr;
}
AcceleratedBackingStore::AcceleratedBackingStore(WebPageProxy& webPage)
: m_webPage(webPage)
{
}
}