コード例 #1
0
ファイル: SharedSurface.cpp プロジェクト: miketaylr/gecko-dev
already_AddRefed<layers::SharedSurfaceTextureClient>
SurfaceFactory::NewTexClient(const gfx::IntSize& size)
{
    while (!mRecycleFreePool.empty()) {
        RefPtr<layers::SharedSurfaceTextureClient> cur = mRecycleFreePool.front();
        mRecycleFreePool.pop();

        if (cur->Surf()->mSize == size) {
            return cur.forget();
        }

        StopRecycling(cur);
    }

    UniquePtr<SharedSurface> surf = Move(CreateShared(size));
    if (!surf)
        return nullptr;

    RefPtr<layers::SharedSurfaceTextureClient> ret;
    ret = new layers::SharedSurfaceTextureClient(mAllocator, mFlags, Move(surf), this);

    StartRecycling(ret);

    return ret.forget();
}
コード例 #2
0
ファイル: SharedSurface.cpp プロジェクト: miketaylr/gecko-dev
SurfaceFactory::~SurfaceFactory()
{
    while (!mRecycleTotalPool.empty()) {
        StopRecycling(*mRecycleTotalPool.begin());
    }

    MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty());

    // If we mRecycleFreePool.clear() before StopRecycling(), we may try to recycle it,
    // fail, call StopRecycling(), then return here and call it again.
    mRecycleFreePool.clear();
}
コード例 #3
0
SurfaceFactory::~SurfaceFactory()
{
    while (!mRecycleTotalPool.empty()) {
        RefPtr<layers::SharedSurfaceTextureClient> tex = *mRecycleTotalPool.begin();
        StopRecycling(tex);
        tex->CancelWaitForRecycle();
    }

    MOZ_RELEASE_ASSERT(mRecycleTotalPool.empty(),"GFX: Surface recycle pool not empty.");

    // If we mRecycleFreePool.clear() before StopRecycling(), we may try to recycle it,
    // fail, call StopRecycling(), then return here and call it again.
    mRecycleFreePool.clear();
}