Commit 2f42bbc1 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

BlinkMemoyrMgt: Annotate Blink's platform/font with the macros of Allocator

As a step to annotate the macros of Allocator for the Onion Soup, this CL annotates
some classes of //third_party/blink/renderer/platform/font with the macros of
Allocator.

After some analyzes, it was concluded that for the case of FontFallbackList,
FontGlobalContext, FontSelectionValue, FontUniqueNameLookup, OpenTypeVerticalData,
ShapeResult, and UnicodeRangeSet classes, they make sense to use USING_FAST_MALLOC
because they have been used with smart pointers.

In HarfBuzzShaper class, it makes sense to use DISALLOW_NEW because it's used as
a member variable with a reference type.

Bug: 919389
Change-Id: Ia03ab46b86af39f6cb5a2d5161a7cb0809ddebb7
Reviewed-on: https://chromium-review.googlesource.com/c/1491879Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#636614}
parent 494e1a75
...@@ -6,12 +6,15 @@ ...@@ -6,12 +6,15 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_BITMAP_GLYPHS_BLACKLIST_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_BITMAP_GLYPHS_BLACKLIST_H_
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
class SkTypeface; class SkTypeface;
namespace blink { namespace blink {
class PLATFORM_EXPORT BitmapGlyphsBlacklist { class PLATFORM_EXPORT BitmapGlyphsBlacklist {
STATIC_ONLY(BitmapGlyphsBlacklist);
public: public:
static bool AvoidEmbeddedBitmapsForTypeface(SkTypeface*); static bool AvoidEmbeddedBitmapsForTypeface(SkTypeface*);
}; };
......
...@@ -39,6 +39,8 @@ class FontDescription; ...@@ -39,6 +39,8 @@ class FontDescription;
const int kCAllFamiliesScanned = -1; const int kCAllFamiliesScanned = -1;
class PLATFORM_EXPORT FontFallbackList : public RefCounted<FontFallbackList> { class PLATFORM_EXPORT FontFallbackList : public RefCounted<FontFallbackList> {
USING_FAST_MALLOC(FontFallbackList);
public: public:
static scoped_refptr<FontFallbackList> Create() { static scoped_refptr<FontFallbackList> Create() {
return base::AdoptRef(new FontFallbackList()); return base::AdoptRef(new FontFallbackList());
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h" #include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h"
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/text/layout_locale.h" #include "third_party/blink/renderer/platform/text/layout_locale.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
struct hb_font_funcs_t; struct hb_font_funcs_t;
...@@ -22,6 +23,8 @@ enum CreateIfNeeded { kDoNotCreate, kCreate }; ...@@ -22,6 +23,8 @@ enum CreateIfNeeded { kDoNotCreate, kCreate };
// FontGlobalContext contains non-thread-safe, thread-specific data used for // FontGlobalContext contains non-thread-safe, thread-specific data used for
// font formatting. // font formatting.
class PLATFORM_EXPORT FontGlobalContext { class PLATFORM_EXPORT FontGlobalContext {
USING_FAST_MALLOC(FontGlobalContext);
public: public:
static FontGlobalContext* Get(CreateIfNeeded = kCreate); static FontGlobalContext* Get(CreateIfNeeded = kCreate);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
namespace { namespace {
class IntegerHasher { class IntegerHasher {
STACK_ALLOCATED();
public: public:
void add(unsigned integer) { void add(unsigned integer) {
m_underlyingHasher.AddCharactersAssumingAligned(integer, integer >> 16); m_underlyingHasher.AddCharactersAssumingAligned(integer, integer >> 16);
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_SELECTION_TYPES_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_SELECTION_TYPES_H_
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/hash_table_deleted_value_type.h" #include "third_party/blink/renderer/platform/wtf/hash_table_deleted_value_type.h"
#include "third_party/blink/renderer/platform/wtf/hash_traits.h" #include "third_party/blink/renderer/platform/wtf/hash_traits.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h"
...@@ -40,6 +41,8 @@ namespace blink { ...@@ -40,6 +41,8 @@ namespace blink {
// means the smallest positive representable value is 0.25, the maximum // means the smallest positive representable value is 0.25, the maximum
// representable value is 8191.75, and the minimum representable value is -8192. // representable value is 8191.75, and the minimum representable value is -8192.
class PLATFORM_EXPORT FontSelectionValue { class PLATFORM_EXPORT FontSelectionValue {
USING_FAST_MALLOC(FontSelectionValue);
public: public:
FontSelectionValue() = default; FontSelectionValue() = default;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#if defined(OS_ANDROID) || defined(OS_WIN) #if defined(OS_ANDROID) || defined(OS_WIN)
...@@ -22,6 +23,8 @@ namespace blink { ...@@ -22,6 +23,8 @@ namespace blink {
class FontTableMatcher; class FontTableMatcher;
class FontUniqueNameLookup { class FontUniqueNameLookup {
USING_FAST_MALLOC(FontUniqueNameLookup);
public: public:
// Factory function to construct a platform specific font unique name lookup // Factory function to construct a platform specific font unique name lookup
// instance. Client must not use this directly as it is thread // instance. Client must not use this directly as it is thread
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_OPENTYPE_FONT_FORMAT_CHECK_H_
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/vector.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
#include "third_party/skia/include/core/SkData.h" #include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRefCnt.h"
...@@ -13,6 +14,8 @@ ...@@ -13,6 +14,8 @@
namespace blink { namespace blink {
class FontFormatCheck { class FontFormatCheck {
STACK_ALLOCATED();
public: public:
FontFormatCheck(sk_sp<SkData>); FontFormatCheck(sk_sp<SkData>);
bool IsVariableFont(); bool IsVariableFont();
......
...@@ -10,12 +10,15 @@ ...@@ -10,12 +10,15 @@
#include "third_party/blink/renderer/platform/fonts/shaping/case_mapping_harfbuzz_buffer_filler.h" #include "third_party/blink/renderer/platform/fonts/shaping/case_mapping_harfbuzz_buffer_filler.h"
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h" #include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h"
#include "third_party/blink/renderer/platform/fonts/small_caps_iterator.h" #include "third_party/blink/renderer/platform/fonts/small_caps_iterator.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include <hb.h> #include <hb.h>
namespace blink { namespace blink {
class PLATFORM_EXPORT OpenTypeCapsSupport { class PLATFORM_EXPORT OpenTypeCapsSupport {
STACK_ALLOCATED();
public: public:
OpenTypeCapsSupport(); OpenTypeCapsSupport();
OpenTypeCapsSupport(const HarfBuzzFace*, OpenTypeCapsSupport(const HarfBuzzFace*,
......
...@@ -42,6 +42,8 @@ namespace blink { ...@@ -42,6 +42,8 @@ namespace blink {
class PLATFORM_EXPORT OpenTypeVerticalData class PLATFORM_EXPORT OpenTypeVerticalData
: public RefCounted<OpenTypeVerticalData> { : public RefCounted<OpenTypeVerticalData> {
USING_FAST_MALLOC(OpenTypeVerticalData);
public: public:
static scoped_refptr<OpenTypeVerticalData> CreateUnscaled( static scoped_refptr<OpenTypeVerticalData> CreateUnscaled(
sk_sp<SkTypeface> typeface) { sk_sp<SkTypeface> typeface) {
......
...@@ -47,6 +47,8 @@ struct RangeData; ...@@ -47,6 +47,8 @@ struct RangeData;
struct BufferSlice; struct BufferSlice;
class PLATFORM_EXPORT HarfBuzzShaper final { class PLATFORM_EXPORT HarfBuzzShaper final {
DISALLOW_NEW();
public: public:
HarfBuzzShaper(const String& text) : text_(text) {} HarfBuzzShaper(const String& text) : text_(text) {}
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "third_party/blink/renderer/platform/geometry/layout_unit.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h"
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/text/text_direction.h" #include "third_party/blink/renderer/platform/text/text_direction.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
...@@ -106,6 +107,8 @@ typedef void (*GraphemeClusterCallback)(void* context, ...@@ -106,6 +107,8 @@ typedef void (*GraphemeClusterCallback)(void* context,
CanvasRotationInVertical); CanvasRotationInVertical);
class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
USING_FAST_MALLOC(ShapeResult);
public: public:
static scoped_refptr<ShapeResult> Create(const Font* font, static scoped_refptr<ShapeResult> Create(const Font* font,
unsigned num_characters, unsigned num_characters,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.h" #include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.h"
#include "third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.h" #include "third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include <hb.h> #include <hb.h>
...@@ -32,6 +33,8 @@ class PLATFORM_EXPORT ShapeResultTestInfo : public ShapeResult { ...@@ -32,6 +33,8 @@ class PLATFORM_EXPORT ShapeResultTestInfo : public ShapeResult {
}; };
class PLATFORM_EXPORT ShapeResultBloberizerTestInfo { class PLATFORM_EXPORT ShapeResultBloberizerTestInfo {
STATIC_ONLY(ShapeResultBloberizerTestInfo);
public: public:
static const SimpleFontData* PendingRunFontData( static const SimpleFontData* PendingRunFontData(
const ShapeResultBloberizer& bloberizer) { const ShapeResultBloberizer& bloberizer) {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKTYPEFACE_FACTORY_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKTYPEFACE_FACTORY_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKTYPEFACE_FACTORY_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SKIA_SKTYPEFACE_FACTORY_H_
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkRefCnt.h"
#include "third_party/skia/include/core/SkTypeface.h" #include "third_party/skia/include/core/SkTypeface.h"
...@@ -15,6 +16,8 @@ namespace blink { ...@@ -15,6 +16,8 @@ namespace blink {
// benefit of bundling typeface instantiation in one place but needlessly // benefit of bundling typeface instantiation in one place but needlessly
// introduces a wrapper for SkTypeface. // introduces a wrapper for SkTypeface.
class SkTypeface_Factory { class SkTypeface_Factory {
STATIC_ONLY(SkTypeface_Factory);
public: public:
static sk_sp<SkTypeface> FromFontConfigInterfaceIdAndTtcIndex(int config_id, static sk_sp<SkTypeface> FromFontConfigInterfaceIdAndTtcIndex(int config_id,
int ttc_index); int ttc_index);
......
...@@ -57,6 +57,8 @@ struct PLATFORM_EXPORT UnicodeRange final { ...@@ -57,6 +57,8 @@ struct PLATFORM_EXPORT UnicodeRange final {
}; };
class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> { class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> {
USING_FAST_MALLOC(UnicodeRangeSet);
public: public:
explicit UnicodeRangeSet(const Vector<UnicodeRange>&); explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
UnicodeRangeSet() = default; UnicodeRangeSet() = default;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink { namespace blink {
...@@ -20,6 +21,8 @@ namespace blink { ...@@ -20,6 +21,8 @@ namespace blink {
// third-party/emoji-segmenter. The dereferenced character category is cached // third-party/emoji-segmenter. The dereferenced character category is cached
// since Ragel dereferences multiple times without moving the iterator's cursor. // since Ragel dereferences multiple times without moving the iterator's cursor.
class PLATFORM_EXPORT UTF16RagelIterator { class PLATFORM_EXPORT UTF16RagelIterator {
DISALLOW_NEW();
public: public:
UTF16RagelIterator() : buffer_(nullptr), buffer_size_(0), cursor_(0) {} UTF16RagelIterator() : buffer_(nullptr), buffer_size_(0), cursor_(0) {}
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "third_party/skia/include/core/SkFontMgr.h" #include "third_party/skia/include/core/SkFontMgr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#if defined(OS_WIN) || defined(OS_MACOSX) #if defined(OS_WIN) || defined(OS_MACOSX)
#include "third_party/skia/include/ports/SkFontMgr_empty.h" #include "third_party/skia/include/ports/SkFontMgr_empty.h"
#endif #endif
...@@ -19,6 +20,8 @@ namespace blink { ...@@ -19,6 +20,8 @@ namespace blink {
// However, for variable fonts, color bitmap font formats and CFF2 fonts we want // However, for variable fonts, color bitmap font formats and CFF2 fonts we want
// to use FreeType on Windows and Mac. // to use FreeType on Windows and Mac.
class WebFontTypefaceFactory { class WebFontTypefaceFactory {
STACK_ALLOCATED();
public: public:
static bool CreateTypeface(const sk_sp<SkData>, sk_sp<SkTypeface>&); static bool CreateTypeface(const sk_sp<SkData>, sk_sp<SkTypeface>&);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment