Bug 1594950 - Remove unused SurfaceRegistry API. r=jrmuizel

Differential Revision: https://phabricator.services.mozilla.com/D51758

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-11-13 18:33:24 +00:00
Родитель ba013d0f42
Коммит 4c5a3f3272
2 изменённых файлов: 0 добавлений и 80 удалений

Просмотреть файл

@ -34,17 +34,6 @@ class MozFramebuffer;
namespace layers {
class IOSurfaceRegistry {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(IOSurfaceRegistry)
virtual void RegisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) = 0;
virtual void UnregisterSurface(CFTypeRefPtr<IOSurfaceRef> aSurface) = 0;
protected:
virtual ~IOSurfaceRegistry() {}
};
// NativeLayerRootCA is the CoreAnimation implementation of the NativeLayerRoot
// interface. A NativeLayerRootCA is created by the widget around an existing
// CALayer with a call to CreateForCALayer.
@ -91,13 +80,6 @@ class NativeLayerRootCA : public NativeLayerRoot {
// finished, NotifySurfaceReady marks the surface as ready. This surface is
// committed to the layer during the next call to ApplyChanges().
// The swap chain keeps track of invalid areas within the surfaces.
//
// Creation and destruction of IOSurface objects is broadcast to an optional
// "surface registry" so that associated objects such as framebuffer objects
// don't need to be recreated on every frame: Instead, the surface registry can
// maintain one object per IOSurface in this layer's swap chain, and those
// objects will be reused in different frames as the layer cycles through the
// surfaces in its swap chain.
class NativeLayerCA : public NativeLayer {
public:
virtual NativeLayerCA* AsNativeLayerCA() override { return this; }
@ -122,24 +104,6 @@ class NativeLayerCA : public NativeLayer {
void SetSurfaceIsFlipped(bool aIsFlipped) override;
bool SurfaceIsFlipped() override;
// Consumers may provide an object that implements the IOSurfaceRegistry
// interface.
// The registry's methods, Register/UnregisterSurface, will be called
// synchronously during calls to NextSurface(), SetSurfaceRegistry(), and the
// NativeLayer destructor, on the thread that those things happen to run on.
// If this layer already owns surfaces when SetSurfaceRegistry gets called
// with a non-null surface registry, those surfaces will immediately
// (synchronously) be registered with that registry. If the current surface
// registry is unset (via a call to SetSurfaceRegistry with a different value,
// such as null), and the NativeLayer still owns surfaces, then those surfaces
// will immediately be unregistered.
// Since NativeLayer objects are reference counted and can be used from
// different threads, it is recommended to call SetSurfaceRegistry(nullptr)
// before destroying the NativeLayer so that the UnregisterSurface calls
// happen at a deterministic time and on the right thread.
void SetSurfaceRegistry(RefPtr<IOSurfaceRegistry> aSurfaceRegistry);
RefPtr<IOSurfaceRegistry> GetSurfaceRegistry();
protected:
friend class NativeLayerRootCA;
@ -181,8 +145,6 @@ class NativeLayerCA : public NativeLayer {
// Controls access to all fields of this class.
Mutex mMutex;
RefPtr<IOSurfaceRegistry> mSurfaceRegistry; // can be null
// Each IOSurface is initially created inside NextSurface.
// The surface stays alive until the recycling mechanism in NextSurface
// determines it is no longer needed (because the swap chain has grown too

Просмотреть файл

@ -139,8 +139,6 @@ NativeLayerCA::NativeLayerCA(const IntSize& aSize, bool aIsOpaque)
: mMutex("NativeLayerCA"), mSize(aSize), mIsOpaque(aIsOpaque) {}
NativeLayerCA::~NativeLayerCA() {
SetSurfaceRegistry(nullptr); // or maybe MOZ_RELEASE_ASSERT(!mSurfaceRegistry) would be better?
if (mInProgressLockedIOSurface) {
mInProgressLockedIOSurface->Unlock(false);
mInProgressLockedIOSurface = nullptr;
@ -156,40 +154,6 @@ NativeLayerCA::~NativeLayerCA() {
[mWrappingCALayer release];
}
void NativeLayerCA::SetSurfaceRegistry(RefPtr<IOSurfaceRegistry> aSurfaceRegistry) {
MutexAutoLock lock(mMutex);
if (mSurfaceRegistry) {
for (auto surf : mSurfaces) {
mSurfaceRegistry->UnregisterSurface(surf.mSurface);
}
if (mInProgressSurface) {
mSurfaceRegistry->UnregisterSurface(mInProgressSurface->mSurface);
}
if (mReadySurface) {
mSurfaceRegistry->UnregisterSurface(mReadySurface->mSurface);
}
}
mSurfaceRegistry = aSurfaceRegistry;
if (mSurfaceRegistry) {
for (auto surf : mSurfaces) {
mSurfaceRegistry->RegisterSurface(surf.mSurface);
}
if (mInProgressSurface) {
mSurfaceRegistry->RegisterSurface(mInProgressSurface->mSurface);
}
if (mReadySurface) {
mSurfaceRegistry->RegisterSurface(mReadySurface->mSurface);
}
}
}
RefPtr<IOSurfaceRegistry> NativeLayerCA::GetSurfaceRegistry() {
MutexAutoLock lock(mMutex);
return mSurfaceRegistry;
}
void NativeLayerCA::SetSurfaceIsFlipped(bool aIsFlipped) {
MutexAutoLock lock(mMutex);
@ -315,17 +279,11 @@ CFTypeRefPtr<IOSurfaceRef> NativeLayerCA::NextSurface(const MutexAutoLock& aLock
NSLog(@"NextSurface returning nullptr because IOSurfaceCreate failed to create the surface.");
return nullptr;
}
if (mSurfaceRegistry) {
mSurfaceRegistry->RegisterSurface(newSurf);
}
surf = Some(SurfaceWithInvalidRegion{newSurf, IntRect({}, mSize)});
}
// Delete all other unused surfaces.
for (auto unusedSurf : unusedSurfaces) {
if (mSurfaceRegistry) {
mSurfaceRegistry->UnregisterSurface(unusedSurf.mSurface);
}
mFramebuffers.erase(unusedSurf.mSurface);
}
unusedSurfaces.clear();