Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
| index 33f21dd746d6fd8fb04bb5f3f128aea162d5c979..15afe73821c5ad8053fc9ff163cd0afd2a560e7f 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/UnacceleratedStaticBitmapImage.cpp |
| @@ -5,6 +5,7 @@ |
| #include "platform/graphics/UnacceleratedStaticBitmapImage.h" |
| #include "third_party/skia/include/core/SkImage.h" |
| +#include "v8/include/v8.h" |
| namespace blink { |
| @@ -43,4 +44,22 @@ sk_sp<SkImage> UnacceleratedStaticBitmapImage::imageForCurrentFrame() { |
| return m_image; |
| } |
| +void UnacceleratedStaticBitmapImage:: |
| + registerExternalAllocationWithCurrentContext() { |
| + if (!m_image) |
| + return; |
| + int externallyAllocatedMemory = m_image->width() * m_image->height() * 4; |
|
jbroman
2017/04/04 15:44:56
probably not your problem, but beware overflow in
|
| + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( |
| + static_cast<int64_t>(externallyAllocatedMemory)); |
| +} |
| + |
| +void UnacceleratedStaticBitmapImage:: |
| + unregisterExternalAllocationWithCurrentContext() { |
| + if (!m_image) |
| + return; |
| + int externallyAllocatedMemory = m_image->width() * m_image->height() * 4; |
| + v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory( |
| + -static_cast<int64_t>(externallyAllocatedMemory)); |
| +} |
| + |
| } // namespace blink |