Diff
Modified: trunk/Source/WebCore/ChangeLog (225107 => 225108)
--- trunk/Source/WebCore/ChangeLog 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/ChangeLog 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,3 +1,48 @@
+2017-11-23 Zan Dobersek <zdober...@igalia.com>
+
+ [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=179967
+
+ Reviewed by Carlos Garcia Campos.
+
+ Roll the CoordinatedSurface and ThreadSafeCoordinatedSurface classes
+ into one CoordinatedBuffer class.
+
+ CoordinatedBuffer class mimics CoordinatedSurface in providing the
+ Client class that allows specifying how the client should paint using a
+ GraphicsContext object. supportsAlpha() and size() methods are also
+ present, as well as paintToSurface(). uploadImage() retrieves the
+ Image that's created from the contained ImageBuffer, allowing the user
+ to then manually upload the buffer data onto the GPU.
+
+ CoordinatedBuffer otherwise serves as a drop-in replacement for the
+ CoordinatedSurface class, and the remaining changes in the
+ CoordiantedGraphics code reflect that.
+
+ No new tests -- no change in behavior.
+
+ * platform/TextureMapper.cmake:
+ * platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp: Added.
+ (WebCore::CoordinatedBuffer::create):
+ (WebCore::CoordinatedBuffer::CoordinatedBuffer):
+ (WebCore::CoordinatedBuffer::paintToSurface):
+ (WebCore::CoordinatedBuffer::uploadImage):
+ * platform/graphics/texmap/coordinated/CoordinatedBuffer.h: Added.
+ (WebCore::CoordinatedBuffer::supportsAlpha const):
+ (WebCore::CoordinatedBuffer::size const):
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+ (WebCore::CoordinatedGraphicsLayer::paintToSurface):
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
+ * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp:
+ (WebCore::CoordinatedImageBacking::update):
+ (WebCore::CoordinatedImageBacking::releaseSurfaceIfNeeded):
+ * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
+ * platform/graphics/texmap/coordinated/CoordinatedSurface.cpp: Removed.
+ * platform/graphics/texmap/coordinated/CoordinatedSurface.h: Removed.
+ * platform/graphics/texmap/coordinated/Tile.h:
+ * platform/graphics/texmap/coordinated/TiledBackingStoreClient.h:
+
2017-11-22 Simon Fraser <simon.fra...@apple.com>
FEComponentTransfer cleanup and optimization
Modified: trunk/Source/WebCore/platform/TextureMapper.cmake (225107 => 225108)
--- trunk/Source/WebCore/platform/TextureMapper.cmake 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/TextureMapper.cmake 2017-11-23 09:17:08 UTC (rev 225108)
@@ -35,9 +35,9 @@
platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp
platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp
+ platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp
platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp
- platform/graphics/texmap/coordinated/CoordinatedSurface.cpp
platform/graphics/texmap/coordinated/Tile.cpp
platform/graphics/texmap/coordinated/TiledBackingStore.cpp
)
Added: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp (0 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp (rev 0)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CoordinatedBuffer.h"
+
+#if USE(COORDINATED_GRAPHICS)
+
+#include "ImageBuffer.h"
+#include "IntRect.h"
+
+namespace WebCore {
+
+Ref<CoordinatedBuffer> CoordinatedBuffer::create(const IntSize& size, Flags flags)
+{
+ return adoptRef(*new CoordinatedBuffer(size, flags));
+}
+
+CoordinatedBuffer::CoordinatedBuffer(const IntSize& size, Flags flags)
+ : m_imageBuffer(ImageBuffer::create(size, Unaccelerated))
+ , m_size(size)
+ , m_flags(flags)
+{
+}
+
+CoordinatedBuffer::~CoordinatedBuffer() = default;
+
+void CoordinatedBuffer::paintToSurface(const IntRect& rect, Client& client)
+{
+ GraphicsContext& context = m_imageBuffer->context();
+ context.save();
+ context.clip(rect);
+ context.translate(rect.x(), rect.y());
+ client.paintToSurfaceContext(context);
+ context.restore();
+}
+
+RefPtr<Image> CoordinatedBuffer::uploadImage()
+{
+ return m_imageBuffer->copyImage(DontCopyBackingStore);
+}
+
+} // namespace WebCore
+
+#endif // USE(COORDINATED_GRAPHICS)
Added: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h (0 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h (rev 0)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedBuffer.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 Metrological Group B.V.
+ * Copyright (C) 2017 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if USE(COORDINATED_GRAPHICS)
+
+#include "IntSize.h"
+#include <wtf/RefPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
+
+namespace WebCore {
+
+class GraphicsContext;
+class Image;
+class ImageBuffer;
+class IntRect;
+
+class CoordinatedBuffer : public ThreadSafeRefCounted<CoordinatedBuffer> {
+public:
+ enum Flag {
+ NoFlags = 0,
+ SupportsAlpha = 1 << 0,
+ };
+ using Flags = unsigned;
+
+ class Client {
+ public:
+ virtual ~Client() = default;
+ virtual void paintToSurfaceContext(GraphicsContext&) = 0;
+ };
+
+ static Ref<CoordinatedBuffer> create(const IntSize&, Flags);
+ ~CoordinatedBuffer();
+
+ bool supportsAlpha() const { return m_flags & SupportsAlpha; }
+ const IntSize& size() const { return m_size; }
+
+ void paintToSurface(const IntRect&, Client&);
+ RefPtr<Image> uploadImage();
+
+private:
+ CoordinatedBuffer(const IntSize&, Flags);
+
+ std::unique_ptr<ImageBuffer> m_imageBuffer;
+ IntSize m_size;
+ Flags m_flags;
+};
+
+} // namespace WebCore
+
+#endif // USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -892,11 +892,11 @@
return enclosingIntRect(rect);
}
-bool CoordinatedGraphicsLayer::paintToSurface(const IntSize& size, uint32_t& atlas, IntPoint& offset, CoordinatedSurface::Client& client)
+bool CoordinatedGraphicsLayer::paintToSurface(const IntSize& size, uint32_t& atlas, IntPoint& offset, CoordinatedBuffer::Client& client)
{
ASSERT(m_coordinator);
ASSERT(m_coordinator->isFlushingLayerChanges());
- return m_coordinator->paintToSurface(size, contentsOpaque() ? CoordinatedSurface::NoFlags : CoordinatedSurface::SupportsAlpha, atlas, offset, client);
+ return m_coordinator->paintToSurface(size, contentsOpaque() ? CoordinatedBuffer::NoFlags : CoordinatedBuffer::SupportsAlpha, atlas, offset, client);
}
void CoordinatedGraphicsLayer::createTile(uint32_t tileID, float scaleFactor)
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -48,7 +48,7 @@
virtual FloatRect visibleContentsRect() const = 0;
virtual Ref<CoordinatedImageBacking> createImageBackingIfNeeded(Image&) = 0;
virtual void detachLayer(CoordinatedGraphicsLayer*) = 0;
- virtual bool paintToSurface(const IntSize&, CoordinatedSurface::Flags, uint32_t& atlasID, IntPoint&, CoordinatedSurface::Client&) = 0;
+ virtual bool paintToSurface(const IntSize&, CoordinatedBuffer::Flags, uint32_t& atlasID, IntPoint&, CoordinatedBuffer::Client&) = 0;
virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0;
};
@@ -136,7 +136,7 @@
void createTile(uint32_t tileID, float) override;
void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) override;
void removeTile(uint32_t tileID) override;
- bool paintToSurface(const IntSize&, uint32_t& /* atlasID */, IntPoint&, CoordinatedSurface::Client&) override;
+ bool paintToSurface(const IntSize&, uint32_t& /* atlasID */, IntPoint&, CoordinatedBuffer::Client&) override;
void setCoordinator(CoordinatedGraphicsLayerClient*);
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -46,7 +46,7 @@
namespace WebCore {
-class CoordinatedSurface;
+class CoordinatedBuffer;
typedef uint32_t CoordinatedLayerID;
enum { InvalidCoordinatedLayerID = 0 };
@@ -186,15 +186,15 @@
IntRect coveredRect;
Vector<CoordinatedLayerID> layersToCreate;
- Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate;
+ Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState>> layersToUpdate;
Vector<CoordinatedLayerID> layersToRemove;
Vector<CoordinatedImageBackingID> imagesToCreate;
Vector<CoordinatedImageBackingID> imagesToRemove;
- Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > imagesToUpdate;
+ Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedBuffer>>> imagesToUpdate;
Vector<CoordinatedImageBackingID> imagesToClear;
- Vector<std::pair<uint32_t /* atlasID */, RefPtr<CoordinatedSurface> > > updateAtlasesToCreate;
+ Vector<std::pair<uint32_t /* atlasID */, RefPtr<CoordinatedBuffer>>> updateAtlasesToCreate;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -33,7 +33,7 @@
namespace WebCore {
-class ImageBackingSurfaceClient : public CoordinatedSurface::Client {
+class ImageBackingSurfaceClient : public CoordinatedBuffer::Client {
public:
ImageBackingSurfaceClient(Image& image, const IntRect& rect)
: m_image(image)
@@ -118,28 +118,23 @@
}
}
- m_surface = CoordinatedSurface::create(IntSize(m_image->size()), !m_image->currentFrameKnownToBeOpaque() ? CoordinatedSurface::SupportsAlpha : CoordinatedSurface::NoFlags);
- if (!m_surface) {
- m_isDirty = false;
- return;
- }
+ m_buffer = CoordinatedBuffer::create(IntSize(m_image->size()), !m_image->currentFrameKnownToBeOpaque() ? CoordinatedBuffer::SupportsAlpha : CoordinatedBuffer::NoFlags);
+ ASSERT(m_buffer);
IntRect rect(IntPoint::zero(), IntSize(m_image->size()));
ImageBackingSurfaceClient surfaceClient(*m_image, rect);
- m_surface->paintToSurface(rect, surfaceClient);
+ m_buffer->paintToSurface(rect, surfaceClient);
m_nativeImagePtr = m_image->nativeImageForCurrentFrame();
- m_client->updateImageBacking(id(), m_surface.copyRef());
+ m_client->updateImageBacking(id(), m_buffer.copyRef());
m_isDirty = false;
}
void CoordinatedImageBacking::releaseSurfaceIfNeeded()
{
- // We must keep m_surface until UI Process reads m_surface.
- // If m_surface exists, it was created in the previous update.
- m_surface = nullptr;
+ m_buffer = nullptr;
}
static const Seconds clearContentsTimerInterval { 3_s };
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedImageBacking.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -28,8 +28,8 @@
#define CoordinatedImageBacking_h
#if USE(COORDINATED_GRAPHICS)
+#include "CoordinatedBuffer.h"
#include "CoordinatedGraphicsState.h"
-#include "CoordinatedSurface.h"
#include "Image.h"
#include "Timer.h"
#include <wtf/RefCounted.h>
@@ -42,7 +42,7 @@
class Client {
public:
virtual void createImageBacking(CoordinatedImageBackingID) = 0;
- virtual void updateImageBacking(CoordinatedImageBackingID, RefPtr<CoordinatedSurface>&&) = 0;
+ virtual void updateImageBacking(CoordinatedImageBackingID, RefPtr<CoordinatedBuffer>&&) = 0;
virtual void clearImageBackingContents(CoordinatedImageBackingID) = 0;
virtual void removeImageBacking(CoordinatedImageBackingID) = 0;
};
@@ -80,7 +80,7 @@
CoordinatedImageBackingID m_id;
Vector<Host*> m_hosts;
- RefPtr<CoordinatedSurface> m_surface;
+ RefPtr<CoordinatedBuffer> m_buffer;
Timer m_clearContentsTimer;
Deleted: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2013 Company 100, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "CoordinatedSurface.h"
-
-#if USE(COORDINATED_GRAPHICS)
-
-namespace WebCore {
-
-CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0;
-
-void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory)
-{
- s_factory = factory;
-}
-
-RefPtr<CoordinatedSurface> CoordinatedSurface::create(const IntSize& size, Flags flags)
-{
- ASSERT(s_factory);
- return s_factory(size, flags);
-}
-
-CoordinatedSurface::CoordinatedSurface(const IntSize& size, Flags flags)
- : m_size(size)
- , m_flags(flags)
-{
-}
-
-} // namespace WebCore
-
-#endif // USE(COORDINATED_GRAPHICS)
Deleted: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedSurface.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,76 +0,0 @@
-/*
- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2012 Company 100, Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- */
-
-#ifndef CoordinatedSurface_h
-#define CoordinatedSurface_h
-
-#if USE(COORDINATED_GRAPHICS)
-#include "IntRect.h"
-#include <wtf/RefPtr.h>
-#include <wtf/ThreadSafeRefCounted.h>
-
-namespace WebCore {
-class BitmapTexture;
-class GraphicsContext;
-
-class CoordinatedSurface : public ThreadSafeRefCounted<CoordinatedSurface> {
-public:
- enum Flag {
- NoFlags = 0,
- SupportsAlpha = 1 << 0,
- };
- typedef unsigned Flags;
-
- class Client {
- public:
- virtual ~Client() = default;
- virtual void paintToSurfaceContext(GraphicsContext&) = 0;
- };
-
- typedef RefPtr<CoordinatedSurface> Factory(const IntSize&, Flags);
- static void setFactory(Factory);
- static RefPtr<CoordinatedSurface> create(const IntSize&, Flags);
-
- virtual ~CoordinatedSurface() = default;
-
- bool supportsAlpha() const { return flags() & SupportsAlpha; }
- IntSize size() const { return m_size; }
-
- virtual void paintToSurface(const IntRect&, Client&) = 0;
-
-#if USE(TEXTURE_MAPPER)
- virtual void copyToTexture(BitmapTexture&, const IntRect& target, const IntPoint& sourceOffset) = 0;
-#endif
-
-protected:
- CoordinatedSurface(const IntSize&, Flags);
- Flags flags() const { return m_flags; }
-
- IntSize m_size;
- Flags m_flags;
-
-private:
- static CoordinatedSurface::Factory* s_factory;
-};
-
-} // namespace WebCore
-
-#endif // USE(COORDINATED_GRAPHICS)
-#endif // CoordinatedSurface_h
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/Tile.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/Tile.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/Tile.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -27,7 +27,8 @@
#define Tile_h
#if USE(COORDINATED_GRAPHICS)
-#include "CoordinatedSurface.h"
+
+#include "CoordinatedBuffer.h"
#include "IntPoint.h"
#include "IntPointHash.h"
#include "IntRect.h"
@@ -37,7 +38,7 @@
class GraphicsContext;
class TiledBackingStore;
-class Tile : public CoordinatedSurface::Client {
+class Tile : public CoordinatedBuffer::Client {
public:
typedef IntPoint Coordinate;
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/TiledBackingStoreClient.h (225107 => 225108)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/TiledBackingStoreClient.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/TiledBackingStoreClient.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -20,7 +20,7 @@
#ifndef TiledBackingStoreClient_h
#define TiledBackingStoreClient_h
-#include "CoordinatedSurface.h"
+#include "CoordinatedBuffer.h"
namespace WebCore {
@@ -39,7 +39,7 @@
virtual void createTile(uint32_t tileID, float) = 0;
virtual void updateTile(uint32_t tileID, const SurfaceUpdateInfo&, const IntRect&) = 0;
virtual void removeTile(uint32_t tileID) = 0;
- virtual bool paintToSurface(const IntSize&, uint32_t& atlasID, IntPoint&, CoordinatedSurface::Client&) = 0;
+ virtual bool paintToSurface(const IntSize&, uint32_t& atlasID, IntPoint&, CoordinatedBuffer::Client&) = 0;
};
#endif
Modified: trunk/Source/WebKit/ChangeLog (225107 => 225108)
--- trunk/Source/WebKit/ChangeLog 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/ChangeLog 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,3 +1,46 @@
+2017-11-23 Zan Dobersek <zdober...@igalia.com>
+
+ [CoordGraphics] Replace CoordinatedSurface, ThreadSafeCoordinatedSurface with CoordinatedBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=179967
+
+ Reviewed by Carlos Garcia Campos.
+
+ Replace uses of CoordinatedSurface class with CoordinatedBuffer. The
+ ThreadSafeCoordinatedSurface class is removed, along with the code in
+ CoordinatedLayerTreeHost that established a CoordinatedSurface factory.
+
+ * PlatformGTK.cmake:
+ * PlatformWPE.cmake:
+ * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp:
+ (WebKit::CoordinatedBackingStoreTile::swapBuffers):
+ (WebKit::CoordinatedBackingStoreTile::setBackBuffer):
+ (WebKit::CoordinatedBackingStore::updateTile):
+ * Shared/CoordinatedGraphics/CoordinatedBackingStore.h:
+ Rename m_surface to m_buffer, m_surfaceOffset to m_bufferOffset.
+ * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+ (WebKit::CoordinatedGraphicsScene::createUpdateAtlas):
+ (WebKit::CoordinatedGraphicsScene::updateImageBacking):
+ * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
+ * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp: Removed.
+ * Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h: Removed.
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+ (WebKit::CompositingCoordinator::updateImageBacking):
+ (WebKit::CompositingCoordinator::createUpdateAtlas):
+ (WebKit::CompositingCoordinator::paintToSurface):
+ * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+ (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+ (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface): Deleted.
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+ * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp:
+ (WebKit::UpdateAtlas::UpdateAtlas):
+ (WebKit::UpdateAtlas::~UpdateAtlas):
+ (WebKit::UpdateAtlas::paintOnAvailableBuffer):
+ * WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h:
+ Rename m_surface to m_buffer.
+ (WebKit::UpdateAtlas::size const):
+ (WebKit::UpdateAtlas::supportsAlpha const):
+
2017-11-22 Ali Juma <aj...@chromium.org>
Implement VisualViewport API attributes
Modified: trunk/Source/WebKit/PlatformGTK.cmake (225107 => 225108)
--- trunk/Source/WebKit/PlatformGTK.cmake 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/PlatformGTK.cmake 2017-11-23 09:17:08 UTC (rev 225108)
@@ -73,7 +73,6 @@
Shared/CoordinatedGraphics/SimpleViewportController.cpp
Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
- Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp
Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp
Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Modified: trunk/Source/WebKit/PlatformWPE.cmake (225107 => 225108)
--- trunk/Source/WebKit/PlatformWPE.cmake 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/PlatformWPE.cmake 2017-11-23 09:17:08 UTC (rev 225108)
@@ -105,7 +105,6 @@
Shared/CoordinatedGraphics/SimpleViewportController.cpp
Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
- Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp
Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -21,7 +21,8 @@
#include "CoordinatedBackingStore.h"
#if USE(COORDINATED_GRAPHICS)
-#include <WebCore/CoordinatedSurface.h>
+
+#include <WebCore/CoordinatedBuffer.h>
#include <WebCore/GraphicsLayer.h>
#include <WebCore/TextureMapper.h>
#include <WebCore/TextureMapperGL.h>
@@ -32,7 +33,7 @@
void CoordinatedBackingStoreTile::swapBuffers(TextureMapper& textureMapper)
{
- if (!m_surface)
+ if (!m_buffer)
return;
ASSERT(textureMapper.maxTextureSize().width() >= m_tileRect.size().width());
@@ -43,20 +44,21 @@
if (!m_texture || unscaledTileRect != rect()) {
setRect(unscaledTileRect);
- m_texture = textureMapper.acquireTextureFromPool(m_tileRect.size(), m_surface->supportsAlpha() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
- } else if (m_surface->supportsAlpha() == m_texture->isOpaque())
- m_texture->reset(m_tileRect.size(), m_surface->supportsAlpha());
+ m_texture = textureMapper.acquireTextureFromPool(m_tileRect.size(), m_buffer->supportsAlpha() ? BitmapTexture::SupportsAlpha : BitmapTexture::NoFlag);
+ } else if (m_buffer->supportsAlpha() == m_texture->isOpaque())
+ m_texture->reset(m_tileRect.size(), m_buffer->supportsAlpha());
- m_surface->copyToTexture(*m_texture, m_sourceRect, m_surfaceOffset);
- m_surface = nullptr;
+ auto uploadImage = m_buffer->uploadImage();
+ m_texture->updateContents(uploadImage.get(), m_sourceRect, m_bufferOffset, BitmapTexture::UpdateCanModifyOriginalImageData);
+ m_buffer = nullptr;
}
-void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, RefPtr<CoordinatedSurface>&& buffer, const IntPoint& offset)
+void CoordinatedBackingStoreTile::setBackBuffer(const IntRect& tileRect, const IntRect& sourceRect, RefPtr<CoordinatedBuffer>&& buffer, const IntPoint& offset)
{
m_sourceRect = sourceRect;
m_tileRect = tileRect;
- m_surfaceOffset = offset;
- m_surface = WTFMove(buffer);
+ m_bufferOffset = offset;
+ m_buffer = WTFMove(buffer);
}
void CoordinatedBackingStore::createTile(uint32_t id, float scale)
@@ -77,11 +79,11 @@
m_tilesToRemove.add(key);
}
-void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, RefPtr<CoordinatedSurface>&& backBuffer, const IntPoint& offset)
+void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect& sourceRect, const IntRect& tileRect, RefPtr<CoordinatedBuffer>&& buffer, const IntPoint& offset)
{
CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id);
ASSERT(it != m_tiles.end());
- it->value.setBackBuffer(tileRect, sourceRect, WTFMove(backBuffer), offset);
+ it->value.setBackBuffer(tileRect, sourceRect, WTFMove(buffer), offset);
}
RefPtr<BitmapTexture> CoordinatedBackingStore::texture() const
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -30,7 +30,7 @@
namespace WebCore {
-class CoordinatedSurface;
+class CoordinatedBuffer;
}
namespace WebKit {
@@ -45,13 +45,13 @@
inline float scale() const { return m_scale; }
void swapBuffers(WebCore::TextureMapper&);
- void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, RefPtr<WebCore::CoordinatedSurface>&& buffer, const WebCore::IntPoint&);
+ void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, RefPtr<WebCore::CoordinatedBuffer>&&, const WebCore::IntPoint&);
private:
- RefPtr<WebCore::CoordinatedSurface> m_surface;
+ RefPtr<WebCore::CoordinatedBuffer> m_buffer;
WebCore::IntRect m_sourceRect;
WebCore::IntRect m_tileRect;
- WebCore::IntPoint m_surfaceOffset;
+ WebCore::IntPoint m_bufferOffset;
float m_scale;
};
@@ -60,7 +60,7 @@
void createTile(uint32_t tileID, float);
void removeTile(uint32_t tileID);
void removeAllTiles();
- void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, RefPtr<WebCore::CoordinatedSurface>&&, const WebCore::IntPoint&);
+ void updateTile(uint32_t tileID, const WebCore::IntRect&, const WebCore::IntRect&, RefPtr<WebCore::CoordinatedBuffer>&&, const WebCore::IntPoint&);
static Ref<CoordinatedBackingStore> create() { return adoptRef(*new CoordinatedBackingStore); }
void commitTileOperations(WebCore::TextureMapper&);
RefPtr<WebCore::BitmapTexture> texture() const override;
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -438,10 +438,10 @@
createUpdateAtlas(atlas.first, atlas.second.copyRef());
}
-void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, RefPtr<CoordinatedSurface>&& surface)
+void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, RefPtr<CoordinatedBuffer>&& buffer)
{
ASSERT(!m_surfaces.contains(atlasID));
- m_surfaces.add(atlasID, WTFMove(surface));
+ m_surfaces.add(atlasID, WTFMove(buffer));
}
void CoordinatedGraphicsScene::removeUpdateAtlas(uint32_t atlasID)
@@ -477,7 +477,7 @@
m_imageBackings.add(imageID, CoordinatedBackingStore::create());
}
-void CoordinatedGraphicsScene::updateImageBacking(CoordinatedImageBackingID imageID, RefPtr<CoordinatedSurface>&& surface)
+void CoordinatedGraphicsScene::updateImageBacking(CoordinatedImageBackingID imageID, RefPtr<CoordinatedBuffer>&& buffer)
{
ASSERT(m_imageBackings.contains(imageID));
auto it = m_imageBackings.find(imageID);
@@ -485,11 +485,11 @@
// CoordinatedImageBacking is realized to CoordinatedBackingStore with only one tile in UI Process.
backingStore->createTile(1 /* id */, 1 /* scale */);
- IntRect rect(IntPoint::zero(), surface->size());
+ IntRect rect(IntPoint::zero(), buffer->size());
// See CoordinatedGraphicsLayer::shouldDirectlyCompositeImage()
ASSERT(2000 >= std::max(rect.width(), rect.height()));
backingStore->setSize(rect.size());
- backingStore->updateTile(1 /* id */, rect, rect, WTFMove(surface), rect.location());
+ backingStore->updateTile(1 /* id */, rect, rect, WTFMove(buffer), rect.location());
m_backingStoresWithPendingBuffers.add(backingStore);
}
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -22,8 +22,9 @@
#define CoordinatedGraphicsScene_h
#if USE(COORDINATED_GRAPHICS)
+
+#include <WebCore/CoordinatedBuffer.h>
#include <WebCore/CoordinatedGraphicsState.h>
-#include <WebCore/CoordinatedSurface.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/GraphicsLayer.h>
#include <WebCore/IntRect.h>
@@ -107,12 +108,12 @@
void setLayerRepaintCountIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&);
void syncUpdateAtlases(const WebCore::CoordinatedGraphicsState&);
- void createUpdateAtlas(uint32_t atlasID, RefPtr<WebCore::CoordinatedSurface>&&);
+ void createUpdateAtlas(uint32_t atlasID, RefPtr<WebCore::CoordinatedBuffer>&&);
void removeUpdateAtlas(uint32_t atlasID);
void syncImageBackings(const WebCore::CoordinatedGraphicsState&);
void createImageBacking(WebCore::CoordinatedImageBackingID);
- void updateImageBacking(WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedSurface>&&);
+ void updateImageBacking(WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedBuffer>&&);
void clearImageBackingContents(WebCore::CoordinatedImageBackingID);
void removeImageBacking(WebCore::CoordinatedImageBackingID);
@@ -161,7 +162,7 @@
HashMap<WebCore::TextureMapperLayer*, RefPtr<WebCore::TextureMapperPlatformLayerProxy>> m_platformLayerProxies;
#endif
- HashMap<uint32_t /* atlasID */, RefPtr<WebCore::CoordinatedSurface>> m_surfaces;
+ HashMap<uint32_t /* atlasID */, RefPtr<WebCore::CoordinatedBuffer>> m_surfaces;
// Below two members are accessed by only the main thread. The painting thread must lock the main thread to access both members.
CoordinatedGraphicsSceneClient* m_client;
Deleted: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if USE(COORDINATED_GRAPHICS)
-#include "ThreadSafeCoordinatedSurface.h"
-
-#include <WebCore/TextureMapperGL.h>
-#include <wtf/StdLibExtras.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-Ref<ThreadSafeCoordinatedSurface> ThreadSafeCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags)
-{
- // Making an unconditionally unaccelerated buffer here is OK because this code
- // isn't used by any platforms that respect the accelerated bit.
- return adoptRef(*new ThreadSafeCoordinatedSurface(size, flags, ImageBuffer::create(size, Unaccelerated)));
-}
-
-ThreadSafeCoordinatedSurface::ThreadSafeCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags, std::unique_ptr<ImageBuffer> buffer)
- : CoordinatedSurface(size, flags)
- , m_imageBuffer(WTFMove(buffer))
-{
-}
-
-ThreadSafeCoordinatedSurface::~ThreadSafeCoordinatedSurface()
-{
-}
-
-void ThreadSafeCoordinatedSurface::paintToSurface(const IntRect& rect, CoordinatedSurface::Client& client)
-{
- GraphicsContext& context = beginPaint(rect);
- client.paintToSurfaceContext(context);
- endPaint();
-}
-
-GraphicsContext& ThreadSafeCoordinatedSurface::beginPaint(const IntRect& rect)
-{
- ASSERT(m_imageBuffer);
- GraphicsContext& graphicsContext = m_imageBuffer->context();
- graphicsContext.save();
- graphicsContext.clip(rect);
- graphicsContext.translate(rect.x(), rect.y());
- return graphicsContext;
-}
-
-void ThreadSafeCoordinatedSurface::endPaint()
-{
- ASSERT(m_imageBuffer);
- m_imageBuffer->context().restore();
-}
-
-void ThreadSafeCoordinatedSurface::copyToTexture(BitmapTexture& texture, const IntRect& target, const IntPoint& sourceOffset)
-{
- ASSERT(m_imageBuffer);
- RefPtr<Image> image = m_imageBuffer->copyImage(DontCopyBackingStore);
- texture.updateContents(image.get(), target, sourceOffset, BitmapTexture::UpdateCanModifyOriginalImageData);
-}
-
-} // namespace WebCore
-
-#endif // USE(COORDINATED_GRAPHICS)
Deleted: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h (225107 => 225108)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ThreadSafeCoordinatedSurface_h
-#define ThreadSafeCoordinatedSurface_h
-
-#if USE(COORDINATED_GRAPHICS)
-#include <WebCore/CoordinatedSurface.h>
-#include <WebCore/ImageBuffer.h>
-
-namespace WebKit {
-
-class ThreadSafeCoordinatedSurface : public WebCore::CoordinatedSurface {
-public:
- virtual ~ThreadSafeCoordinatedSurface();
-
- // Create a new ThreadSafeCoordinatedSurface and allocate either a GraphicsSurface or a ImageBuffer as backing.
- static Ref<ThreadSafeCoordinatedSurface> create(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
-
- void paintToSurface(const WebCore::IntRect&, WebCore::CoordinatedSurface::Client&) override;
- void copyToTexture(WebCore::BitmapTexture&, const WebCore::IntRect& target, const WebCore::IntPoint& sourceOffset) override;
-
-private:
- ThreadSafeCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, std::unique_ptr<WebCore::ImageBuffer>);
-
- WebCore::GraphicsContext& beginPaint(const WebCore::IntRect&);
- void endPaint();
-
- std::unique_ptr<WebCore::ImageBuffer> m_imageBuffer;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
-
-#endif // ThreadSafeCoordinatedSurface_h
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -224,10 +224,10 @@
m_state.imagesToCreate.append(imageID);
}
-void CompositingCoordinator::updateImageBacking(CoordinatedImageBackingID imageID, RefPtr<CoordinatedSurface>&& coordinatedSurface)
+void CompositingCoordinator::updateImageBacking(CoordinatedImageBackingID imageID, RefPtr<CoordinatedBuffer>&& buffer)
{
m_shouldSyncFrame = true;
- m_state.imagesToUpdate.append(std::make_pair(imageID, WTFMove(coordinatedSurface)));
+ m_state.imagesToUpdate.append(std::make_pair(imageID, WTFMove(buffer)));
}
void CompositingCoordinator::clearImageBackingContents(CoordinatedImageBackingID imageID)
@@ -293,9 +293,9 @@
return m_page->pageScaleFactor();
}
-void CompositingCoordinator::createUpdateAtlas(uint32_t atlasID, RefPtr<CoordinatedSurface>&& coordinatedSurface)
+void CompositingCoordinator::createUpdateAtlas(uint32_t atlasID, RefPtr<CoordinatedBuffer>&& buffer)
{
- m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, WTFMove(coordinatedSurface)));
+ m_state.updateAtlasesToCreate.append(std::make_pair(atlasID, WTFMove(buffer)));
}
void CompositingCoordinator::removeUpdateAtlas(uint32_t atlasID)
@@ -385,11 +385,11 @@
m_updateAtlases.clear();
}
-bool CompositingCoordinator::paintToSurface(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client& client)
+bool CompositingCoordinator::paintToSurface(const IntSize& size, CoordinatedBuffer::Flags flags, uint32_t& atlasID, IntPoint& offset, CoordinatedBuffer::Client& client)
{
for (auto& updateAtlas : m_updateAtlases) {
UpdateAtlas* atlas = updateAtlas.get();
- if (atlas->supportsAlpha() == (flags & CoordinatedSurface::SupportsAlpha)) {
+ if (atlas->supportsAlpha() == (flags & CoordinatedBuffer::SupportsAlpha)) {
// This will be false if there is no available buffer space.
if (atlas->paintOnAvailableBuffer(size, atlasID, offset, client))
return true;
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -39,10 +39,10 @@
#include <WebCore/IntRect.h>
namespace WebCore {
-class Page;
+class CoordinatedBuffer;
class GraphicsContext;
class GraphicsLayer;
-class CoordinatedSurface;
+class Page;
}
namespace WebKit {
@@ -107,7 +107,7 @@
// CoordinatedImageBacking::Client
void createImageBacking(WebCore::CoordinatedImageBackingID) override;
- void updateImageBacking(WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedSurface>&&) override;
+ void updateImageBacking(WebCore::CoordinatedImageBackingID, RefPtr<WebCore::CoordinatedBuffer>&&) override;
void clearImageBackingContents(WebCore::CoordinatedImageBackingID) override;
void removeImageBacking(WebCore::CoordinatedImageBackingID) override;
@@ -116,11 +116,11 @@
WebCore::FloatRect visibleContentsRect() const override;
Ref<WebCore::CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image&) override;
void detachLayer(WebCore::CoordinatedGraphicsLayer*) override;
- bool paintToSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags, uint32_t& /* atlasID */, WebCore::IntPoint&, WebCore::CoordinatedSurface::Client&) override;
+ bool paintToSurface(const WebCore::IntSize&, WebCore::CoordinatedBuffer::Flags, uint32_t& /* atlasID */, WebCore::IntPoint&, WebCore::CoordinatedBuffer::Client&) override;
void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override;
// UpdateAtlas::Client
- void createUpdateAtlas(uint32_t atlasID, RefPtr<WebCore::CoordinatedSurface>&&) override;
+ void createUpdateAtlas(uint32_t atlasID, RefPtr<WebCore::CoordinatedBuffer>&&) override;
void removeUpdateAtlas(uint32_t atlasID) override;
// GraphicsLayerFactory
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -37,10 +37,6 @@
#include <WebCore/MainFrame.h>
#include <WebCore/PageOverlayController.h>
-#if USE(COORDINATED_GRAPHICS_THREADED)
-#include "ThreadSafeCoordinatedSurface.h"
-#endif
-
#if USE(GLIB_EVENT_LOOP)
#include <wtf/glib/RunLoopSourcePriority.h>
#endif
@@ -69,7 +65,6 @@
#endif
m_coordinator.createRootLayer(m_webPage.size());
- CoordinatedSurface::setFactory(createCoordinatedSurface);
scheduleLayerFlush();
}
@@ -219,17 +214,6 @@
m_isWaitingForRenderer = true;
}
-RefPtr<CoordinatedSurface> CoordinatedLayerTreeHost::createCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags)
-{
-#if USE(COORDINATED_GRAPHICS_THREADED)
- return ThreadSafeCoordinatedSurface::create(size, flags);
-#else
- UNUSED_PARAM(size);
- UNUSED_PARAM(flags);
- return nullptr;
-#endif
-}
-
void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
{
m_coordinator.deviceOrPageScaleFactorChanged();
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -29,7 +29,6 @@
#include <wtf/RunLoop.h>
namespace WebCore {
-class CoordinatedSurface;
class GraphicsLayerFactory;
}
@@ -80,8 +79,6 @@
private:
void layerFlushTimerFired();
- static RefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
-
CompositingCoordinator m_coordinator;
bool m_isWaitingForRenderer { true };
bool m_scheduledWhileWaitingForRenderer { false };
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp 2017-11-23 09:17:08 UTC (rev 225108)
@@ -32,9 +32,9 @@
namespace WebKit {
-class UpdateAtlasSurfaceClient final : public CoordinatedSurface::Client {
+class UpdateAtlasSurfaceClient final : public CoordinatedBuffer::Client {
public:
- UpdateAtlasSurfaceClient(CoordinatedSurface::Client& client, const IntSize& size, bool supportsAlpha)
+ UpdateAtlasSurfaceClient(CoordinatedBuffer::Client& client, const IntSize& size, bool supportsAlpha)
: m_client(client)
, m_size(size)
, m_supportsAlpha(supportsAlpha)
@@ -53,26 +53,24 @@
}
private:
- CoordinatedSurface::Client& m_client;
+ CoordinatedBuffer::Client& m_client;
IntSize m_size;
bool m_supportsAlpha;
};
-UpdateAtlas::UpdateAtlas(Client& client, int dimension, CoordinatedSurface::Flags flags)
+UpdateAtlas::UpdateAtlas(Client& client, int dimension, CoordinatedBuffer::Flags flags)
: m_client(client)
+ , m_buffer(CoordinatedBuffer::create(nextPowerOfTwo(IntSize(dimension, dimension)), flags))
{
static uint32_t nextID = 0;
m_ID = ++nextID;
- IntSize size = nextPowerOfTwo(IntSize(dimension, dimension));
- m_surface = CoordinatedSurface::create(size, flags);
- m_client.createUpdateAtlas(m_ID, m_surface.copyRef());
+ m_client.createUpdateAtlas(m_ID, m_buffer.copyRef());
}
UpdateAtlas::~UpdateAtlas()
{
- if (m_surface)
- m_client.removeUpdateAtlas(m_ID);
+ m_client.removeUpdateAtlas(m_ID);
}
void UpdateAtlas::buildLayoutIfNeeded()
@@ -88,7 +86,7 @@
m_areaAllocator = nullptr;
}
-bool UpdateAtlas::paintOnAvailableBuffer(const IntSize& size, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client& client)
+bool UpdateAtlas::paintOnAvailableBuffer(const IntSize& size, uint32_t& atlasID, IntPoint& offset, CoordinatedBuffer::Client& client)
{
m_inactivityInSeconds = 0;
buildLayoutIfNeeded();
@@ -98,9 +96,6 @@
if (rect.isEmpty())
return false;
- if (!m_surface)
- return false;
-
atlasID = m_ID;
// FIXME: Use tri-state buffers, to allow faster updates.
@@ -107,7 +102,7 @@
offset = rect.location();
UpdateAtlasSurfaceClient surfaceClient(client, size, supportsAlpha());
- m_surface->paintToSurface(rect, surfaceClient);
+ m_buffer->paintToSurface(rect, surfaceClient);
return true;
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h (225107 => 225108)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h 2017-11-23 06:47:41 UTC (rev 225107)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h 2017-11-23 09:17:08 UTC (rev 225108)
@@ -22,7 +22,7 @@
#define UpdateAtlas_h
#include "AreaAllocator.h"
-#include <WebCore/CoordinatedSurface.h>
+#include <WebCore/CoordinatedBuffer.h>
#include <WebCore/IntSize.h>
#include <wtf/RefPtr.h>
@@ -40,19 +40,19 @@
public:
class Client {
public:
- virtual void createUpdateAtlas(uint32_t /* id */, RefPtr<WebCore::CoordinatedSurface>&&) = 0;
+ virtual void createUpdateAtlas(uint32_t /* id */, RefPtr<WebCore::CoordinatedBuffer>&&) = 0;
virtual void removeUpdateAtlas(uint32_t /* id */) = 0;
};
- UpdateAtlas(Client&, int dimension, WebCore::CoordinatedSurface::Flags);
+ UpdateAtlas(Client&, int dimension, WebCore::CoordinatedBuffer::Flags);
~UpdateAtlas();
- inline WebCore::IntSize size() const { return m_surface->size(); }
+ const WebCore::IntSize& size() const { return m_buffer->size(); }
// Returns false if there is no available buffer.
- bool paintOnAvailableBuffer(const WebCore::IntSize&, uint32_t& atlasID, WebCore::IntPoint& offset, WebCore::CoordinatedSurface::Client&);
+ bool paintOnAvailableBuffer(const WebCore::IntSize&, uint32_t& atlasID, WebCore::IntPoint& offset, WebCore::CoordinatedBuffer::Client&);
void didSwapBuffers();
- bool supportsAlpha() const { return m_surface->supportsAlpha(); }
+ bool supportsAlpha() const { return m_buffer->supportsAlpha(); }
void addTimeInactive(double seconds)
{
@@ -72,7 +72,7 @@
private:
Client& m_client;
std::unique_ptr<GeneralAreaAllocator> m_areaAllocator;
- RefPtr<WebCore::CoordinatedSurface> m_surface;
+ Ref<WebCore::CoordinatedBuffer> m_buffer;
double m_inactivityInSeconds { 0 };
uint32_t m_ID { 0 };
};