Changeset 269824 in webkit
- Timestamp:
- Nov 15, 2020, 1:30:54 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (3 diffs)
-
WebCore/platform/graphics/ConcreteImageBuffer.h (modified) (1 diff)
-
WebCore/platform/graphics/ImageBuffer.h (modified) (1 diff)
-
WebCore/platform/graphics/ImageBufferBackend.h (modified) (2 diffs)
-
WebCore/platform/graphics/cg/IOSurfacePool.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp (modified) (3 diffs)
-
WebCore/platform/graphics/cg/ImageBufferCGBackend.h (modified) (1 diff)
-
WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h (modified) (2 diffs)
-
WebCore/platform/graphics/cocoa/IOSurface.h (modified) (2 diffs)
-
WebCore/platform/graphics/cocoa/IOSurface.mm (modified) (4 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h (modified) (6 diffs)
-
WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (modified) (11 diffs)
-
WebKit/UIProcess/ViewSnapshotStore.h (modified) (1 diff)
-
WebKit/UIProcess/mac/ViewSnapshotStoreMac.mm (modified) (3 diffs)
-
WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h (modified) (1 diff)
-
WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (modified) (3 diffs)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (modified) (3 diffs)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm (modified) (1 diff)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h (modified) (3 diffs)
-
WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (modified) (4 diffs)
-
WebKit/WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
-
WebKit/WebProcess/WebPage/WebPage.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r269823 r269824 1 2020-11-15 Tim Horton <timothy_horton@apple.com> 2 3 Initial implementation of DOM rendering via the GPU process 4 https://bugs.webkit.org/show_bug.cgi?id=218928 5 6 Reviewed by Simon Fraser. 7 8 No new tests; will be covered by all existing DOM rendering tests in GPU process mode. 9 10 * WebCore.xcodeproj/project.pbxproj: 11 * platform/graphics/ConcreteImageBuffer.h: 12 * platform/graphics/ImageBuffer.h: 13 * platform/graphics/ImageBufferBackend.h: 14 (WebCore::ImageBufferBackend::isInUse const): 15 (WebCore::ImageBufferBackend::releaseGraphicsContext): 16 (WebCore::ImageBufferBackend::setVolatile): 17 (WebCore::ImageBufferBackend::releaseBufferToPool): 18 (WebCore::ImageBufferBackend::createFlusher): 19 * platform/graphics/cg/IOSurfacePool.cpp: 20 (WebCore::IOSurfacePool::takeSurface): 21 (WebCore::IOSurfacePool::markOlderSurfacesPurgeable): 22 * platform/graphics/cg/ImageBufferCGBackend.cpp: 23 (WebCore::ThreadSafeImageBufferFlusherCG::ThreadSafeImageBufferFlusherCG): 24 (WebCore::ImageBufferCGBackend::contextColorSpace): 25 (WebCore::ImageBufferCGBackend::setupContext const): 26 (WebCore::ImageBufferCGBackend::createFlusher): 27 (WebCore::ImageBufferCGBackend::setupContext): Deleted. 28 * platform/graphics/cg/ImageBufferCGBackend.h: 29 * platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp: 30 (WebCore::ImageBufferIOSurfaceBackend::context const): 31 (WebCore::ImageBufferIOSurfaceBackend::isInUse const): 32 (WebCore::ImageBufferIOSurfaceBackend::releaseGraphicsContext): 33 (WebCore::ImageBufferIOSurfaceBackend::setVolatile): 34 (WebCore::ImageBufferIOSurfaceBackend::releaseBufferToPool): 35 * platform/graphics/cg/ImageBufferIOSurfaceBackend.h: 36 Add isInUse, setVolatile, and releaseGraphicsContext to ImageBuffer, 37 to manage volatile surfaces; they're only implemented for in-process 38 IOSurface right now, in order to keep RemoteLayerBackingStore working 39 after transitioning it to ImageBuffer. A future patch will determine 40 how to implement this mechanism for remote IOSurfaces. 41 42 Add createFlusher to ImageBuffer, which returns an object that can 43 be tossed to a background queue, and has one method: flush(), which 44 blocks until the ImageBuffer's oustanding painting is flushed. This is 45 currently implemented for CG just by calling CGContextFlush. This 46 is used to abstract out RemoteLayerBackingStore's background-thread 47 flush of all surfaces. 48 49 * platform/graphics/cocoa/IOSurface.h: 50 * platform/graphics/cocoa/IOSurface.mm: 51 (WebCore::IOSurface::state const): 52 (WebCore::IOSurface::setVolatile): 53 (WebCore::operator<<): 54 (WebCore::IOSurface::setIsVolatile): Deleted. 55 Make use of VolatilityState instead of SurfaceState. 56 57 1 58 2020-11-15 Julian Gonzalez <julian_a_gonzalez@apple.com> 2 59 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r269812 r269824 754 754 2D70BA1318074DDF0001908A /* PlatformCALayerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D70BA1218074DDF0001908A /* PlatformCALayerCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; }; 755 755 2D76BB821945632400CFD29A /* RunLoopObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D76BB801945632400CFD29A /* RunLoopObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; 756 2D7705C7255276CD001D0C94 /* PlatformImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3A623E17328008D741C /* PlatformImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 757 2D7705C925528D34001D0C94 /* ImageBufferCGBitmapBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3AA23E1E544008D741C /* ImageBufferCGBitmapBackend.h */; settings = {ATTRIBUTES = (Private, ); }; }; 756 758 2D7DA0F22435EB1900F048D1 /* WebViewVisualIdentificationOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7DA0EF2435EB1700F048D1 /* WebViewVisualIdentificationOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; }; 757 759 2D7ED0AB1BAE99170043B3E5 /* TimerEventBasedMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D7ED0A91BAE99170043B3E5 /* TimerEventBasedMock.h */; }; … … 32182 32184 72BAC3AE23E1F0B0008D741C /* ImageBufferBackend.h in Headers */, 32183 32185 550640B02407587E00AAE045 /* ImageBufferCGBackend.h in Headers */, 32186 2D7705C925528D34001D0C94 /* ImageBufferCGBitmapBackend.h in Headers */, 32184 32187 727A7F3A24078B84004D2931 /* ImageBufferIOSurfaceBackend.h in Headers */, 32185 32188 B2A10D910B3818BD00099AA4 /* ImageBufferPipe.h in Headers */, … … 33715 33718 515BE1951D54F5FB00DD7C68 /* PlatformGamepad.h in Headers */, 33716 33719 726D56E2253AE28D0002EF90 /* PlatformImage.h in Headers */, 33720 2D7705C7255276CD001D0C94 /* PlatformImageBuffer.h in Headers */, 33717 33721 550640AF2407582D00AAE045 /* PlatformImageBufferBackend.h in Headers */, 33718 33722 935C476809AC4D4300A6AAB4 /* PlatformKeyboardEvent.h in Headers */, -
trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h
r269724 r269824 259 259 } 260 260 261 bool isInUse() const override 262 { 263 if (auto* backend = ensureBackendCreated()) 264 return backend->isInUse(); 265 return false; 266 } 267 268 void releaseGraphicsContext() override 269 { 270 if (auto* backend = ensureBackendCreated()) 271 return backend->releaseGraphicsContext(); 272 } 273 274 VolatilityState setVolatile(bool isVolatile) override 275 { 276 if (auto* backend = ensureBackendCreated()) 277 return backend->setVolatile(isVolatile); 278 return VolatilityState::Valid; 279 } 280 281 std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() override 282 { 283 if (auto* backend = ensureBackendCreated()) 284 return backend->createFlusher(); 285 return nullptr; 286 } 287 288 void releaseBufferToPool() override 289 { 290 if (auto* backend = ensureBackendCreated()) 291 backend->releaseBufferToPool(); 292 } 293 261 294 std::unique_ptr<BackendType> m_backend; 262 295 RenderingResourceIdentifier m_renderingResourceIdentifier; -
trunk/Source/WebCore/platform/graphics/ImageBuffer.h
r269724 r269824 84 84 virtual size_t externalMemoryCost() const = 0; 85 85 86 virtual bool isInUse() const = 0; 87 virtual void releaseGraphicsContext() = 0; 88 virtual VolatilityState setVolatile(bool) = 0; 89 virtual void releaseBufferToPool() = 0; 90 91 virtual std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() = 0; 92 86 93 virtual RefPtr<NativeImage> copyNativeImage(BackingStoreCopy = CopyBackingStore) const = 0; 87 94 virtual RefPtr<Image> copyImage(BackingStoreCopy = CopyBackingStore, PreserveResolution = PreserveResolution::No) const = 0; -
trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h
r269724 r269824 62 62 }; 63 63 64 enum class VolatilityState : uint8_t { 65 Valid, 66 Empty 67 }; 68 69 class ThreadSafeImageBufferFlusher { 70 WTF_MAKE_FAST_ALLOCATED; 71 WTF_MAKE_NONCOPYABLE(ThreadSafeImageBufferFlusher); 72 public: 73 ThreadSafeImageBufferFlusher() = default; 74 virtual ~ThreadSafeImageBufferFlusher() = default; 75 virtual void flush() = 0; 76 }; 77 64 78 class ImageBufferBackend { 65 79 public: … … 105 119 virtual PlatformLayer* platformLayer() const { return nullptr; } 106 120 virtual bool copyToPlatformTexture(GraphicsContextGLOpenGL&, GCGLenum, PlatformGLObject, GCGLenum, bool, bool) const { return false; } 121 122 virtual bool isInUse() const { return false; } 123 virtual void releaseGraphicsContext() { ASSERT_NOT_REACHED(); } 124 virtual VolatilityState setVolatile(bool) { return VolatilityState::Valid; } 125 virtual void releaseBufferToPool() { } 126 127 virtual std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() { return nullptr; } 107 128 108 129 static constexpr bool isOriginAtUpperLeftCorner = false; -
trunk/Source/WebCore/platform/graphics/cg/IOSurfacePool.cpp
r228853 r269824 132 132 didRemoveSurface(*surface, false); 133 133 134 surface->set IsVolatile(false);134 surface->setVolatile(false); 135 135 136 136 DUMP_POOL_STATISTICS("takeSurface - taking"); … … 149 149 didRemoveSurface(*surface, true); 150 150 151 surface->set IsVolatile(false);151 surface->setVolatile(false); 152 152 153 153 DUMP_POOL_STATISTICS("takeSurface - taking in-use"); … … 299 299 } 300 300 301 surfaceAndDetails.key->set IsVolatile(true);301 surfaceAndDetails.key->setVolatile(true); 302 302 surfaceAndDetails.value.hasMarkedPurgeable = true; 303 303 } -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp
r269724 r269824 44 44 namespace WebCore { 45 45 46 class ThreadSafeImageBufferFlusherCG : public ThreadSafeImageBufferFlusher { 47 WTF_MAKE_FAST_ALLOCATED; 48 public: 49 ThreadSafeImageBufferFlusherCG(CGContextRef context) 50 : m_context(context) 51 { 52 } 53 54 void flush() override 55 { 56 CGContextFlush(m_context.get()); 57 } 58 59 private: 60 RetainPtr<CGContextRef> m_context; 61 }; 62 46 63 RetainPtr<CGColorSpaceRef> ImageBufferCGBackend::contextColorSpace(const GraphicsContext& context) 47 64 { … … 58 75 #endif 59 76 } 60 # 61 62 void ImageBufferCGBackend::setupContext() 77 78 void ImageBufferCGBackend::setupContext() const 63 79 { 64 80 // The initial CTM matches DisplayList::Recorder::clipToDrawingCommands()'s initial CTM. … … 208 224 } 209 225 226 std::unique_ptr<ThreadSafeImageBufferFlusher> ImageBufferCGBackend::createFlusher() 227 { 228 return WTF::makeUnique<ThreadSafeImageBufferFlusherCG>(context().platformContext()); 229 } 230 210 231 #if USE(ACCELERATE) 211 232 static inline vImage_Buffer makeVImageBuffer(unsigned bytesPerRow, uint8_t* rows, const IntSize& size) -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.h
r269724 r269824 47 47 Vector<uint8_t> toData(const String& mimeType, Optional<double> quality) const override; 48 48 49 std::unique_ptr<ThreadSafeImageBufferFlusher> createFlusher() override; 50 49 51 protected: 50 52 using ImageBufferBackend::ImageBufferBackend; 51 53 52 54 static RetainPtr<CGColorSpaceRef> contextColorSpace(const GraphicsContext&); 53 void setupContext() ;55 void setupContext() const; 54 56 virtual RetainPtr<CFDataRef> toCFData(const String& mimeType, Optional<double> quality, PreserveResolution) const; 55 57 -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp
r269710 r269824 107 107 GraphicsContext& ImageBufferIOSurfaceBackend::context() const 108 108 { 109 return m_surface->ensureGraphicsContext(); 109 110 GraphicsContext& context = m_surface->ensureGraphicsContext(); 111 if (m_needsSetupContext) { 112 m_needsSetupContext = false; 113 setupContext(); 114 } 115 return context; 110 116 } 111 117 … … 185 191 } 186 192 193 bool ImageBufferIOSurfaceBackend::isInUse() const 194 { 195 return m_surface->isInUse(); 196 } 197 198 void ImageBufferIOSurfaceBackend::releaseGraphicsContext() 199 { 200 m_needsSetupContext = true; 201 return m_surface->releaseGraphicsContext(); 202 } 203 204 VolatilityState ImageBufferIOSurfaceBackend::setVolatile(bool isVolatile) 205 { 206 return m_surface->setVolatile(isVolatile); 207 } 208 209 void ImageBufferIOSurfaceBackend::releaseBufferToPool() 210 { 211 IOSurface::moveToPool(WTFMove(m_surface)); 212 } 213 187 214 } // namespace WebCore 188 215 -
trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h
r269710 r269824 64 64 IOSurface* surface(); 65 65 66 bool isInUse() const override; 67 void releaseGraphicsContext() override; 68 VolatilityState setVolatile(bool) override; 69 void releaseBufferToPool() override; 70 66 71 static constexpr bool isOriginAtUpperLeftCorner = true; 67 72 static constexpr bool isAccelerated = true; … … 73 78 std::unique_ptr<IOSurface> m_surface; 74 79 mutable bool m_requiresDrawAfterPutImageData { false }; 80 81 mutable bool m_needsSetupContext { false }; 75 82 }; 76 83 -
trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h
r269710 r269824 51 51 52 52 enum class PixelFormat : uint8_t; 53 enum class VolatilityState : uint8_t; 53 54 54 55 class IOSurface final { … … 129 130 WEBCORE_EXPORT CGContextRef ensurePlatformContext(const HostWindow* = nullptr); 130 131 131 enum class SurfaceState {132 Valid,133 Empty134 };135 136 132 // Querying volatility can be expensive, so in cases where the surface is 137 // going to be used immediately, use the return value of set IsVolatile to133 // going to be used immediately, use the return value of setVolatile to 138 134 // determine whether the data was purged, instead of first calling state() or isVolatile(). 139 SurfaceState state() const;135 VolatilityState state() const; 140 136 bool isVolatile() const; 141 137 142 // setIsVolatile only has an effect on iOS and OS 10.9 and above. 143 WEBCORE_EXPORT SurfaceState setIsVolatile(bool); 138 WEBCORE_EXPORT VolatilityState setVolatile(bool); 144 139 145 140 IntSize size() const { return m_size; } -
trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm
r269710 r269824 325 325 } 326 326 327 IOSurface::SurfaceState IOSurface::state() const327 VolatilityState IOSurface::state() const 328 328 { 329 329 uint32_t previousState = 0; 330 330 IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), kIOSurfacePurgeableKeepCurrent, &previousState); 331 331 ASSERT_UNUSED(ret, ret == kIOReturnSuccess); 332 return previousState == kIOSurfacePurgeableEmpty ? IOSurface::SurfaceState::Empty : IOSurface::SurfaceState::Valid;332 return previousState == kIOSurfacePurgeableEmpty ? VolatilityState::Empty : VolatilityState::Valid; 333 333 } 334 334 … … 341 341 } 342 342 343 IOSurface::SurfaceState IOSurface::setIsVolatile(bool isVolatile)343 VolatilityState IOSurface::setVolatile(bool isVolatile) 344 344 { 345 345 uint32_t previousState = 0; … … 348 348 349 349 if (previousState == kIOSurfacePurgeableEmpty) 350 return IOSurface::SurfaceState::Empty;351 352 return IOSurface::SurfaceState::Valid;350 return VolatilityState::Empty; 351 352 return VolatilityState::Valid; 353 353 } 354 354 … … 506 506 } 507 507 508 static TextStream& operator<<(TextStream& ts, IOSurface::SurfaceState state)508 static TextStream& operator<<(TextStream& ts, VolatilityState state) 509 509 { 510 510 switch (state) { 511 case IOSurface::SurfaceState::Valid:511 case VolatilityState::Valid: 512 512 ts << "valid"; 513 513 break; 514 case IOSurface::SurfaceState::Empty:514 case VolatilityState::Empty: 515 515 ts << "empty"; 516 516 break; -
trunk/Source/WebKit/ChangeLog
r269815 r269824 1 2020-11-15 Tim Horton <timothy_horton@apple.com> 2 3 Initial implementation of DOM rendering via the GPU process 4 https://bugs.webkit.org/show_bug.cgi?id=218928 5 6 Reviewed by Simon Fraser. 7 8 * Shared/RemoteLayerTree/RemoteLayerBackingStore.h: 9 (WebKit::RemoteLayerBackingStore::hasFrontBuffer const): 10 (WebKit::RemoteLayerBackingStore::Buffer::operator bool const): 11 * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm: 12 (WebKit::RemoteLayerBackingStore::encode const): 13 (WebKit::RemoteLayerBackingStore::decode): 14 (WebKit::RemoteLayerBackingStore::pixelFormat const): 15 (WebKit::RemoteLayerBackingStore::bytesPerPixel const): 16 (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): 17 (WebKit::RemoteLayerBackingStore::display): 18 (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): 19 (WebKit::RemoteLayerBackingStore::takePendingFlusher): 20 (WebKit::RemoteLayerBackingStore::setBufferVolatility): 21 (WebKit::RemoteLayerBackingStore::Buffer::discard): 22 (WebKit::RemoteLayerBackingStore::drawInContext): Deleted. 23 (WebKit::RemoteLayerBackingStore::takeFrontContextPendingFlush): Deleted. 24 (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Deleted. 25 Reimplement RemoteLayerBackingStore in terms of ImageBuffer instead of 26 using ShareableBitmap + IOSurface explicitly. 27 We use ConcreteImageBuffer versions of the shareable backends in the WebContent process 28 in the non-GPU-process case, and normal DisplayList-backed RemoteImageBufferProxies 29 in the GPU process case. 30 31 * UIProcess/ViewSnapshotStore.h: 32 * UIProcess/mac/ViewSnapshotStoreMac.mm: 33 (WebKit::ViewSnapshot::setVolatile): 34 (WebKit::ViewSnapshot::asLayerContents): 35 * WebProcess/GPU/graphics/ImageBufferBackendHandle.h: 36 * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: 37 (WebKit::ThreadSafeRemoteImageBufferFlusher::ThreadSafeRemoteImageBufferFlusher): 38 Add a hack to emulate ThreadSafeRemoteImageBufferFlusher; right now, 39 we'll synchronously flush on the main thread when creating the flusher; 40 a future patch will move this into the flush() method so that RemoteLayerBackingStore 41 can do it on a secondary queue. 42 43 (WebKit::RemoteImageBufferProxy::createImageBufferBackendHandle): 44 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 45 (WebKit::WebChromeClient::createImageBuffer const): 46 (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): Deleted. 47 * WebProcess/WebCoreSupport/WebChromeClient.h: 48 * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: 49 * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: 50 (WebKit::RemoteLayerTreeContext::ensureRemoteRenderingBackendProxy): 51 * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: 52 * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: 53 (WebKit::RemoteLayerTreeDrawingArea::updateRendering): 54 (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::create): 55 (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher): 56 (WebKit::RemoteLayerTreeDrawingArea::BackingStoreFlusher::flush): 57 Reimplement BackingStoreFlusher in terms of the abstract ThreadSafeImageBufferFlusher. 58 59 * WebProcess/WebPage/WebPage.cpp: 60 (WebKit::WebPage::ensureRemoteRenderingBackendProxy): 61 * WebProcess/WebPage/WebPage.h: 62 Move RemoteRenderingBackendProxy from WebChromeClient to WebPage, so that 63 other non-WebCore clients can use it without having to think about WebChromeClient. 64 1 65 2020-11-14 Zan Dobersek <zdobersek@igalia.com> 2 66 -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
r269664 r269824 26 26 #pragma once 27 27 28 #include " ShareableBitmap.h"28 #include "ImageBufferBackendHandle.h" 29 29 #include <WebCore/FloatRect.h> 30 30 #include <WebCore/IOSurface.h> … … 38 38 namespace WebCore { 39 39 class NativeImage; 40 class ThreadSafeImageBufferFlusher; 40 41 typedef Vector<WebCore::FloatRect, 5> RepaintRectList; 41 42 } … … 77 78 bool hasFrontBuffer() const 78 79 { 79 #if HAVE(IOSURFACE) 80 if (m_acceleratesDrawing) 81 return !!m_frontBuffer.surface; 82 #endif 83 return !!m_frontBuffer.bitmap; 80 return !!m_frontBuffer.imageBuffer; 84 81 } 85 82 86 RetainPtr<CGContextRef> takeFrontContextPendingFlush();83 std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> takePendingFlusher(); 87 84 88 85 enum class BufferType { … … 98 95 99 96 private: 100 void drawInContext(WebCore::GraphicsContext& , RefPtr<WebCore::NativeImage>&& backImage);97 void drawInContext(WebCore::GraphicsContext&); 101 98 void clearBackingStore(); 102 99 void swapToValidFrontBuffer(); 103 100 104 #if HAVE(IOSURFACE) 105 WebCore::IOSurface::Format surfaceBufferFormat() const; 106 #endif 107 101 WebCore::PixelFormat pixelFormat() const; 108 102 WebCore::IntSize backingStoreSize() const; 109 103 … … 117 111 118 112 struct Buffer { 119 RefPtr<ShareableBitmap> bitmap; 120 #if HAVE(IOSURFACE) 121 std::unique_ptr<WebCore::IOSurface> surface; 113 RefPtr<WebCore::ImageBuffer> imageBuffer; 122 114 bool isVolatile = false; 123 #endif124 115 125 116 explicit operator bool() const 126 117 { 127 #if HAVE(IOSURFACE) 128 if (surface) 129 return true; 130 #endif 131 if (bitmap) 132 return true; 133 134 return false; 118 return !!imageBuffer; 135 119 } 136 120 … … 140 124 Buffer m_frontBuffer; 141 125 Buffer m_backBuffer; 142 #if HAVE(IOSURFACE)143 126 Buffer m_secondaryBackBuffer; 144 WTF::MachSendRight m_frontBufferSendRight; 145 #endif 127 Optional<ImageBufferBackendHandle> m_bufferHandle; 146 128 147 RetainPtr<CGContextRef> m_frontContextPendingFlush;129 std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> m_frontBufferFlusher; 148 130 149 131 bool m_acceleratesDrawing { false }; -
trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
r269710 r269824 30 30 #import "MachPort.h" 31 31 #import "PlatformCALayerRemote.h" 32 #import "PlatformRemoteImageBufferProxy.h" 32 33 #import "RemoteLayerBackingStoreCollection.h" 33 34 #import "RemoteLayerTreeContext.h" 34 35 #import "ShareableBitmap.h" 35 36 #import "WebCoreArgumentCoders.h" 37 #import "WebProcess.h" 36 38 #import <QuartzCore/QuartzCore.h> 37 39 #import <WebCore/GraphicsContextCG.h> 38 40 #import <WebCore/IOSurface.h> 41 #import <WebCore/ImageBuffer.h> 39 42 #import <WebCore/PlatformCALayerClient.h> 40 43 #import <WebCore/WebLayer.h> … … 100 103 encoder << m_isOpaque; 101 104 102 if (m_acceleratesDrawing) { 103 if (m_frontBuffer.surface) 104 encoder << m_frontBuffer.surface->createSendRight(); 105 Optional<ImageBufferBackendHandle> handle; 106 if (m_frontBuffer.imageBuffer) { 107 // FIXME: We need to flatten the class hierarchy so we can avoid this bifurcation. 108 if (m_acceleratesDrawing) 109 handle = static_cast<AcceleratedRemoteImageBufferProxy *>(m_frontBuffer.imageBuffer.get())->createImageBufferBackendHandle(); 105 110 else 106 encoder << WTF::MachSendRight(); 107 return; 108 } 109 110 ASSERT(!m_acceleratesDrawing); 111 112 ShareableBitmap::Handle handle; 113 m_frontBuffer.bitmap->createHandle(handle); 111 handle = static_cast<UnacceleratedRemoteImageBufferProxy *>(m_frontBuffer.imageBuffer.get())->createImageBufferBackendHandle(); 112 } 113 114 114 encoder << handle; 115 115 } … … 129 129 return false; 130 130 131 if (result.m_acceleratesDrawing) { 132 MachSendRight sendRight; 133 if (!decoder.decode(sendRight)) 134 return false; 135 result.m_frontBufferSendRight = WTFMove(sendRight); 136 return true; 137 } 138 139 ASSERT(!result.m_acceleratesDrawing); 140 141 ShareableBitmap::Handle handle; 142 if (!decoder.decode(handle)) 143 return false; 144 result.m_frontBuffer.bitmap = ShareableBitmap::create(handle); 131 if (!decoder.decode(result.m_bufferHandle)) 132 return false; 145 133 146 134 return true; … … 164 152 } 165 153 154 WebCore::PixelFormat RemoteLayerBackingStore::pixelFormat() const 155 { 156 #if HAVE(IOSURFACE_RGB10) 157 if (m_acceleratesDrawing && m_deepColor) 158 return m_isOpaque ? WebCore::PixelFormat::RGB10 : WebCore::PixelFormat::RGB10A8; 159 #endif 160 161 return WebCore::PixelFormat::BGRA8; 162 } 163 166 164 unsigned RemoteLayerBackingStore::bytesPerPixel() const 167 165 { 168 switch (surfaceBufferFormat()) { 169 case WebCore::IOSurface::Format::BGRA: return 4; 170 case WebCore::IOSurface::Format::YUV422: return 2; 171 #if HAVE(IOSURFACE_RGB10) 172 case WebCore::IOSurface::Format::RGB10: return 4; 173 case WebCore::IOSurface::Format::RGB10A8: return 5; 174 #endif 166 switch (pixelFormat()) { 167 case WebCore::PixelFormat::RGBA8: return 4; 168 case WebCore::PixelFormat::BGRA8: return 4; 169 case WebCore::PixelFormat::RGB10: return 4; 170 case WebCore::PixelFormat::RGB10A8: return 5; 175 171 } 176 172 return 4; … … 179 175 void RemoteLayerBackingStore::swapToValidFrontBuffer() 180 176 { 181 WebCore::IntSize expandedScaledSize = backingStoreSize();182 183 if (m_acceleratesDrawing) {184 if (!m_backBuffer.surface || m_backBuffer.surface->isInUse()) {185 std::swap(m_backBuffer, m_secondaryBackBuffer);186 if (m_backBuffer.surface && m_backBuffer.surface->isInUse())187 m_backBuffer.discard();188 }189 190 std::swap(m_frontBuffer, m_backBuffer);191 192 if (!m_frontBuffer.surface)193 m_frontBuffer.surface = WebCore::IOSurface::create(expandedScaledSize, WebCore::sRGBColorSpaceRef(), surfaceBufferFormat());194 195 setBufferVolatility(BufferType::Front, false);196 return;197 }198 199 ASSERT(!m_acceleratesDrawing);200 177 std::swap(m_frontBuffer, m_backBuffer); 201 178 202 if (!m_frontBuffer.bitmap) { 203 ShareableBitmap::Configuration bitmapConfiguration; 204 bitmapConfiguration.isOpaque = m_isOpaque; 205 m_frontBuffer.bitmap = ShareableBitmap::createShareable(expandedScaledSize, bitmapConfiguration); 206 } 179 if (m_frontBuffer.imageBuffer) 180 return; 181 182 if (WebProcess::singleton().shouldUseRemoteRenderingFor(WebCore::RenderingPurpose::DOM)) { 183 m_frontBuffer.imageBuffer = m_layer->context()->ensureRemoteRenderingBackendProxy().createImageBuffer(backingStoreSize(), m_acceleratesDrawing ? WebCore::RenderingMode::Accelerated : WebCore::RenderingMode::Unaccelerated, 1, WebCore::ColorSpace::SRGB, pixelFormat()); 184 return; 185 } 186 187 if (m_acceleratesDrawing) 188 m_frontBuffer.imageBuffer = WebCore::ConcreteImageBuffer<AcceleratedImageBufferShareableBackend>::create(backingStoreSize(), 1, WebCore::ColorSpace::SRGB, pixelFormat(), nullptr); 189 else 190 m_frontBuffer.imageBuffer = WebCore::ConcreteImageBuffer<UnacceleratedImageBufferShareableBackend>::create(backingStoreSize(), 1, WebCore::ColorSpace::SRGB, pixelFormat(), nullptr); 207 191 } 208 192 209 193 bool RemoteLayerBackingStore::display() 210 194 { 211 ASSERT(!m_front ContextPendingFlush);195 ASSERT(!m_frontBufferFlusher); 212 196 213 197 m_lastDisplayTime = MonotonicTime::now(); … … 235 219 236 220 WebCore::IntRect expandedScaledLayerBounds(WebCore::IntPoint(), expandedScaledSize); 237 bool willPaintEntireBackingStore = m_dirtyRegion.contains(layerBounds);238 221 239 222 swapToValidFrontBuffer(); 240 223 241 if (m_acceleratesDrawing) { 242 RefPtr<WebCore::NativeImage> backImage; 243 if (m_backBuffer.surface && !willPaintEntireBackingStore) 244 backImage = WebCore::NativeImage::create(m_backBuffer.surface->createImage().get()); 245 246 if (m_frontBuffer.surface) { 247 WebCore::GraphicsContext& context = m_frontBuffer.surface->ensureGraphicsContext(); 248 249 context.scale(WebCore::FloatSize(1, -1)); 250 context.translate(0, -expandedScaledSize.height()); 251 drawInContext(context, WTFMove(backImage)); 252 253 m_frontBuffer.surface->releaseGraphicsContext(); 254 } 255 } else { 256 ASSERT(!m_acceleratesDrawing); 257 std::unique_ptr<WebCore::GraphicsContext> context = m_frontBuffer.bitmap->createGraphicsContext(); 258 259 RefPtr<WebCore::NativeImage> backImage; 260 if (m_backBuffer.bitmap && !willPaintEntireBackingStore) 261 backImage = WebCore::NativeImage::create(m_backBuffer.bitmap->makeCGImage().get()); 262 263 if (context) 264 drawInContext(*context, WTFMove(backImage)); 265 } 266 267 m_layer->owner()->platformCALayerLayerDidDisplay(m_layer); 268 269 return true; 270 } 271 272 void RemoteLayerBackingStore::drawInContext(WebCore::GraphicsContext& context, RefPtr<WebCore::NativeImage>&& backImage) 273 { 224 WebCore::GraphicsContext& context = m_frontBuffer.imageBuffer->context(); 225 226 WebCore::GraphicsContextStateSaver stateSaver(context); 227 274 228 WebCore::FloatSize scaledSize = m_size; 275 229 scaledSize.scale(m_scale); … … 296 250 } 297 251 298 if (backImage) 299 context.drawNativeImage(*backImage, scaledLayerBounds.size(), scaledLayerBounds, scaledLayerBounds, { WebCore::CompositeOperator::Copy }); 252 if (!m_dirtyRegion.contains(layerBounds)) { 253 ASSERT(m_backBuffer.imageBuffer); 254 context.drawImageBuffer(*m_backBuffer.imageBuffer, { 0, 0 }); 255 } 300 256 301 257 if (m_paintingRects.size() == 1) { … … 358 314 m_paintingRects.clear(); 359 315 360 m_frontContextPendingFlush = context.platformContext(); 316 m_frontBufferFlusher = m_frontBuffer.imageBuffer->createFlusher(); 317 318 m_layer->owner()->platformCALayerLayerDidDisplay(m_layer); 319 320 // FIXME: This method has a weird name. This is "submit work". 321 m_frontBuffer.imageBuffer->flushDrawingContextAndCommit(); 322 323 return true; 361 324 } 362 325 … … 378 341 void RemoteLayerBackingStore::applyBackingStoreToLayer(CALayer *layer, LayerContentsType contentsType) 379 342 { 343 ASSERT(m_bufferHandle); 380 344 layer.contentsOpaque = m_isOpaque; 381 345 382 346 if (acceleratesDrawing()) { 383 347 switch (contentsType) { 384 case LayerContentsType::IOSurface: 385 if (!m_frontBuffer.surface) { 386 ASSERT(m_frontBufferSendRight); 387 m_frontBuffer.surface = WebCore::IOSurface::createFromSendRight(WTFMove(m_frontBufferSendRight), WebCore::sRGBColorSpaceRef()); 388 } 389 layer.contents = m_frontBuffer.surface ? m_frontBuffer.surface->asLayerContents() : nil; 390 break; 391 case LayerContentsType::CAMachPort: 392 ASSERT(m_frontBufferSendRight); 393 layer.contents = (__bridge id)adoptCF(CAMachPortCreate(m_frontBufferSendRight.leakSendRight())).get(); 348 case LayerContentsType::IOSurface: { 349 auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(WTF::get<MachSendRight>(*m_bufferHandle)), WebCore::sRGBColorSpaceRef()); 350 layer.contents = surface ? surface->asLayerContents() : nil; 394 351 break; 395 352 } 353 case LayerContentsType::CAMachPort: 354 layer.contents = (__bridge id)adoptCF(CAMachPortCreate(WTF::get<MachSendRight>(*m_bufferHandle).leakSendRight())).get(); 355 break; 356 } 396 357 return; 397 358 } 398 359 399 360 ASSERT(!acceleratesDrawing()); 400 layer.contents = (__bridge id)m_frontBuffer.bitmap->makeCGImageCopy().get(); 401 } 402 403 RetainPtr<CGContextRef> RemoteLayerBackingStore::takeFrontContextPendingFlush() 404 { 405 return WTFMove(m_frontContextPendingFlush); 361 auto bitmap = ShareableBitmap::create(WTF::get<ShareableBitmap::Handle>(*m_bufferHandle)); 362 layer.contents = (__bridge id)bitmap->makeCGImageCopy().get(); 363 } 364 365 std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> RemoteLayerBackingStore::takePendingFlusher() 366 { 367 return std::exchange(m_frontBufferFlusher, nullptr); 406 368 } 407 369 408 370 bool RemoteLayerBackingStore::setBufferVolatility(BufferType type, bool isVolatile) 409 371 { 372 if (!acceleratesDrawing()) 373 return true; 374 410 375 // Return value is true if we succeeded in making volatile. 411 376 auto makeVolatile = [] (Buffer& buffer) -> bool { 412 if (!buffer. surface|| buffer.isVolatile)377 if (!buffer.imageBuffer || buffer.isVolatile) 413 378 return true; 414 379 415 buffer. surface->releaseGraphicsContext();416 417 if (!buffer. surface->isInUse()) {418 buffer. surface->setIsVolatile(true);380 buffer.imageBuffer->releaseGraphicsContext(); 381 382 if (!buffer.imageBuffer->isInUse()) { 383 buffer.imageBuffer->setVolatile(true); 419 384 buffer.isVolatile = true; 420 385 return true; … … 426 391 // Return value is true if we need to repaint. 427 392 auto makeNonVolatile = [] (Buffer& buffer) -> bool { 428 if (!buffer. surface|| !buffer.isVolatile)393 if (!buffer.imageBuffer || !buffer.isVolatile) 429 394 return false; 430 395 431 auto previousState = buffer. surface->setIsVolatile(false);396 auto previousState = buffer.imageBuffer->setVolatile(false); 432 397 buffer.isVolatile = false; 433 398 434 return previousState == WebCore:: IOSurface::SurfaceState::Empty;399 return previousState == WebCore::VolatilityState::Empty; 435 400 }; 436 401 … … 462 427 void RemoteLayerBackingStore::Buffer::discard() 463 428 { 464 if (surface)465 WebCore::IOSurface::moveToPool(WTFMove(surface));466 429 isVolatile = false; 467 bitmap = nullptr; 468 } 469 470 WebCore::IOSurface::Format RemoteLayerBackingStore::surfaceBufferFormat() const 471 { 472 #if HAVE(IOSURFACE_RGB10) 473 if (m_deepColor) 474 return m_isOpaque ? WebCore::IOSurface::Format::RGB10 : WebCore::IOSurface::Format::RGB10A8; 475 #endif 476 477 return WebCore::IOSurface::Format::BGRA; 430 if (imageBuffer) 431 imageBuffer->releaseBufferToPool(); 432 imageBuffer = nullptr; 478 433 } 479 434 -
trunk/Source/WebKit/UIProcess/ViewSnapshotStore.h
r259575 r269824 84 84 void setSurface(std::unique_ptr<WebCore::IOSurface>); 85 85 86 WebCore:: IOSurface::SurfaceState setVolatile(bool);86 WebCore::VolatilityState setVolatile(bool); 87 87 #endif 88 88 -
trunk/Source/WebKit/UIProcess/mac/ViewSnapshotStoreMac.mm
r259575 r269824 29 29 #import <CoreGraphics/CoreGraphics.h> 30 30 #import <WebCore/IOSurface.h> 31 #import <WebCore/ImageBuffer.h> 31 32 32 33 #if PLATFORM(IOS_FAMILY) … … 75 76 } 76 77 77 WebCore:: IOSurface::SurfaceState ViewSnapshot::setVolatile(bool becomeVolatile)78 WebCore::VolatilityState ViewSnapshot::setVolatile(bool becomeVolatile) 78 79 { 79 80 if (ViewSnapshotStore::singleton().disableSnapshotVolatilityForTesting()) 80 return WebCore:: IOSurface::SurfaceState::Valid;81 return WebCore::VolatilityState::Valid; 81 82 82 83 if (!m_surface) 83 return WebCore:: IOSurface::SurfaceState::Empty;84 return WebCore::VolatilityState::Empty; 84 85 85 return m_surface->set IsVolatile(becomeVolatile);86 return m_surface->setVolatile(becomeVolatile); 86 87 } 87 88 … … 91 92 return nullptr; 92 93 93 if (setVolatile(false) != WebCore:: IOSurface::SurfaceState::Valid) {94 if (setVolatile(false) != WebCore::VolatilityState::Valid) { 94 95 clearImage(); 95 96 return nullptr; -
trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h
r257606 r269824 35 35 36 36 using ImageBufferBackendHandle = Variant< 37 #if PLATFORM(COCOA) 37 #if PLATFORM(COCOA) // FIXME: This is really about IOSurface. 38 38 MachSendRight, 39 39 #endif -
trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h
r269809 r269824 41 41 class RemoteRenderingBackend; 42 42 43 class ThreadSafeRemoteImageBufferFlusher : public WebCore::ThreadSafeImageBufferFlusher { 44 WTF_MAKE_FAST_ALLOCATED; 45 public: 46 ThreadSafeRemoteImageBufferFlusher(WebCore::ImageBuffer& imageBuffer) 47 { 48 // FIXME: We shouldn't synchronously wait on the flush until flush() is called, but have to invent 49 // a thread-safe way to wait on the incoming message. 50 imageBuffer.flushDrawingContext(); 51 } 52 53 void flush() override 54 { 55 } 56 57 private: 58 }; 59 43 60 template<typename BackendType> 44 61 class RemoteImageBufferProxy : public WebCore::DisplayList::ImageBuffer<BackendType>, public WebCore::DisplayList::Recorder::Delegate, public WebCore::DisplayList::ItemBufferWritingClient { … … 84 101 WebCore::ColorSpace colorSpace() const { return m_colorSpace; } 85 102 WebCore::PixelFormat pixelFormat() const { return m_pixelFormat; } 103 104 ImageBufferBackendHandle createImageBufferBackendHandle() 105 { 106 ensureBackendCreated(); 107 return m_backend->createImageBufferBackendHandle(); 108 } 86 109 87 110 protected: … … 313 336 } 314 337 338 std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> createFlusher() override 339 { 340 return WTF::makeUnique<ThreadSafeRemoteImageBufferFlusher>(*this); 341 } 342 315 343 WebCore::DisplayList::FlushIdentifier m_sentFlushIdentifier; 316 344 WebCore::DisplayList::FlushIdentifier m_receivedFlushIdentifier; -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
r269712 r269824 904 904 #if ENABLE(GPU_PROCESS) 905 905 906 RemoteRenderingBackendProxy& WebChromeClient::ensureRemoteRenderingBackendProxy() const907 {908 if (!m_remoteRenderingBackendProxy)909 m_remoteRenderingBackendProxy = RemoteRenderingBackendProxy::create();910 return *m_remoteRenderingBackendProxy;911 }912 906 913 907 RefPtr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize& size, RenderingMode renderingMode, RenderingPurpose purpose, float resolutionScale, ColorSpace colorSpace, PixelFormat pixelFormat) const … … 916 910 return nullptr; 917 911 918 return ensureRemoteRenderingBackendProxy().createImageBuffer(size, renderingMode, resolutionScale, colorSpace, pixelFormat);912 return m_page.ensureRemoteRenderingBackendProxy().createImageBuffer(size, renderingMode, resolutionScale, colorSpace, pixelFormat); 919 913 } 920 914 -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
r269710 r269824 38 38 namespace WebKit { 39 39 40 class RemoteRenderingBackendProxy;41 40 class WebFrame; 42 41 class WebPage; … … 244 243 245 244 #if ENABLE(GPU_PROCESS) 246 RemoteRenderingBackendProxy& ensureRemoteRenderingBackendProxy() const;247 245 RefPtr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::RenderingMode, WebCore::RenderingPurpose, float resolutionScale, WebCore::ColorSpace, WebCore::PixelFormat) const final; 248 246 #endif … … 406 404 mutable bool m_cachedMainFrameHasHorizontalScrollbar { false }; 407 405 mutable bool m_cachedMainFrameHasVerticalScrollbar { false }; 408 #if ENABLE(GPU_PROCESS)409 mutable std::unique_ptr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy;410 #endif411 406 WebPage& m_page; 412 407 }; -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h
r256834 r269824 38 38 class GraphicsLayerCARemote; 39 39 class PlatformCALayerRemote; 40 class RemoteRenderingBackendProxy; 40 41 class WebPage; 41 42 … … 78 79 79 80 void adoptLayersFromContext(RemoteLayerTreeContext&); 81 82 RemoteRenderingBackendProxy& ensureRemoteRenderingBackendProxy(); 80 83 81 84 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm
r266342 r269824 189 189 } 190 190 191 RemoteRenderingBackendProxy& RemoteLayerTreeContext::ensureRemoteRenderingBackendProxy() 192 { 193 return m_webPage.ensureRemoteRenderingBackendProxy(); 194 } 195 191 196 } // namespace WebKit -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
r268014 r269824 40 40 namespace WebCore { 41 41 class PlatformCALayer; 42 class ThreadSafeImageBufferFlusher; 42 43 } 43 44 … … 126 127 class BackingStoreFlusher : public ThreadSafeRefCounted<BackingStoreFlusher> { 127 128 public: 128 static Ref<BackingStoreFlusher> create(IPC::Connection*, std::unique_ptr<IPC::Encoder>, Vector< RetainPtr<CGContextRef>>);129 static Ref<BackingStoreFlusher> create(IPC::Connection*, std::unique_ptr<IPC::Encoder>, Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>>); 129 130 130 131 void flush(); … … 132 133 133 134 private: 134 BackingStoreFlusher(IPC::Connection*, std::unique_ptr<IPC::Encoder>, Vector< RetainPtr<CGContextRef>>);135 BackingStoreFlusher(IPC::Connection*, std::unique_ptr<IPC::Encoder>, Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>>); 135 136 136 137 RefPtr<IPC::Connection> m_connection; 137 138 std::unique_ptr<IPC::Encoder> m_commitEncoder; 138 Vector< RetainPtr<CGContextRef>> m_contextsToFlush;139 Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> m_flushers; 139 140 140 141 std::atomic<bool> m_hasFlushed; -
trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
r268014 r269824 385 385 // FIXME: Move all backing store flushing management to RemoteLayerBackingStoreCollection. 386 386 bool hadAnyChangedBackingStore = false; 387 Vector< RetainPtr<CGContextRef>> contextsToFlush;387 Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> flushers; 388 388 for (auto& layer : layerTransaction.changedLayers()) { 389 389 if (layer->properties().changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged) { 390 390 hadAnyChangedBackingStore = true; 391 391 if (layer->properties().backingStore) { 392 if (auto contextPendingFlush = layer->properties().backingStore->takeFrontContextPendingFlush())393 contextsToFlush.append(contextPendingFlush);392 if (auto pendingFlusher = layer->properties().backingStore->takePendingFlusher()) 393 flushers.append(WTFMove(pendingFlusher)); 394 394 } 395 395 } … … 403 403 backingStoreCollection.scheduleVolatilityTimer(); 404 404 405 RefPtr<BackingStoreFlusher> backingStoreFlusher = BackingStoreFlusher::create(WebProcess::singleton().parentProcessConnection(), WTFMove(commitEncoder), WTFMove( contextsToFlush));405 RefPtr<BackingStoreFlusher> backingStoreFlusher = BackingStoreFlusher::create(WebProcess::singleton().parentProcessConnection(), WTFMove(commitEncoder), WTFMove(flushers)); 406 406 m_pendingBackingStoreFlusher = backingStoreFlusher; 407 407 … … 452 452 } 453 453 454 Ref<RemoteLayerTreeDrawingArea::BackingStoreFlusher> RemoteLayerTreeDrawingArea::BackingStoreFlusher::create(IPC::Connection* connection, std::unique_ptr<IPC::Encoder> encoder, Vector< RetainPtr<CGContextRef>> contextsToFlush)455 { 456 return adoptRef(*new RemoteLayerTreeDrawingArea::BackingStoreFlusher(connection, WTFMove(encoder), WTFMove( contextsToFlush)));457 } 458 459 RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher(IPC::Connection* connection, std::unique_ptr<IPC::Encoder> encoder, Vector< RetainPtr<CGContextRef>> contextsToFlush)454 Ref<RemoteLayerTreeDrawingArea::BackingStoreFlusher> RemoteLayerTreeDrawingArea::BackingStoreFlusher::create(IPC::Connection* connection, std::unique_ptr<IPC::Encoder> encoder, Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> flushers) 455 { 456 return adoptRef(*new RemoteLayerTreeDrawingArea::BackingStoreFlusher(connection, WTFMove(encoder), WTFMove(flushers))); 457 } 458 459 RemoteLayerTreeDrawingArea::BackingStoreFlusher::BackingStoreFlusher(IPC::Connection* connection, std::unique_ptr<IPC::Encoder> encoder, Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> flushers) 460 460 : m_connection(connection) 461 461 , m_commitEncoder(WTFMove(encoder)) 462 , m_ contextsToFlush(WTFMove(contextsToFlush))462 , m_flushers(WTFMove(flushers)) 463 463 , m_hasFlushed(false) 464 464 { … … 471 471 TraceScope tracingScope(BackingStoreFlushStart, BackingStoreFlushEnd); 472 472 473 for (auto& context : m_contextsToFlush)474 CGContextFlush(context.get());473 for (auto& flusher : m_flushers) 474 flusher->flush(); 475 475 m_hasFlushed = true; 476 476 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r269805 r269824 58 58 #include "PluginView.h" 59 59 #include "PrintInfo.h" 60 #include "RemoteRenderingBackendProxy.h" 60 61 #include "RemoteWebInspectorUI.h" 61 62 #include "RemoteWebInspectorUIMessages.h" … … 7042 7043 #endif 7043 7044 7045 #if ENABLE(GPU_PROCESS) 7046 RemoteRenderingBackendProxy& WebPage::ensureRemoteRenderingBackendProxy() 7047 { 7048 if (!m_remoteRenderingBackendProxy) 7049 m_remoteRenderingBackendProxy = RemoteRenderingBackendProxy::create(); 7050 return *m_remoteRenderingBackendProxy; 7051 } 7052 #endif 7053 7044 7054 } // namespace WebKit 7045 7055 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r269805 r269824 246 246 class PageBanner; 247 247 class PluginView; 248 class RemoteRenderingBackendProxy; 248 249 class RemoteWebInspectorUI; 249 250 class TextCheckingControllerProxy; … … 1362 1363 void synchronizeCORSDisablingPatternsWithNetworkProcess(); 1363 1364 1365 #if ENABLE(GPU_PROCESS) 1366 RemoteRenderingBackendProxy& ensureRemoteRenderingBackendProxy(); 1367 #endif 1368 1364 1369 private: 1365 1370 WebPage(WebCore::PageIdentifier, WebPageCreationParameters&&); … … 2164 2169 uint64_t m_visitedLinkTableID; 2165 2170 #endif 2171 2172 #if ENABLE(GPU_PROCESS) 2173 std::unique_ptr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy; 2174 #endif 2166 2175 }; 2167 2176
Note:
See TracChangeset
for help on using the changeset viewer.