Reviewers: haraken, esprehn, bashi1
CL:
https://codereview.chromium.org/2178883002/Message:
Would you review this CL?
Description:
Added purge method to SimpleFontData and PlatformFontData.
Purge the followings:
- m_harfBuzzFace and m_typeface in PlatformFontData, and
- m_glyphToBoundsMap in SimpleFontData
BUG=
Base URL:
https://chromium.googlesource.com/chromium/src.git@masterAffected files (+16, -0 lines):
M third_party/WebKit/Source/platform/fonts/FontPlatformData.h
M third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp
M third_party/WebKit/Source/platform/fonts/SimpleFontData.h
M third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
Index: third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp b/third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp
index e6f42cb4a1f9505f00dca43dee4d939932aa7e01..b2014bda4d0931439517c70062440b3eba60489c 100644
--- a/third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontPlatformData.cpp
@@ -346,4 +346,10 @@ PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(SkFontTableTag tag) con
return buffer.release();
}
+void FontPlatformData::purgeMemory()
+{
+ m_typeface = nullptr;
+ m_harfBuzzFace = nullptr;
+}
+
} // namespace blink
Index: third_party/WebKit/Source/platform/fonts/FontPlatformData.h
diff --git a/third_party/WebKit/Source/platform/fonts/FontPlatformData.h b/third_party/WebKit/Source/platform/fonts/FontPlatformData.h
index faf4636cfcb6d23a6c4163f88897ff05e21e36bd..d4218d71200b839790598ebb3125d6891b8c9924 100644
--- a/third_party/WebKit/Source/platform/fonts/FontPlatformData.h
+++ b/third_party/WebKit/Source/platform/fonts/FontPlatformData.h
@@ -136,6 +136,8 @@ public:
int paintTextFlags() const { return m_paintTextFlags; }
#endif
+ void purgeMemory();
+
private:
#if OS(WIN)
void querySystemForRenderStyle();
Index: third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
index efed5b9083f72d60fc2b920d60074b69e495437f..ddf9765e553ae6b24eec02d8cc62323adb84659c 100644
--- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
+++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.cpp
@@ -447,4 +447,10 @@ bool SimpleFontData::fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsig
return haveGlyphs;
}
+void SimpleFontData::purgeMemory()
+{
+ m_glyphToBoundsMap.reset(nullptr);
+ m_platformData.purgeMemory();
+}
+
} // namespace blink
Index: third_party/WebKit/Source/platform/fonts/SimpleFontData.h
diff --git a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h
index 9cbeb8b371988ab6d39cf1ab155293a2773d26e4..82a4473068cb85e7de28ff8ffc777d74b735eeec 100644
--- a/third_party/WebKit/Source/platform/fonts/SimpleFontData.h
+++ b/third_party/WebKit/Source/platform/fonts/SimpleFontData.h
@@ -127,6 +127,8 @@ public:
// Implemented by the platform.
virtual bool fillGlyphPage(GlyphPage* pageToFill, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength) const;
+ void purgeMemory();
+
protected:
SimpleFontData(const FontPlatformData&, PassRefPtr<CustomFontData> customData, bool isTextOrientationFallback = false);