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 @@
#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/wtf/allocator.h"
class SkTypeface;
namespace blink {
class PLATFORM_EXPORT BitmapGlyphsBlacklist {
STATIC_ONLY(BitmapGlyphsBlacklist);
public:
static bool AvoidEmbeddedBitmapsForTypeface(SkTypeface*);
};
......
......@@ -39,6 +39,8 @@ class FontDescription;
const int kCAllFamiliesScanned = -1;
class PLATFORM_EXPORT FontFallbackList : public RefCounted<FontFallbackList> {
USING_FAST_MALLOC(FontFallbackList);
public:
static scoped_refptr<FontFallbackList> Create() {
return base::AdoptRef(new FontFallbackList());
......
......@@ -9,6 +9,7 @@
#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/text/layout_locale.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
struct hb_font_funcs_t;
......@@ -22,6 +23,8 @@ enum CreateIfNeeded { kDoNotCreate, kCreate };
// FontGlobalContext contains non-thread-safe, thread-specific data used for
// font formatting.
class PLATFORM_EXPORT FontGlobalContext {
USING_FAST_MALLOC(FontGlobalContext);
public:
static FontGlobalContext* Get(CreateIfNeeded = kCreate);
......
......@@ -30,6 +30,8 @@
namespace {
class IntegerHasher {
STACK_ALLOCATED();
public:
void add(unsigned integer) {
m_underlyingHasher.AddCharactersAssumingAligned(integer, integer >> 16);
......
......@@ -27,6 +27,7 @@
#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/wtf/allocator.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/math_extras.h"
......@@ -40,6 +41,8 @@ namespace blink {
// means the smallest positive representable value is 0.25, the maximum
// representable value is 8191.75, and the minimum representable value is -8192.
class PLATFORM_EXPORT FontSelectionValue {
USING_FAST_MALLOC(FontSelectionValue);
public:
FontSelectionValue() = default;
......
......@@ -7,6 +7,7 @@
#include "base/macros.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"
#if defined(OS_ANDROID) || defined(OS_WIN)
......@@ -22,6 +23,8 @@ namespace blink {
class FontTableMatcher;
class FontUniqueNameLookup {
USING_FAST_MALLOC(FontUniqueNameLookup);
public:
// Factory function to construct a platform specific font unique name lookup
// instance. Client must not use this directly as it is thread
......
......@@ -5,6 +5,7 @@
#ifndef 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/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkRefCnt.h"
......@@ -13,6 +14,8 @@
namespace blink {
class FontFormatCheck {
STACK_ALLOCATED();
public:
FontFormatCheck(sk_sp<SkData>);
bool IsVariableFont();
......
......@@ -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/harfbuzz_face.h"
#include "third_party/blink/renderer/platform/fonts/small_caps_iterator.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include <hb.h>
namespace blink {
class PLATFORM_EXPORT OpenTypeCapsSupport {
STACK_ALLOCATED();
public:
OpenTypeCapsSupport();
OpenTypeCapsSupport(const HarfBuzzFace*,
......
......@@ -42,6 +42,8 @@ namespace blink {
class PLATFORM_EXPORT OpenTypeVerticalData
: public RefCounted<OpenTypeVerticalData> {
USING_FAST_MALLOC(OpenTypeVerticalData);
public:
static scoped_refptr<OpenTypeVerticalData> CreateUnscaled(
sk_sp<SkTypeface> typeface) {
......
......@@ -47,6 +47,8 @@ struct RangeData;
struct BufferSlice;
class PLATFORM_EXPORT HarfBuzzShaper final {
DISALLOW_NEW();
public:
HarfBuzzShaper(const String& text) : text_(text) {}
......
......@@ -39,6 +39,7 @@
#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/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/hash_set.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
......@@ -106,6 +107,8 @@ typedef void (*GraphemeClusterCallback)(void* context,
CanvasRotationInVertical);
class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
USING_FAST_MALLOC(ShapeResult);
public:
static scoped_refptr<ShapeResult> Create(const Font* font,
unsigned num_characters,
......
......@@ -7,6 +7,7 @@
#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/wtf/allocator.h"
#include <hb.h>
......@@ -32,6 +33,8 @@ class PLATFORM_EXPORT ShapeResultTestInfo : public ShapeResult {
};
class PLATFORM_EXPORT ShapeResultBloberizerTestInfo {
STATIC_ONLY(ShapeResultBloberizerTestInfo);
public:
static const SimpleFontData* PendingRunFontData(
const ShapeResultBloberizer& bloberizer) {
......
......@@ -5,6 +5,7 @@
#ifndef 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/SkTypeface.h"
......@@ -15,6 +16,8 @@ namespace blink {
// benefit of bundling typeface instantiation in one place but needlessly
// introduces a wrapper for SkTypeface.
class SkTypeface_Factory {
STATIC_ONLY(SkTypeface_Factory);
public:
static sk_sp<SkTypeface> FromFontConfigInterfaceIdAndTtcIndex(int config_id,
int ttc_index);
......
......@@ -57,6 +57,8 @@ struct PLATFORM_EXPORT UnicodeRange final {
};
class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> {
USING_FAST_MALLOC(UnicodeRangeSet);
public:
explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
UnicodeRangeSet() = default;
......
......@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
......@@ -20,6 +21,8 @@ namespace blink {
// third-party/emoji-segmenter. The dereferenced character category is cached
// since Ragel dereferences multiple times without moving the iterator's cursor.
class PLATFORM_EXPORT UTF16RagelIterator {
DISALLOW_NEW();
public:
UTF16RagelIterator() : buffer_(nullptr), buffer_size_(0), cursor_(0) {}
......
......@@ -8,6 +8,7 @@
#include "third_party/skia/include/core/SkFontMgr.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h"
#if defined(OS_WIN) || defined(OS_MACOSX)
#include "third_party/skia/include/ports/SkFontMgr_empty.h"
#endif
......@@ -19,6 +20,8 @@ namespace blink {
// However, for variable fonts, color bitmap font formats and CFF2 fonts we want
// to use FreeType on Windows and Mac.
class WebFontTypefaceFactory {
STACK_ALLOCATED();
public:
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