Make IOSurface::Locker and use it in ImageBufferDataCG
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Dec 2017 23:11:12 +0000 (23:11 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Dec 2017 23:11:12 +0000 (23:11 +0000)
commit5f773baa7ba0046786677452fe7a295e69189908
tree1d5b5ed0bc256cc315d249c1802c41f472819cfe
parent0da4f96710154031c5c3e004a6c440813e02781d
Make IOSurface::Locker and use it in ImageBufferDataCG
https://bugs.webkit.org/show_bug.cgi?id=180317

Reviewed by Zalan Bujtas.

Add an RAII IOSurface::Locker which can lock readonly or readwrite. Access
to the IOSurface base address is through the locker.

Add IOSurface::bytesPerRow() to wrap IOSurfaceGetBytesPerRow().

After this, there is only one location where we access the IOSurfaceRef
directly, in WebGL code.

* platform/graphics/cg/ImageBufferDataCG.cpp:
(WebCore::ImageBufferData::toBGRAData const):
(WebCore::ImageBufferData::getData const):
(WebCore::ImageBufferData::putData):
* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:
(WebCore::IOSurface::bytesPerRow const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225454 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp
Source/WebCore/platform/graphics/cocoa/IOSurface.h
Source/WebCore/platform/graphics/cocoa/IOSurface.mm