mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 1143575. Pass a list of timestamped images to ImageContainer::SetCurrentImages. r=nical
--HG-- extra : commitid : 2JD9zKhyZMo extra : rebase_source : f5276dee70345e932daca7a4d082f5917e09bf9e
This commit is contained in:
parent
2e70b55264
commit
04dc05db17
@ -678,7 +678,9 @@ DOMHwMediaStream::DOMHwMediaStream()
|
||||
mImageContainer = LayerManager::CreateImageContainer(ImageContainer::ASYNCHRONOUS_OVERLAY);
|
||||
nsRefPtr<Image> img = mImageContainer->CreateImage(ImageFormat::OVERLAY_IMAGE);
|
||||
mOverlayImage = static_cast<layers::OverlayImage*>(img.get());
|
||||
mImageContainer->SetCurrentImage(mOverlayImage);
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> images;
|
||||
images.AppendElement(ImageContainer::NonOwningImage(img));
|
||||
mImageContainer->SetCurrentImages(images);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,14 @@ void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
|
||||
nsTArray<ImageContainer::OwningImage> kungFuDeathGrip;
|
||||
mImageContainer->GetCurrentImages(&kungFuDeathGrip);
|
||||
|
||||
mImageContainer->SetCurrentImage(aImage);
|
||||
if (aImage) {
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> imageList;
|
||||
imageList.AppendElement(
|
||||
ImageContainer::NonOwningImage(aImage, aTargetTime));
|
||||
mImageContainer->SetCurrentImages(imageList);
|
||||
} else {
|
||||
mImageContainer->ClearAllImages();
|
||||
}
|
||||
gfx::IntSize newFrameSize = mImageContainer->GetCurrentSize();
|
||||
if (oldFrameSize != newFrameSize) {
|
||||
mImageSizeChanged = true;
|
||||
|
@ -633,7 +633,10 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
|
||||
cairoData.mSourceSurface = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface);
|
||||
cairoImage->SetData(cairoData);
|
||||
|
||||
container->SetCurrentImage(cairoImage);
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> imageList;
|
||||
imageList.AppendElement(
|
||||
ImageContainer::NonOwningImage(image, TimeStamp()));
|
||||
container->SetCurrentImages(imageList);
|
||||
}
|
||||
else if (mImageContainer) {
|
||||
mImageContainer->ClearAllImages();
|
||||
|
@ -252,18 +252,15 @@ ImageContainer::ClearCurrentImage()
|
||||
}
|
||||
|
||||
void
|
||||
ImageContainer::SetCurrentImage(Image *aImage)
|
||||
ImageContainer::SetCurrentImages(const nsTArray<NonOwningImage>& aImages)
|
||||
{
|
||||
if (!aImage) {
|
||||
ClearAllImages();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!aImages.IsEmpty());
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
if (IsAsync()) {
|
||||
ImageBridgeChild::DispatchImageClientUpdate(mImageClient, this);
|
||||
}
|
||||
SetCurrentImageInternal(aImage);
|
||||
MOZ_ASSERT(aImages.Length() == 1);
|
||||
SetCurrentImageInternal(aImages[0].mImage);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -267,11 +267,11 @@ protected:
|
||||
* An ImageContainer can operate in one of these modes:
|
||||
* 1) Normal. Triggered by constructing the ImageContainer with
|
||||
* DISABLE_ASYNC or when compositing is happening on the main thread.
|
||||
* SetCurrentImage changes ImageContainer state but nothing is sent to the
|
||||
* SetCurrentImages changes ImageContainer state but nothing is sent to the
|
||||
* compositor until the next layer transaction.
|
||||
* 2) Asynchronous. Initiated by constructing the ImageContainer with
|
||||
* ENABLE_ASYNC when compositing is happening on the main thread.
|
||||
* SetCurrentImage sends a message through the ImageBridge to the compositor
|
||||
* SetCurrentImages sends a message through the ImageBridge to the compositor
|
||||
* thread to update the image, without going through the main thread or
|
||||
* a layer transaction.
|
||||
* The ImageContainer uses a shared memory block containing a cross-process mutex
|
||||
@ -302,24 +302,32 @@ public:
|
||||
*/
|
||||
B2G_ACL_EXPORT already_AddRefed<Image> CreateImage(ImageFormat aFormat);
|
||||
|
||||
struct NonOwningImage {
|
||||
NonOwningImage(Image* aImage, TimeStamp aTimeStamp)
|
||||
: mImage(aImage), mTimeStamp(aTimeStamp) {}
|
||||
Image* mImage;
|
||||
TimeStamp mTimeStamp;
|
||||
};
|
||||
/**
|
||||
* Set an Image as the current image to display. The Image must have
|
||||
* Set aImages as the list of timestamped to display. The Images must have
|
||||
* been created by this ImageContainer.
|
||||
* Can be called on any thread. This method takes mReentrantMonitor
|
||||
* when accessing thread-shared state.
|
||||
* aImage can be null. While it's null, nothing will be painted.
|
||||
* aImages must be non-empty. The first timestamp in the list may be
|
||||
* null but the others must not be, and the timestamps must increase.
|
||||
* Every element of aImages must have non-null mImage.
|
||||
*
|
||||
* The Image data must not be modified after this method is called!
|
||||
* Note that this must not be called if ENABLE_ASYNC has not been set.
|
||||
*
|
||||
* Implementations must call CurrentImageChanged() while holding
|
||||
* The implementation calls CurrentImageChanged() while holding
|
||||
* mReentrantMonitor.
|
||||
*
|
||||
* If this ImageContainer has an ImageClient for async video:
|
||||
* Schedule a task to send the image to the compositor using the
|
||||
* PImageBridge protcol without using the main thread.
|
||||
*/
|
||||
void SetCurrentImage(Image* aImage);
|
||||
void SetCurrentImages(const nsTArray<NonOwningImage>& aImages);
|
||||
|
||||
/**
|
||||
* Clear all images. Let ImageClient release all TextureClients.
|
||||
|
@ -905,7 +905,10 @@ RasterImage::UpdateImageContainer()
|
||||
}
|
||||
|
||||
mLastImageContainerDrawResult = result.first();
|
||||
container->SetCurrentImage(result.second());
|
||||
nsAutoTArray<ImageContainer::NonOwningImage,1> imageList;
|
||||
imageList.AppendElement(
|
||||
ImageContainer::NonOwningImage(result.second(), TimeStamp()));
|
||||
container->SetCurrentImages(imageList);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
Loading…
Reference in New Issue
Block a user