Closed
Bug 1380410
Opened 8 years ago
Closed 8 years ago
Add mozilla::NeverAllocPolicy
Categories
(Core :: MFBT, enhancement)
Core
MFBT
Tracking
()
RESOLVED
FIXED
mozilla56
Tracking | Status | |
---|---|---|
firefox56 | --- | fixed |
People
(Reporter: nika, Assigned: nika)
Details
Attachments
(1 file)
1.65 KB,
patch
|
erahm
:
review+
glandium
:
review+
|
Details | Diff | Splinter Review |
For some situations, such as in bug 1380096, it's useful to use MFBT types like Vector in situations where it would be Very Bad(tm) to allocate any memory.
For those situations, I suggest we add mozilla::NeverAllocPolicy, which is an alloc policy like MallocAllocPolicy, except it always fails to allocate, returning `nullptr`.
Assignee | ||
Comment 1•8 years ago
|
||
MozReview-Commit-ID: 8U38Oj3vyaF
Attachment #8885833 -
Flags: review?(erahm)
Comment 2•8 years ago
|
||
Comment on attachment 8885833 [details] [diff] [review]
Add NeverAllocPolicy
Review of attachment 8885833 [details] [diff] [review]:
-----------------------------------------------------------------
LGTM, but we should get a mfbt peer to sign off. Mike this is pretty straightforward and came out of a discussion in another bug, a simplified version of the usage we were talking about would be to replace something like:
> char buffer[kMax];
> size_t used = std::min(str.len, kMax);
> memcpy(buffer, str, used);
with:
> Vector<char, kMax, NeverAllocPolicy> buffer;
> buffer.append(str, used);
Attachment #8885833 -
Flags: review?(mh+mozilla)
Attachment #8885833 -
Flags: review?(erahm)
Attachment #8885833 -
Flags: review+
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Eric Rahm [:erahm] (please no mozreview requests) from comment #2)
> LGTM, but we should get a mfbt peer to sign off.
Oops. for some reason in my head you were a mfbt peer ^.^.
Updated•8 years ago
|
Attachment #8885833 -
Flags: review?(mh+mozilla) → review+
Pushed by michael@thelayzells.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0318e26f75c8
Add NeverAllocPolicy, r=erahm
Comment 5•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox56:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in
before you can comment on or make changes to this bug.
Description
•