Closed Bug 1300459 Opened 8 years ago Closed 8 years ago

[CID 1372416] Inefficient pass-by-value: HTMLMediaElement::SetMediaInfo(mozilla::MediaInfo)

Categories

(Core :: Audio/Video: Playback, defect)

50 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: mozbugz, Assigned: mozbugz)

References

Details

Attachments

(1 file)

> *** CID 1372416:  Performance inefficiencies  (PASS_BY_VALUE)
> /dom/html/HTMLMediaElement.cpp: 6544 in
> mozilla::dom::HTMLMediaElement::SetMediaInfo(mozilla::MediaInfo)()
> 6538       }
> 6539     
> 6540       return false;
> 6541     }
> 6542     
> 6543     void
>   CID 1372416:  Performance inefficiencies  (PASS_BY_VALUE)
>   Passing parameter aInfo of type "mozilla::MediaInfo const"
>   (size 472 bytes) by value.
> 6544     HTMLMediaElement::SetMediaInfo(const MediaInfo aInfo)
> 6545     {
> 6546       mMediaInfo = aInfo;
> 6547       AudioCaptureStreamChangeIfNeeded();
> 6548     }

It should be non-controversial to pass by const-ref instead, since the argument is immediately copied into a member variable anyway. This would save one copy.

We might even benefit from move semantics, but that could be a later improvement if needed.
Comment on attachment 8788037 [details]
Bug 1300459 - Pass MediaInfo by const-ref to SetMediaInfo -

https://reviewboard.mozilla.org/r/76584/#review74714
Attachment #8788037 - Flags: review?(jyavenard) → review+
Pushed by gsquelart@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6681da2c7663
Pass MediaInfo by const-ref to SetMediaInfo - r=jya
https://hg.mozilla.org/mozilla-central/rev/6681da2c7663
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Alastor, you might be interested in this change here, as you first introduced SetMediaInfo in https://hg.mozilla.org/mozilla-central/rev/e7a17f7ee53d for bug 1262053.
Blocks: 1262053
Thanks Gerald!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: