Closed Bug 1118105 Opened 6 years ago Closed 6 years ago

SurfaceCache should let you know if you tried to insert a duplicate surface

Categories

(Core :: ImageLib, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file, 1 obsolete file)

In bug 1079627, we need to be able to detect when we're inserting a duplicate surface in the SurfaceCache.

In this bug we'll make SurfaceCache::Insert return an enumeration instead of a bool, and change the implementation of Insert to inform us when we encounter this situation.
Here's the patch. It's pretty straightforward.
Attachment #8544333 - Flags: review?(dholbert)
Comment on attachment 8544333 [details] [diff] [review]
Make SurfaceCache::Insert let you know if you try to insert a duplicate surface

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

r=me, with one nit

::: image/src/SurfaceCache.h
@@ +117,5 @@
> +MOZ_BEGIN_ENUM_CLASS(InsertOutcome, uint8_t)
> +  SUCCESS,                 // Success (but see Insert documentation).
> +  FAILURE,                 // Couldn't insert (e.g., for capacity reasons).
> +  FAILURE_ALREADY_PRESENT  // A surface with the same key is already present.
> +MOZ_END_ENUM_CLASS(Opacity)

s/Opacity/InsertOutcome/
Attachment #8544333 - Flags: review?(dholbert) → review+
Thanks for the review! Here's an updated version that fixes the nit above.
Attachment #8544333 - Attachment is obsolete: true
This got blocked for a bit on a patch earlier in my queue, but it should be ready to go now. Pushed:

https://hg.mozilla.org/integration/mozilla-inbound/rev/c5c63ad85aa6
https://hg.mozilla.org/mozilla-central/rev/0fe67aa7e9ac
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.