Closed Bug 1424875 Opened 2 years ago Closed 2 years ago

[Static Analysis] Big parameter passed by value in NotifyManyVisitsObservers and NotifyVisit

Categories

(Firefox :: Migration, enhancement)

enhancement
Not set

Tracking

()

RESOLVED DUPLICATE of bug 1423612

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1425899)

Attachments

(1 file)

Now we pass |aPlace| by value in:

>>  explicit NotifyManyVisitsObservers(VisitData aPlace)
>>    : Runnable("places::NotifyManyVisitsObservers")
>>    , mPlace(aPlace)
>>    , mHistory(History::GetService())
>>  {
>>  }

Since the size is around 160bytes why don't we pass it as const VisitData& and we avoid one copy of the object.
Look a bit more around the code the same reason can be applied here:

>>  nsresult NotifyVisit(nsNavHistory* aNavHistory,
>>                       nsCOMPtr<nsIObserverService>& aObsService,
>>                       PRTime aNow,
>>                       VisitData aPlace)
Summary: [Static Analysis] Big parameter passed by value in NotifyManyVisitsObservers → [Static Analysis] Big parameter passed by value in NotifyManyVisitsObservers and NotifyVisit
This is a duplicate of bug 1423612. The patch is the same.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1423612
Comment on attachment 8936393 [details]
Bug 1424875 - pass aPlace as const& in NotifyManyVisitsObservers and NotifyVisit.

https://reviewboard.mozilla.org/r/207118/#review213268
Attachment #8936393 - Flags: review?(mak77)
You need to log in before you can comment on or make changes to this bug.