зеркало из https://github.com/mozilla/gecko-dev.git
Bug 809587 - Increment the JS malloc counter when doing canvas.toBlob(). r=khuey, a=blocking-basecamp
This commit is contained in:
Родитель
ff991df147
Коммит
314626fdae
|
@ -622,6 +622,11 @@ nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
|
|||
nsRefPtr<nsDOMMemoryFile> blob =
|
||||
new nsDOMMemoryFile(imgData, imgSize, type);
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
JS_updateMallocCounter(cx, imgSize);
|
||||
}
|
||||
|
||||
nsRefPtr<ToBlobRunnable> runnable = new ToBlobRunnable(aCallback, blob);
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
}
|
||||
|
@ -667,6 +672,11 @@ nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
|
|||
rv = NS_ReadInputStreamToBuffer(stream, &imgData, (uint32_t)imgSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
JS_updateMallocCounter(cx, imgSize);
|
||||
}
|
||||
|
||||
// The DOMFile takes ownership of the buffer
|
||||
nsRefPtr<nsDOMMemoryFile> file =
|
||||
new nsDOMMemoryFile(imgData, (uint32_t)imgSize, aName, type);
|
||||
|
|
Загрузка…
Ссылка в новой задаче