Closed Bug 1691894 Opened 2 months ago Closed 2 months ago

Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with a user-defined value

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: sg, Assigned: sg)

References

Details

Attachments

(8 files, 2 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Currently, nsBaseHashtable::GetOrInsert default-constructs a value, so in cases where a different value should be inserted or the DataType isn't default-constructible, the more verbose WithEntryHandle must be used. Allowing to specify a user-defined value with nsBaseHashtable::GetOrInsert resp. a factory with nsBaseHashtable::GetOrInsertWith would allow to simplify code.

Assignee: nobody → sgiesecke
Status: NEW → ASSIGNED
Attachment #9202298 - Attachment is obsolete: true
Attachment #9202299 - Attachment description: Bug 1691894 - Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with a user-defined value. r=#xpcom-reviewers → Bug 1691894 - Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with user-defined constructor arguments. r=#xpcom-reviewers
Keywords: leave-open
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5213eb40bb50
Fix EntryHandle to only work with DataType rather than wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika,jonco,valentin
https://hg.mozilla.org/integration/autoland/rev/72d7d50c86aa
Replace use of GetOrInsert by WithEntryHandle. r=dom-worker-reviewers,janv
Blocks: 1692835
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/db4503476f34
Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with user-defined constructor arguments. r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/f977d6cfa973
Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
https://hg.mozilla.org/integration/autoland/rev/7483e84149d8
Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/58c31e9d6ae3
Remove nsClassHashtable::LookupForAddFromFactory and use GetOrInsertWith instead. r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/22dc870ee609
Always hold PrefCallback in a UniquePtr in nsPrefBranch::AddObserverImpl. r=KrisWright
See Also: → 1692403

Re-landed the two patches before the regression from comment 14 was introduced.

Flags: needinfo?(sgiesecke)
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/88c07c36a9f3
Implement nsBaseHashtable::GetOrInsertWith and nsBaseHashtable::GetOrInsert with user-defined constructor arguments. r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/5dcb40e333f1
Replace several suboptimal uses of Put after Get by GetOrInsertWith or WithEntryHandle. r=xpcom-reviewers,necko-reviewers,kmag,valentin,geckoview-reviewers,agi
See Also: → 1692880

The offending patch will be moved to Bug 1692880.

Comment on attachment 9202637 [details]
Bug 1691894 - Make Put accept DataType instead of wrapping UserDataType. r=#xpcom-reviewers

Revision D104850 was moved to bug 1692880. Setting attachment 9202637 [details] to obsolete.

Attachment #9202637 - Attachment is obsolete: true
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2e884c5cba34
Remove nsClassHashtable::LookupForAddFromFactory and use GetOrInsertWith instead. r=xpcom-reviewers,nika
https://hg.mozilla.org/integration/autoland/rev/9985953875a4
Always hold PrefCallback in a UniquePtr in nsPrefBranch::AddObserverImpl. r=KrisWright
https://hg.mozilla.org/integration/autoland/rev/62ca610656d6
Simplify uses of GetOrInsert where non-default-constructed entries are eventually inserted. r=xpcom-reviewers,necko-reviewers,nika,valentin
Keywords: leave-open
Blocks: 1691913
Pushed by sgiesecke@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ffdf55cd2080
Simplify uses of WithEntryHandle that only use OrInsert(With) by using GetOrInsertWith. r=xpcom-reviewers,necko-reviewers,jgilbert,nika
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.