Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp

Issue 2796103002: WIP: Adjust externally allocated memory when ImageBitmap is transferred (Closed)
Patch Set: works Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
index 4e9bd685c154dc2c69b912222e5e614d88d32365..89cdcb86a51f3e35f67d9bfd58a6ab131ae6df61 100644
--- a/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
+++ b/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
@@ -12,6 +12,7 @@
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkPaint.h"
+#include "v8/include/v8.h"
namespace blink {
@@ -47,4 +48,16 @@ void StaticBitmapImage::DrawHelper(PaintCanvas* canvas,
WebCoreClampingModeToSkiaRectConstraint(clamp_mode));
}
+void StaticBitmapImage::RegisterExternalAllocationWithCurrentContext() {
+ int externallyAllocatedMemory = Size().Width() * Size().Height() * 4;
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ static_cast<int64_t>(externallyAllocatedMemory));
+}
+
+void StaticBitmapImage::UnregisterExternalAllocationWithCurrentContext() {
+ int externallyAllocatedMemory = Size().Width() * Size().Height() * 4;
+ v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(
+ -static_cast<int64_t>(externallyAllocatedMemory));
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698