fix: ensure external memory adjustments are balanced (#33266)

This commit is contained in:
David Sanders 2022-03-16 10:54:30 -07:00 committed by GitHub
parent cf3ee7be56
commit 652680e801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View file

@ -121,7 +121,7 @@ class NativeImage : public gin::Wrappable<NativeImage> {
float GetAspectRatio(const absl::optional<float> scale_factor);
void AddRepresentation(const gin_helper::Dictionary& options);
void AdjustAmountOfExternalAllocatedMemory(bool add);
void UpdateExternalAllocatedMemoryUsage();
// Mark the image as template image.
void SetTemplateImage(bool setAsTemplate);
@ -136,6 +136,7 @@ class NativeImage : public gin::Wrappable<NativeImage> {
gfx::Image image_;
v8::Isolate* isolate_;
int32_t memory_usage_ = 0;
};
} // namespace api