mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 1418869 - Do not try to share the fallback images. r=aosmond
The flag of force update is only for fallback items. Fallback items can't share the images with other items. So I replace 'aForceUpdate' with 'aFallback' and remove some unnecessary checks. MozReview-Commit-ID: Dcu95FZXlUz --HG-- extra : rebase_source : 1ec96e0b5d39cc5760b4b5490c5ca9ccbc1933c6
This commit is contained in:
parent
04927bc058
commit
a661b32865
@ -92,7 +92,6 @@ public:
|
||||
|
||||
wr::ImageKey UpdateKey(WebRenderLayerManager* aManager,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate,
|
||||
uint32_t aGenerationId)
|
||||
{
|
||||
MOZ_ASSERT(aManager);
|
||||
@ -114,7 +113,7 @@ public:
|
||||
mKeys.RemoveElementAt(i);
|
||||
} else if (entry.mManager == aManager) {
|
||||
found = true;
|
||||
if (aForceUpdate || entry.mGenerationId != aGenerationId) {
|
||||
if (entry.mGenerationId != aGenerationId) {
|
||||
aManager->AddImageKeyForDiscard(entry.mImageKey);
|
||||
entry.mGenerationId = aGenerationId;
|
||||
entry.mImageKey = aManager->WrBridge()->GetNextImageKey();
|
||||
@ -151,7 +150,6 @@ SharedSurfacesChild::DestroySharedUserData(void* aClosure)
|
||||
SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface,
|
||||
WebRenderLayerManager* aManager,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate,
|
||||
uint32_t aGenerationId,
|
||||
wr::ImageKey& aKey)
|
||||
{
|
||||
@ -176,7 +174,7 @@ SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface,
|
||||
data->SetId(manager->GetNextExternalImageId());
|
||||
} else if (data->IsShared()) {
|
||||
// It has already been shared with the GPU process, reuse the id.
|
||||
aKey = data->UpdateKey(aManager, aResources, aForceUpdate, aGenerationId);
|
||||
aKey = data->UpdateKey(aManager, aResources, aGenerationId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -194,7 +192,7 @@ SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface,
|
||||
if (pid == base::GetCurrentProcId()) {
|
||||
SharedSurfacesParent::AddSameProcess(data->Id(), aSurface);
|
||||
data->MarkShared();
|
||||
aKey = data->UpdateKey(aManager, aResources, aForceUpdate, aGenerationId);
|
||||
aKey = data->UpdateKey(aManager, aResources, aGenerationId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -229,7 +227,7 @@ SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface,
|
||||
SurfaceDescriptorShared(aSurface->GetSize(),
|
||||
aSurface->Stride(),
|
||||
format, handle));
|
||||
aKey = data->UpdateKey(aManager, aResources, aForceUpdate, aGenerationId);
|
||||
aKey = data->UpdateKey(aManager, aResources, aGenerationId);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -237,7 +235,6 @@ SharedSurfacesChild::Share(SourceSurfaceSharedData* aSurface,
|
||||
SharedSurfacesChild::Share(ImageContainer* aContainer,
|
||||
WebRenderLayerManager* aManager,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate,
|
||||
wr::ImageKey& aKey)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -266,7 +263,7 @@ SharedSurfacesChild::Share(ImageContainer* aContainer,
|
||||
|
||||
auto sharedSurface = static_cast<SourceSurfaceSharedData*>(surface.get());
|
||||
return Share(sharedSurface, aManager, aResources,
|
||||
aForceUpdate, generation, aKey);
|
||||
generation, aKey);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
@ -33,14 +33,12 @@ public:
|
||||
static nsresult Share(gfx::SourceSurfaceSharedData* aSurface,
|
||||
WebRenderLayerManager* aManager,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate,
|
||||
uint32_t aGenerationId,
|
||||
wr::ImageKey& aKey);
|
||||
|
||||
static nsresult Share(ImageContainer* aContainer,
|
||||
WebRenderLayerManager* aManager,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate,
|
||||
wr::ImageKey& aKey);
|
||||
|
||||
private:
|
||||
|
@ -93,7 +93,7 @@ WebRenderImageData::ClearCachedResources()
|
||||
Maybe<wr::ImageKey>
|
||||
WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate)
|
||||
bool aFallback)
|
||||
{
|
||||
MOZ_ASSERT(aContainer);
|
||||
|
||||
@ -102,8 +102,8 @@ WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
|
||||
}
|
||||
|
||||
wr::WrImageKey key;
|
||||
nsresult rv = SharedSurfacesChild::Share(aContainer, mWRManager, aResources,
|
||||
aForceUpdate, key);
|
||||
if (!aFallback) {
|
||||
nsresult rv = SharedSurfacesChild::Share(aContainer, mWRManager, aResources, key);
|
||||
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
|
||||
@ -118,6 +118,7 @@ WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
|
||||
ClearImageKey();
|
||||
return Nothing();
|
||||
}
|
||||
}
|
||||
|
||||
CreateImageClientIfNeeded();
|
||||
CreateExternalImageIfNeeded();
|
||||
@ -139,7 +140,7 @@ WebRenderImageData::UpdateImageKey(ImageContainer* aContainer,
|
||||
}
|
||||
|
||||
// Reuse old key if generation is not updated.
|
||||
if (!aForceUpdate && oldCounter == imageClient->GetLastUpdateGenerationCounter() && mKey) {
|
||||
if (!aFallback && oldCounter == imageClient->GetLastUpdateGenerationCounter() && mKey) {
|
||||
return mKey;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
|
||||
Maybe<wr::ImageKey> UpdateImageKey(ImageContainer* aContainer,
|
||||
wr::IpcResourceUpdateQueue& aResources,
|
||||
bool aForceUpdate = false);
|
||||
bool aFallback = false);
|
||||
|
||||
void CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder,
|
||||
ImageContainer* aContainer,
|
||||
|
Loading…
Reference in New Issue
Block a user