Closed Bug 1329670 Opened 3 years ago Closed 3 years ago

Change gfxFont's method CopyWithAntialiasOption to return UniquePtr

Categories

(Core :: Graphics: Text, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: dholbert, Assigned: dholbert)

Details

Attachments

(2 files)

The function CopyWithAntialiasOption (on the gfxFont interface) returns a raw pointer to a freshly allocated object (or nullptr). And the one caller stores this returned value in a UniquePtr, here:
  https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxFont.cpp#2308

We should change CopyWithAntialiasOption to simply return UniquePtr.
I'm splitting this into two parts for easier review (though I'll land it as a single merged changeset so as not to introduce an intermediate point where we don't compile).

Here's the first part -- changing the function signature and the callsite.
Attachment #8825061 - Attachment description: fix (first half): change signature on interface & change callsite to use Move() → fix (first half): change signature on gfxFont & change callsite to use Move()
Attachment #8825061 - Flags: review?(jfkthame)
...and here's the second part, which updates the implementations.
Comment on attachment 8825063 [details] [diff] [review]
fix (second half): update implementations in gfxFont's subclasses

(Note that I'm introducing a local 'auto' variable here, for one of the constructor-args, simply to reduce the length of the MakeUnique<...>(...) line.)
Attachment #8825063 - Attachment description: fix (second half): update implementations → fix (second half): update implementations in gfxFont's subclasses
Attachment #8825063 - Flags: review?(jfkthame)
Oh -- side note, in the second half I'm also dropping 'virtual' from the function signature (since I'm touching that line anyway) -- because, per our coding style, that keyword is not supposed to accompany the 'override' keyword (which these subclass function impls have at the end).
Attachment #8825061 - Flags: review?(jfkthame) → review+
Comment on attachment 8825063 [details] [diff] [review]
fix (second half): update implementations in gfxFont's subclasses

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

Looks fine to me.
Attachment #8825063 - Flags: review?(jfkthame) → review+
Pushed by dholbert@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7177f9bb9d93
Change gfxFont::CopyWithAntialiasOption to return UniquePtr instead of raw pointer. r=jfkthame
https://hg.mozilla.org/mozilla-central/rev/7177f9bb9d93
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.