From cfd86b747d32ac22246a1aa908eaa720c63a88c1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 7 Nov 2012 11:22:47 +0100 Subject: Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733) New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes. --- Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp | 28 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp') diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp index 27500635d..9a5418f1e 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp @@ -30,12 +30,28 @@ using namespace WebCore; namespace WebKit { -UpdateAtlas::UpdateAtlas(int dimension, ShareableBitmap::Flags flags) - : m_flags(flags) +UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, ShareableBitmap::Flags flags) + : m_client(client) + , m_flags(flags) , m_inactivityInSeconds(0) + , m_isVaild(true) { + static int nextID = 0; + m_ID = ++nextID; IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); m_surface = ShareableSurface::create(size, flags, ShareableSurface::SupportsGraphicsSurface); + + if (!m_surface->createHandle(m_handle)) { + m_isVaild = false; + return; + } + m_client->createUpdateAtlas(m_ID, m_handle); +} + +UpdateAtlas::~UpdateAtlas() +{ + if (m_isVaild) + m_client->removeUpdateAtlas(m_ID); } void UpdateAtlas::buildLayoutIfNeeded() @@ -51,7 +67,7 @@ void UpdateAtlas::didSwapBuffers() m_areaAllocator.clear(); } -PassOwnPtr UpdateAtlas::beginPaintingOnAvailableBuffer(ShareableSurface::Handle& handle, const WebCore::IntSize& size, IntPoint& offset) +PassOwnPtr UpdateAtlas::beginPaintingOnAvailableBuffer(int& atlasID, const WebCore::IntSize& size, IntPoint& offset) { m_inactivityInSeconds = 0; buildLayoutIfNeeded(); @@ -61,8 +77,10 @@ PassOwnPtr UpdateAtlas::beginPaintingOnAvailableBuffer(Shareabl if (rect.isEmpty()) return PassOwnPtr(); - if (!m_surface->createHandle(handle)) - return PassOwnPtr(); + if (!m_isVaild) + return PassOwnPtr(); + + atlasID = m_ID; // FIXME: Use tri-state buffers, to allow faster updates. offset = rect.location(); -- cgit v1.2.1