Closed Bug 1355720 Opened 7 years ago Closed 7 years ago

Check if ImageContainer is updated in ImageClientSingle::UpdateImage()

Categories

(Core :: Graphics: WebRender, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: sotaro, Assigned: sotaro)

References

Details

Attachments

(1 file, 2 obsolete files)

ImageClientSingle::UpdateImage() Does not check if ImageContainer is updated. 

WebRenderDisplayItemLayer::SendImageContainer() seems to permit a change of ImageContainer. But the UpdateImage() only compare GenerationCounter values.

https://dxr.mozilla.org/mozilla-central/source/gfx/layers/wr/WebRenderDisplayItemLayer.cpp#40
Assignee: nobody → sotaro.ikeda.g
Blocks: 1355702
(In reply to Sotaro Ikeda [:sotaro] from comment #0)
> ImageClientSingle::UpdateImage() Does not check if ImageContainer is updated. 

https://dxr.mozilla.org/mozilla-central/source/gfx/layers/client/ImageClient.cpp#173
Attachment #8857358 - Flags: review?(matt.woodrow)
Comment on attachment 8857358 [details] [diff] [review]
patch - Check if ImageContainer is updated in ImageClientSingle::UpdateImage()

Review of attachment 8857358 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/layers/client/ImageClient.cpp
@@ +177,5 @@
>    uint32_t generationCounter;
>    aContainer->GetCurrentImages(&images, &generationCounter);
>  
> +  auto container = (uintptr_t)aContainer;
> +  if (mLastImageContainer == container &&

Since we're not holding a strong reference, isn't it possible that the ImageContainer got deleted and another one got allocated at the same memory address?

Can we just use a serial number on the ImageContainer and make sure we never reuse those (we do this for Image already).
Attachment #8857358 - Flags: review?(matt.woodrow)
Thanks for review. Yea, it seems safer to use a serial number on the ImageContainer.

WebRenderDisplayItemLayer hold strong reference of ImageContainer, but it might not work in another use cases.
Ah, generation counter is enough, since it is updated by using "Atomic<uint32_t> ImageContainer::sGenerationCounter"

https://dxr.mozilla.org/mozilla-central/source/gfx/layers/ImageContainer.cpp#222
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: