2017-10-28 02:10:06 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2017-06-29 01:03:27 +03:00
|
|
|
* 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/. */
|
|
|
|
|
|
|
|
#include "WebRenderUserData.h"
|
2017-08-03 08:55:13 +03:00
|
|
|
|
2018-03-16 23:28:19 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
2017-08-03 08:55:13 +03:00
|
|
|
#include "mozilla/layers/ImageClient.h"
|
|
|
|
#include "mozilla/layers/WebRenderBridgeChild.h"
|
2019-01-08 00:33:10 +03:00
|
|
|
#include "mozilla/layers/RenderRootStateManager.h"
|
2017-08-03 08:55:13 +03:00
|
|
|
#include "mozilla/layers/WebRenderMessages.h"
|
2017-09-20 11:56:20 +03:00
|
|
|
#include "mozilla/layers/IpcResourceUpdateQueue.h"
|
2017-10-30 20:10:29 +03:00
|
|
|
#include "mozilla/layers/SharedSurfacesChild.h"
|
2017-07-05 19:29:41 +03:00
|
|
|
#include "nsDisplayListInvalidation.h"
|
2018-01-18 07:28:49 +03:00
|
|
|
#include "nsIFrame.h"
|
2017-08-03 08:55:14 +03:00
|
|
|
#include "WebRenderCanvasRenderer.h"
|
2017-06-29 01:03:27 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace layers {
|
|
|
|
|
2018-06-29 02:32:26 +03:00
|
|
|
void WebRenderBackgroundData::AddWebRenderCommands(
|
|
|
|
wr::DisplayListBuilder& aBuilder) {
|
|
|
|
aBuilder.PushRect(mBounds, mBounds, true, mColor);
|
|
|
|
}
|
|
|
|
|
2019-02-26 01:07:19 +03:00
|
|
|
/* static */
|
|
|
|
bool WebRenderUserData::SupportsAsyncUpdate(nsIFrame* aFrame) {
|
2018-03-16 00:35:56 +03:00
|
|
|
if (!aFrame) {
|
2018-01-18 07:28:49 +03:00
|
|
|
return false;
|
|
|
|
}
|
2018-03-16 00:35:56 +03:00
|
|
|
RefPtr<WebRenderImageData> data = GetWebRenderUserData<WebRenderImageData>(
|
|
|
|
aFrame, static_cast<uint32_t>(DisplayItemType::TYPE_VIDEO));
|
|
|
|
if (data) {
|
|
|
|
return data->IsAsync();
|
2018-01-18 07:28:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-02-26 01:07:19 +03:00
|
|
|
/* static */
|
|
|
|
bool WebRenderUserData::ProcessInvalidateForImage(
|
2019-02-13 22:13:55 +03:00
|
|
|
nsIFrame* aFrame, DisplayItemType aType, ContainerProducerID aProducerId) {
|
2018-10-02 20:28:28 +03:00
|
|
|
MOZ_ASSERT(aFrame);
|
|
|
|
|
|
|
|
if (!aFrame->HasProperty(WebRenderUserDataProperty::Key())) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto type = static_cast<uint32_t>(aType);
|
|
|
|
RefPtr<WebRenderFallbackData> fallback =
|
|
|
|
GetWebRenderUserData<WebRenderFallbackData>(aFrame, type);
|
|
|
|
if (fallback) {
|
|
|
|
fallback->SetInvalid(true);
|
|
|
|
aFrame->SchedulePaint();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
RefPtr<WebRenderImageData> image =
|
|
|
|
GetWebRenderUserData<WebRenderImageData>(aFrame, type);
|
2019-02-13 22:13:55 +03:00
|
|
|
if (image && image->UsingSharedSurface(aProducerId)) {
|
2018-10-02 20:28:28 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
aFrame->SchedulePaint();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-02-13 12:21:11 +03:00
|
|
|
WebRenderUserData::WebRenderUserData(RenderRootStateManager* aManager,
|
|
|
|
uint32_t aDisplayItemKey, nsIFrame* aFrame)
|
|
|
|
: mManager(aManager),
|
|
|
|
mFrame(aFrame),
|
|
|
|
mDisplayItemKey(aDisplayItemKey),
|
|
|
|
mTable(aManager->GetWebRenderUserDataTable()),
|
|
|
|
mUsed(false) {}
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
WebRenderUserData::WebRenderUserData(RenderRootStateManager* aManager,
|
2017-09-25 10:48:29 +03:00
|
|
|
nsDisplayItem* aItem)
|
2019-01-08 00:33:10 +03:00
|
|
|
: mManager(aManager),
|
2017-09-14 09:38:12 +03:00
|
|
|
mFrame(aItem->Frame()),
|
|
|
|
mDisplayItemKey(aItem->GetPerFrameKey()),
|
2019-01-08 00:33:10 +03:00
|
|
|
mTable(aManager->GetWebRenderUserDataTable()),
|
2017-09-14 09:38:12 +03:00
|
|
|
mUsed(false) {}
|
2017-08-03 06:20:53 +03:00
|
|
|
|
|
|
|
WebRenderUserData::~WebRenderUserData() {}
|
|
|
|
|
2017-09-14 09:38:12 +03:00
|
|
|
void WebRenderUserData::RemoveFromTable() { mTable->RemoveEntry(this); }
|
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
WebRenderBridgeChild* WebRenderUserData::WrBridge() const {
|
2019-01-08 00:33:10 +03:00
|
|
|
return mManager->WrBridge();
|
2017-06-29 01:03:27 +03:00
|
|
|
}
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
WebRenderImageData::WebRenderImageData(RenderRootStateManager* aManager,
|
2017-09-25 10:48:29 +03:00
|
|
|
nsDisplayItem* aItem)
|
2019-01-08 00:33:10 +03:00
|
|
|
: WebRenderUserData(aManager, aItem), mOwnsKey(false) {}
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2019-02-13 12:21:11 +03:00
|
|
|
WebRenderImageData::WebRenderImageData(RenderRootStateManager* aManager,
|
|
|
|
uint32_t aDisplayItemKey,
|
|
|
|
nsIFrame* aFrame)
|
|
|
|
: WebRenderUserData(aManager, aDisplayItemKey, aFrame), mOwnsKey(false) {}
|
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
WebRenderImageData::~WebRenderImageData() {
|
2018-04-23 14:57:13 +03:00
|
|
|
ClearImageKey();
|
|
|
|
|
|
|
|
if (mPipelineId) {
|
2019-01-08 00:33:10 +03:00
|
|
|
mManager->RemovePipelineIdForCompositable(mPipelineId.ref());
|
2018-04-23 14:57:13 +03:00
|
|
|
}
|
2017-10-19 07:03:08 +03:00
|
|
|
}
|
|
|
|
|
2019-02-13 22:13:55 +03:00
|
|
|
bool WebRenderImageData::UsingSharedSurface(
|
|
|
|
ContainerProducerID aProducerId) const {
|
2019-01-19 06:21:30 +03:00
|
|
|
if (!mContainer || !mKey || mOwnsKey) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this is just an update with the same image key, then we know that the
|
|
|
|
// share request initiated an asynchronous update so that we don't need to
|
|
|
|
// rebuild the scene.
|
|
|
|
wr::ImageKey key;
|
|
|
|
nsresult rv = SharedSurfacesChild::Share(
|
2019-02-13 22:13:55 +03:00
|
|
|
mContainer, mManager, mManager->AsyncResourceUpdates(), key, aProducerId);
|
2019-01-19 06:21:30 +03:00
|
|
|
return NS_SUCCEEDED(rv) && mKey.ref() == key;
|
2018-10-02 20:28:28 +03:00
|
|
|
}
|
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
void WebRenderImageData::ClearImageKey() {
|
2017-06-29 01:03:27 +03:00
|
|
|
if (mKey) {
|
2017-11-15 22:31:13 +03:00
|
|
|
// If we don't own the key, then the owner is responsible for discarding the
|
|
|
|
// key when appropriate.
|
|
|
|
if (mOwnsKey) {
|
2019-01-08 00:33:10 +03:00
|
|
|
mManager->AddImageKeyForDiscard(mKey.value());
|
2018-07-06 15:25:33 +03:00
|
|
|
if (mTextureOfImage) {
|
2019-03-22 21:28:42 +03:00
|
|
|
WrBridge()->ReleaseTextureOfImage(mKey.value(),
|
|
|
|
mManager->GetRenderRoot());
|
2018-07-06 15:25:33 +03:00
|
|
|
mTextureOfImage = nullptr;
|
|
|
|
}
|
2017-11-15 22:31:13 +03:00
|
|
|
}
|
2017-10-19 07:03:08 +03:00
|
|
|
mKey.reset();
|
2017-06-29 01:03:27 +03:00
|
|
|
}
|
2017-11-15 22:31:13 +03:00
|
|
|
mOwnsKey = false;
|
2018-07-06 15:25:33 +03:00
|
|
|
MOZ_ASSERT(!mTextureOfImage);
|
2017-11-15 22:31:13 +03:00
|
|
|
}
|
|
|
|
|
2017-09-20 11:56:20 +03:00
|
|
|
Maybe<wr::ImageKey> WebRenderImageData::UpdateImageKey(
|
|
|
|
ImageContainer* aContainer, wr::IpcResourceUpdateQueue& aResources,
|
2017-11-20 05:36:14 +03:00
|
|
|
bool aFallback) {
|
2017-10-30 20:10:29 +03:00
|
|
|
MOZ_ASSERT(aContainer);
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2017-08-31 12:30:36 +03:00
|
|
|
if (mContainer != aContainer) {
|
|
|
|
mContainer = aContainer;
|
|
|
|
}
|
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
wr::WrImageKey key;
|
2017-11-20 05:36:14 +03:00
|
|
|
if (!aFallback) {
|
2019-02-13 22:13:55 +03:00
|
|
|
nsresult rv = SharedSurfacesChild::Share(aContainer, mManager, aResources,
|
|
|
|
key, kContainerProducerID_Invalid);
|
2017-11-20 05:36:14 +03:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
// Ensure that any previously owned keys are released before replacing. We
|
|
|
|
// don't own this key, the surface itself owns it, so that it can be
|
|
|
|
// shared across multiple elements.
|
|
|
|
ClearImageKey();
|
|
|
|
mKey = Some(key);
|
|
|
|
return mKey;
|
|
|
|
}
|
2017-11-15 22:31:13 +03:00
|
|
|
|
2017-11-20 05:36:14 +03:00
|
|
|
if (rv != NS_ERROR_NOT_IMPLEMENTED) {
|
|
|
|
// We should be using the shared surface but somehow sharing it failed.
|
|
|
|
ClearImageKey();
|
|
|
|
return Nothing();
|
|
|
|
}
|
2017-11-15 22:31:13 +03:00
|
|
|
}
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
CreateImageClientIfNeeded();
|
2018-07-06 15:25:33 +03:00
|
|
|
if (!mImageClient) {
|
2017-11-15 22:31:13 +03:00
|
|
|
return Nothing();
|
|
|
|
}
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
MOZ_ASSERT(mImageClient->AsImageClientSingle());
|
2017-10-30 20:10:29 +03:00
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
ImageClientSingle* imageClient = mImageClient->AsImageClientSingle();
|
|
|
|
uint32_t oldCounter = imageClient->GetLastUpdateGenerationCounter();
|
2017-10-30 20:10:29 +03:00
|
|
|
|
2019-03-22 21:28:42 +03:00
|
|
|
bool ret = imageClient->UpdateImage(aContainer, /* unused */ 0,
|
|
|
|
Some(mManager->GetRenderRoot()));
|
2018-07-06 15:25:33 +03:00
|
|
|
RefPtr<TextureClient> currentTexture = imageClient->GetForwardedTexture();
|
|
|
|
if (!ret || !currentTexture) {
|
2017-11-15 22:31:13 +03:00
|
|
|
// Delete old key
|
|
|
|
ClearImageKey();
|
|
|
|
return Nothing();
|
|
|
|
}
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2017-11-15 22:31:13 +03:00
|
|
|
// Reuse old key if generation is not updated.
|
2017-11-20 05:36:14 +03:00
|
|
|
if (!aFallback &&
|
|
|
|
oldCounter == imageClient->GetLastUpdateGenerationCounter() && mKey) {
|
2017-11-15 22:31:13 +03:00
|
|
|
return mKey;
|
2017-06-29 01:03:27 +03:00
|
|
|
}
|
|
|
|
|
2018-07-11 11:45:28 +03:00
|
|
|
// If we already had a texture and the format hasn't changed, better to reuse
|
|
|
|
// the image keys than create new ones.
|
|
|
|
bool useUpdate = mKey.isSome() && !!mTextureOfImage && !!currentTexture &&
|
|
|
|
mTextureOfImage->GetSize() == currentTexture->GetSize() &&
|
|
|
|
mTextureOfImage->GetFormat() == currentTexture->GetFormat();
|
2017-06-29 01:03:27 +03:00
|
|
|
|
2018-07-06 15:25:33 +03:00
|
|
|
wr::MaybeExternalImageId extId = currentTexture->GetExternalImageKey();
|
|
|
|
MOZ_RELEASE_ASSERT(extId.isSome());
|
|
|
|
|
2018-07-11 11:45:28 +03:00
|
|
|
if (useUpdate) {
|
|
|
|
MOZ_ASSERT(mKey.isSome());
|
|
|
|
MOZ_ASSERT(mTextureOfImage);
|
|
|
|
aResources.PushExternalImageForTexture(
|
|
|
|
extId.ref(), mKey.ref(), currentTexture, /* aIsUpdate */ true);
|
|
|
|
} else {
|
|
|
|
ClearImageKey();
|
|
|
|
key = WrBridge()->GetNextImageKey();
|
|
|
|
aResources.PushExternalImageForTexture(extId.ref(), key, currentTexture,
|
|
|
|
/* aIsUpdate */ false);
|
|
|
|
mKey = Some(key);
|
|
|
|
}
|
|
|
|
|
2018-07-06 15:25:33 +03:00
|
|
|
mTextureOfImage = currentTexture;
|
2017-11-15 22:31:13 +03:00
|
|
|
mOwnsKey = true;
|
2017-06-29 01:03:27 +03:00
|
|
|
|
|
|
|
return mKey;
|
|
|
|
}
|
|
|
|
|
2017-07-05 19:29:41 +03:00
|
|
|
already_AddRefed<ImageClient> WebRenderImageData::GetImageClient() {
|
|
|
|
RefPtr<ImageClient> imageClient = mImageClient;
|
|
|
|
return imageClient.forget();
|
|
|
|
}
|
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
void WebRenderImageData::CreateAsyncImageWebRenderCommands(
|
|
|
|
mozilla::wr::DisplayListBuilder& aBuilder, ImageContainer* aContainer,
|
2018-11-29 22:22:37 +03:00
|
|
|
const StackingContextHelper& aSc, const LayoutDeviceRect& aBounds,
|
2017-08-03 08:55:13 +03:00
|
|
|
const LayoutDeviceRect& aSCBounds, const gfx::Matrix4x4& aSCTransform,
|
|
|
|
const gfx::MaybeIntSize& aScaleToSize, const wr::ImageRendering& aFilter,
|
2017-09-21 09:41:38 +03:00
|
|
|
const wr::MixBlendMode& aMixBlendMode, bool aIsBackfaceVisible) {
|
2017-06-29 01:03:27 +03:00
|
|
|
MOZ_ASSERT(aContainer->IsAsync());
|
2018-01-11 04:45:02 +03:00
|
|
|
|
|
|
|
if (mPipelineId.isSome() && mContainer != aContainer) {
|
|
|
|
// In this case, we need to remove the existed pipeline and create new one
|
|
|
|
// because the ImageContainer is changed.
|
2019-03-22 21:28:42 +03:00
|
|
|
WrBridge()->RemovePipelineIdForCompositable(mPipelineId.ref(),
|
|
|
|
mManager->GetRenderRoot());
|
2018-01-11 04:45:02 +03:00
|
|
|
mPipelineId.reset();
|
|
|
|
}
|
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
if (!mPipelineId) {
|
|
|
|
// Alloc async image pipeline id.
|
|
|
|
mPipelineId =
|
|
|
|
Some(WrBridge()->GetCompositorBridgeChild()->GetNextPipelineId());
|
|
|
|
WrBridge()->AddPipelineIdForAsyncCompositable(
|
2019-03-22 21:28:42 +03:00
|
|
|
mPipelineId.ref(), aContainer->GetAsyncContainerHandle(),
|
|
|
|
mManager->GetRenderRoot());
|
2018-01-11 04:45:02 +03:00
|
|
|
mContainer = aContainer;
|
2017-06-29 01:03:27 +03:00
|
|
|
}
|
|
|
|
MOZ_ASSERT(!mImageClient);
|
|
|
|
|
|
|
|
// Push IFrame for async image pipeline.
|
|
|
|
//
|
|
|
|
// We don't push a stacking context for this async image pipeline here.
|
|
|
|
// Instead, we do it inside the iframe that hosts the image. As a result,
|
|
|
|
// a bunch of the calculations normally done as part of that stacking
|
|
|
|
// context need to be done manually and pushed over to the parent side,
|
|
|
|
// where it will be done when we build the display list for the iframe.
|
2017-07-25 11:54:36 +03:00
|
|
|
// That happens in AsyncImagePipelineManager.
|
2019-09-14 19:17:04 +03:00
|
|
|
wr::LayoutRect r = wr::ToLayoutRect(aBounds);
|
2018-05-18 17:31:18 +03:00
|
|
|
aBuilder.PushIFrame(r, aIsBackfaceVisible, mPipelineId.ref(),
|
|
|
|
/*ignoreMissingPipelines*/ false);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
WrBridge()->AddWebRenderParentCommand(
|
|
|
|
OpUpdateAsyncImagePipeline(mPipelineId.value(), aSCBounds, aSCTransform,
|
2019-03-22 21:28:42 +03:00
|
|
|
aScaleToSize, aFilter, aMixBlendMode),
|
|
|
|
mManager->GetRenderRoot());
|
2017-06-29 01:03:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebRenderImageData::CreateImageClientIfNeeded() {
|
|
|
|
if (!mImageClient) {
|
|
|
|
mImageClient = ImageClient::CreateImageClient(
|
|
|
|
CompositableType::IMAGE, WrBridge(), TextureFlags::DEFAULT);
|
|
|
|
if (!mImageClient) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mImageClient->Connect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
WebRenderFallbackData::WebRenderFallbackData(RenderRootStateManager* aManager,
|
2017-09-25 10:48:29 +03:00
|
|
|
nsDisplayItem* aItem)
|
2019-02-13 12:21:11 +03:00
|
|
|
: WebRenderUserData(aManager, aItem), mInvalid(false) {}
|
2017-07-05 19:29:41 +03:00
|
|
|
|
2017-07-24 09:43:55 +03:00
|
|
|
WebRenderFallbackData::~WebRenderFallbackData() { ClearImageKey(); }
|
2017-07-05 19:29:41 +03:00
|
|
|
|
2018-11-24 02:33:49 +03:00
|
|
|
void WebRenderFallbackData::SetBlobImageKey(const wr::BlobImageKey& aKey) {
|
|
|
|
ClearImageKey();
|
|
|
|
mBlobKey = Some(aKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
Maybe<wr::ImageKey> WebRenderFallbackData::GetImageKey() {
|
|
|
|
if (mBlobKey) {
|
|
|
|
return Some(wr::AsImageKey(mBlobKey.value()));
|
|
|
|
}
|
|
|
|
|
2019-02-13 12:21:11 +03:00
|
|
|
if (mImageData) {
|
|
|
|
return mImageData->GetImageKey();
|
|
|
|
}
|
|
|
|
|
|
|
|
return Nothing();
|
2018-11-24 02:33:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebRenderFallbackData::ClearImageKey() {
|
2019-02-13 12:21:11 +03:00
|
|
|
if (mImageData) {
|
|
|
|
mImageData->ClearImageKey();
|
|
|
|
mImageData = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mBlobKey) {
|
2019-01-08 00:33:10 +03:00
|
|
|
mManager->AddBlobImageKeyForDiscard(mBlobKey.value());
|
2019-02-13 12:21:11 +03:00
|
|
|
mBlobKey.reset();
|
2018-11-24 02:33:49 +03:00
|
|
|
}
|
2019-02-13 12:21:11 +03:00
|
|
|
}
|
2018-11-24 02:33:49 +03:00
|
|
|
|
2019-02-13 12:21:11 +03:00
|
|
|
WebRenderImageData* WebRenderFallbackData::PaintIntoImage() {
|
|
|
|
if (mBlobKey) {
|
|
|
|
mManager->AddBlobImageKeyForDiscard(mBlobKey.value());
|
|
|
|
mBlobKey.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mImageData) {
|
|
|
|
return mImageData.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
mImageData = MakeAndAddRef<WebRenderImageData>(mManager.get(),
|
|
|
|
mDisplayItemKey, mFrame);
|
|
|
|
|
|
|
|
return mImageData.get();
|
2018-11-24 02:33:49 +03:00
|
|
|
}
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
WebRenderAnimationData::WebRenderAnimationData(RenderRootStateManager* aManager,
|
|
|
|
nsDisplayItem* aItem)
|
2019-11-06 16:29:12 +03:00
|
|
|
: WebRenderUserData(aManager, aItem) {}
|
2017-07-21 09:21:47 +03:00
|
|
|
|
2017-09-22 23:39:57 +03:00
|
|
|
WebRenderAnimationData::~WebRenderAnimationData() {
|
|
|
|
// It may be the case that nsDisplayItem that created this WebRenderUserData
|
|
|
|
// gets destroyed without getting a chance to discard the compositor animation
|
|
|
|
// id, so we should do it as part of cleanup here.
|
|
|
|
uint64_t animationId = mAnimationInfo.GetCompositorAnimationsId();
|
|
|
|
// animationId might be 0 if mAnimationInfo never held any active animations.
|
|
|
|
if (animationId) {
|
2019-01-08 00:33:10 +03:00
|
|
|
mManager->AddCompositorAnimationsIdForDiscard(animationId);
|
2017-09-22 23:39:57 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-08 00:33:10 +03:00
|
|
|
WebRenderCanvasData::WebRenderCanvasData(RenderRootStateManager* aManager,
|
2017-09-25 10:48:29 +03:00
|
|
|
nsDisplayItem* aItem)
|
2019-01-08 00:33:10 +03:00
|
|
|
: WebRenderUserData(aManager, aItem) {}
|
2017-08-03 08:55:14 +03:00
|
|
|
|
|
|
|
WebRenderCanvasData::~WebRenderCanvasData() {
|
2017-10-19 07:03:08 +03:00
|
|
|
if (mCanvasRenderer) {
|
|
|
|
mCanvasRenderer->ClearCachedResources();
|
|
|
|
}
|
2017-08-03 08:55:14 +03:00
|
|
|
}
|
|
|
|
|
2017-10-28 13:07:27 +03:00
|
|
|
void WebRenderCanvasData::ClearCanvasRenderer() { mCanvasRenderer = nullptr; }
|
|
|
|
|
2017-08-03 08:55:14 +03:00
|
|
|
WebRenderCanvasRendererAsync* WebRenderCanvasData::GetCanvasRenderer() {
|
2017-10-28 13:07:27 +03:00
|
|
|
return mCanvasRenderer.get();
|
|
|
|
}
|
2017-08-03 08:55:14 +03:00
|
|
|
|
2017-10-28 13:07:27 +03:00
|
|
|
WebRenderCanvasRendererAsync* WebRenderCanvasData::CreateCanvasRenderer() {
|
2019-01-08 00:33:10 +03:00
|
|
|
mCanvasRenderer = MakeUnique<WebRenderCanvasRendererAsync>(mManager);
|
2017-08-03 08:55:14 +03:00
|
|
|
return mCanvasRenderer.get();
|
|
|
|
}
|
|
|
|
|
2019-05-24 17:28:34 +03:00
|
|
|
WebRenderRemoteData::WebRenderRemoteData(RenderRootStateManager* aManager,
|
|
|
|
nsDisplayItem* aItem)
|
|
|
|
: WebRenderUserData(aManager, aItem) {}
|
|
|
|
|
|
|
|
WebRenderRemoteData::~WebRenderRemoteData() {
|
|
|
|
if (mRemoteBrowser) {
|
|
|
|
mRemoteBrowser->UpdateEffects(mozilla::dom::EffectsInfo::FullyHidden());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-30 09:41:48 +03:00
|
|
|
WebRenderRenderRootData::WebRenderRenderRootData(
|
|
|
|
RenderRootStateManager* aManager, nsDisplayItem* aItem)
|
2019-03-22 21:28:42 +03:00
|
|
|
: WebRenderUserData(aManager, aItem) {}
|
|
|
|
|
|
|
|
RenderRootBoundary& WebRenderRenderRootData::EnsureHasBoundary(
|
|
|
|
wr::RenderRoot aChildType) {
|
|
|
|
if (mBoundary) {
|
|
|
|
MOZ_ASSERT(mBoundary->GetChildType() == aChildType);
|
|
|
|
} else {
|
|
|
|
mBoundary.emplace(aChildType);
|
|
|
|
}
|
|
|
|
return mBoundary.ref();
|
|
|
|
}
|
|
|
|
|
|
|
|
WebRenderRenderRootData::~WebRenderRenderRootData() {}
|
|
|
|
|
2018-03-16 00:35:56 +03:00
|
|
|
void DestroyWebRenderUserDataTable(WebRenderUserDataTable* aTable) {
|
|
|
|
for (auto iter = aTable->Iter(); !iter.Done(); iter.Next()) {
|
|
|
|
iter.UserData()->RemoveFromTable();
|
|
|
|
}
|
|
|
|
delete aTable;
|
|
|
|
}
|
|
|
|
|
2017-06-29 01:03:27 +03:00
|
|
|
} // namespace layers
|
|
|
|
} // namespace mozilla
|