mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
e4e2da55c9
The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi
175 lines
5.6 KiB
C++
175 lines
5.6 KiB
C++
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef MOZILLA_GFX_IMAGECLIENT_H
|
|
#define MOZILLA_GFX_IMAGECLIENT_H
|
|
|
|
#include <stdint.h> // for uint32_t, uint64_t
|
|
#include <sys/types.h> // for int32_t
|
|
#include "mozilla/Attributes.h" // for override
|
|
#include "mozilla/RefPtr.h" // for RefPtr, already_AddRefed
|
|
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
|
#include "mozilla/layers/AsyncTransactionTracker.h" // for AsyncTransactionTracker
|
|
#include "mozilla/layers/CompositableClient.h" // for CompositableClient
|
|
#include "mozilla/layers/CompositorTypes.h" // for CompositableType, etc
|
|
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor
|
|
#include "mozilla/layers/TextureClient.h" // for TextureClient, etc
|
|
#include "mozilla/mozalloc.h" // for operator delete
|
|
#include "nsCOMPtr.h" // for already_AddRefed
|
|
#include "nsRect.h" // for mozilla::gfx::IntRect
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class ClientLayer;
|
|
class CompositableForwarder;
|
|
class AsyncTransactionTracker;
|
|
class Image;
|
|
class ImageContainer;
|
|
class ShadowableLayer;
|
|
|
|
/**
|
|
* Image clients are used by basic image layers on the content thread, they
|
|
* always match with an ImageHost on the compositor thread. See
|
|
* CompositableClient.h for information on connecting clients to hosts.
|
|
*/
|
|
class ImageClient : public CompositableClient
|
|
{
|
|
public:
|
|
/**
|
|
* Creates, configures, and returns a new image client. If necessary, a
|
|
* message will be sent to the compositor to create a corresponding image
|
|
* host.
|
|
*/
|
|
static already_AddRefed<ImageClient> CreateImageClient(CompositableType aImageHostType,
|
|
CompositableForwarder* aFwd,
|
|
TextureFlags aFlags);
|
|
|
|
virtual ~ImageClient() {}
|
|
|
|
/**
|
|
* Update this ImageClient from aContainer in aLayer
|
|
* returns false if this is the wrong kind of ImageClient for aContainer.
|
|
* Note that returning true does not necessarily imply success
|
|
*/
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) = 0;
|
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) = 0;
|
|
|
|
void SetLayer(ClientLayer* aLayer) { mLayer = aLayer; }
|
|
ClientLayer* GetLayer() const { return mLayer; }
|
|
|
|
/**
|
|
* asynchronously remove all the textures used by the image client.
|
|
*
|
|
*/
|
|
virtual void FlushAllImages(AsyncTransactionWaiter* aAsyncTransactionWaiter) {}
|
|
|
|
virtual void RemoveTexture(TextureClient* aTexture) override;
|
|
|
|
void RemoveTextureWithWaiter(TextureClient* aTexture,
|
|
AsyncTransactionWaiter* aAsyncTransactionWaiter = nullptr);
|
|
|
|
protected:
|
|
ImageClient(CompositableForwarder* aFwd, TextureFlags aFlags,
|
|
CompositableType aType);
|
|
|
|
ClientLayer* mLayer;
|
|
CompositableType mType;
|
|
uint32_t mLastUpdateGenerationCounter;
|
|
};
|
|
|
|
/**
|
|
* An image client which uses a single texture client.
|
|
*/
|
|
class ImageClientSingle : public ImageClient
|
|
{
|
|
public:
|
|
ImageClientSingle(CompositableForwarder* aFwd,
|
|
TextureFlags aFlags,
|
|
CompositableType aType);
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) override;
|
|
|
|
virtual void OnDetach() override;
|
|
|
|
virtual bool AddTextureClient(TextureClient* aTexture) override;
|
|
|
|
virtual TextureInfo GetTextureInfo() const override;
|
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) override;
|
|
|
|
virtual void FlushAllImages(AsyncTransactionWaiter* aAsyncTransactionWaiter) override;
|
|
|
|
protected:
|
|
struct Buffer {
|
|
RefPtr<TextureClient> mTextureClient;
|
|
int32_t mImageSerial;
|
|
};
|
|
nsTArray<Buffer> mBuffers;
|
|
};
|
|
|
|
/**
|
|
* Image class to be used for async image uploads using the image bridge
|
|
* protocol.
|
|
* We store the ImageBridge id in the TextureClientIdentifier.
|
|
*/
|
|
class ImageClientBridge : public ImageClient
|
|
{
|
|
public:
|
|
ImageClientBridge(CompositableForwarder* aFwd,
|
|
TextureFlags aFlags);
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags) override;
|
|
virtual bool Connect(ImageContainer* aImageContainer) override { return false; }
|
|
|
|
virtual TextureInfo GetTextureInfo() const override
|
|
{
|
|
return TextureInfo(mType);
|
|
}
|
|
|
|
virtual void SetIPDLActor(CompositableChild* aChild) override
|
|
{
|
|
MOZ_ASSERT(!aChild, "ImageClientBridge should not have IPDL actor");
|
|
}
|
|
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat) override
|
|
{
|
|
NS_WARNING("Should not create an image through an ImageClientBridge");
|
|
return nullptr;
|
|
}
|
|
|
|
protected:
|
|
uint64_t mAsyncContainerID;
|
|
};
|
|
|
|
#ifdef MOZ_WIDGET_GONK
|
|
/**
|
|
* And ImageClient to handle opaque video stream.
|
|
* Such video stream does not upload new Image for each frame.
|
|
* Gecko have no way to get the buffer content from the Image, since the Image
|
|
* does not contain the real buffer.
|
|
* It need special hardware to display the Image
|
|
*/
|
|
class ImageClientOverlay : public ImageClient
|
|
{
|
|
public:
|
|
ImageClientOverlay(CompositableForwarder* aFwd,
|
|
TextureFlags aFlags);
|
|
|
|
virtual bool UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags);
|
|
virtual already_AddRefed<Image> CreateImage(ImageFormat aFormat);
|
|
TextureInfo GetTextureInfo() const override
|
|
{
|
|
return TextureInfo(CompositableType::IMAGE_OVERLAY);
|
|
}
|
|
};
|
|
#endif
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|
|
|
|
#endif
|