mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1088249 - Report OOMs from the js_alloc*CanGC functions, r=luke
--HG-- extra : rebase_source : 47f348d2d448ee51fb6e1f6929fd6b35e14b1e60
This commit is contained in:
parent
5cf875b9ba
commit
dfb2f27cf1
@ -5366,11 +5366,10 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(ForOfIterator) {
|
||||
|
||||
|
||||
/*
|
||||
* If a large allocation fails, the JS engine may call the large-allocation-
|
||||
* failure callback, if set, to allow the embedding to flush caches, possibly
|
||||
* perform shrinking GCs, etc. to make some room so that the allocation will
|
||||
* succeed if retried. After the callback returns, the JS engine will try to
|
||||
* allocate again and may be succesful.
|
||||
* If a large allocation fails when calling pod_{calloc,realloc}CanGC, the JS
|
||||
* engine may call the large-allocation- failure callback, if set, to allow the
|
||||
* embedding to flush caches, possibly perform shrinking GCs, etc. to make some
|
||||
* room. The allocation will then be retried (and may still fail.)
|
||||
*/
|
||||
|
||||
typedef void
|
||||
|
@ -699,9 +699,8 @@ JSRuntime::onOutOfMemory(void *p, size_t nbytes, JSContext *cx)
|
||||
void *
|
||||
JSRuntime::onOutOfMemoryCanGC(void *p, size_t bytes)
|
||||
{
|
||||
if (!largeAllocationFailureCallback || bytes < LARGE_ALLOCATION)
|
||||
return nullptr;
|
||||
largeAllocationFailureCallback(largeAllocationFailureCallbackData);
|
||||
if (largeAllocationFailureCallback && bytes >= LARGE_ALLOCATION)
|
||||
largeAllocationFailureCallback(largeAllocationFailureCallbackData);
|
||||
return onOutOfMemory(p, bytes);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user