forked from pool/nodejs-electron
* Node 20.16.0 OBS-URL: https://build.opensuse.org/package/show/devel:languages:nodejs/nodejs-electron?expand=0&rev=169
251 lines
10 KiB
Diff
251 lines
10 KiB
Diff
Revert the following commit:
|
|
|
|
commit 886c849ee96e3026d28d7615cdd5af9628a2e5c8
|
|
Author: Ian Kilpatrick <ikilpatrick@chromium.org>
|
|
Date: Tue Feb 20 18:18:04 2024 +0000
|
|
|
|
[gc] Make UnicodeRangeSet gc'd.
|
|
|
|
There should be no user-visible behaviour change.
|
|
|
|
Bug: 41490008
|
|
Change-Id: I7f0003b7ff7c464d4ee36442bcff8c63da79b20c
|
|
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302778
|
|
Reviewed-by: Dominik Röttsches <drott@chromium.org>
|
|
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
|
|
Cr-Commit-Position: refs/heads/main@{#1262789}
|
|
|
|
--- a/third_party/blink/renderer/core/css/css_font_face.cc
|
|
+++ b/third_party/blink/renderer/core/css/css_font_face.cc
|
|
@@ -291,7 +291,6 @@ bool CSSFontFace::UpdatePeriod() {
|
|
void CSSFontFace::Trace(Visitor* visitor) const {
|
|
visitor->Trace(segmented_font_faces_);
|
|
visitor->Trace(sources_);
|
|
- visitor->Trace(ranges_);
|
|
visitor->Trace(font_face_);
|
|
}
|
|
|
|
--- a/third_party/blink/renderer/core/css/css_font_face.h
|
|
+++ b/third_party/blink/renderer/core/css/css_font_face.h
|
|
@@ -47,8 +47,8 @@ class SimpleFontData;
|
|
|
|
class CORE_EXPORT CSSFontFace final : public GarbageCollected<CSSFontFace> {
|
|
public:
|
|
- CSSFontFace(FontFace* font_face, HeapVector<UnicodeRange>&& ranges)
|
|
- : ranges_(MakeGarbageCollected<UnicodeRangeSet>(std::move(ranges))),
|
|
+ CSSFontFace(FontFace* font_face, Vector<UnicodeRange>& ranges)
|
|
+ : ranges_(base::AdoptRef(new UnicodeRangeSet(ranges))),
|
|
font_face_(font_face) {
|
|
DCHECK(font_face_);
|
|
}
|
|
@@ -61,7 +61,7 @@ class CORE_EXPORT CSSFontFace final : pu
|
|
}
|
|
FontFace* GetFontFace() const { return font_face_.Get(); }
|
|
|
|
- const UnicodeRangeSet* Ranges() { return ranges_.Get(); }
|
|
+ scoped_refptr<UnicodeRangeSet> Ranges() { return ranges_; }
|
|
|
|
void AddSegmentedFontFace(CSSSegmentedFontFace*);
|
|
void RemoveSegmentedFontFace(CSSSegmentedFontFace*);
|
|
@@ -98,9 +98,9 @@ class CORE_EXPORT CSSFontFace final : pu
|
|
private:
|
|
void SetLoadStatus(FontFace::LoadStatusType);
|
|
|
|
+ scoped_refptr<UnicodeRangeSet> ranges_;
|
|
HeapHashSet<Member<CSSSegmentedFontFace>> segmented_font_faces_;
|
|
HeapDeque<Member<CSSFontFaceSource>> sources_;
|
|
- Member<const UnicodeRangeSet> ranges_;
|
|
Member<FontFace> font_face_;
|
|
};
|
|
|
|
--- a/third_party/blink/renderer/core/css/font_face.cc
|
|
+++ b/third_party/blink/renderer/core/css/font_face.cc
|
|
@@ -90,7 +90,7 @@ const CSSValue* ParseCSSValue(const Exec
|
|
|
|
CSSFontFace* CreateCSSFontFace(FontFace* font_face,
|
|
const CSSValue* unicode_range) {
|
|
- HeapVector<UnicodeRange> ranges;
|
|
+ Vector<UnicodeRange> ranges;
|
|
if (const auto* range_list = To<CSSValueList>(unicode_range)) {
|
|
unsigned num_ranges = range_list->length();
|
|
for (unsigned i = 0; i < num_ranges; i++) {
|
|
@@ -100,7 +100,7 @@ CSSFontFace* CreateCSSFontFace(FontFace*
|
|
}
|
|
}
|
|
|
|
- return MakeGarbageCollected<CSSFontFace>(font_face, std::move(ranges));
|
|
+ return MakeGarbageCollected<CSSFontFace>(font_face, ranges);
|
|
}
|
|
|
|
const CSSValue* ConvertFontMetricOverrideValue(const CSSValue* parsed_value) {
|
|
--- a/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
|
|
+++ b/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
|
|
@@ -39,18 +39,16 @@ class SimpleFontData;
|
|
class PLATFORM_EXPORT FontDataForRangeSet
|
|
: public GarbageCollected<FontDataForRangeSet> {
|
|
public:
|
|
- explicit FontDataForRangeSet(const SimpleFontData* font_data = nullptr,
|
|
- const UnicodeRangeSet* range_set = nullptr)
|
|
- : font_data_(font_data), range_set_(range_set) {}
|
|
+ explicit FontDataForRangeSet(
|
|
+ const SimpleFontData* font_data = nullptr,
|
|
+ scoped_refptr<UnicodeRangeSet> range_set = nullptr)
|
|
+ : font_data_(font_data), range_set_(std::move(range_set)) {}
|
|
|
|
FontDataForRangeSet(const FontDataForRangeSet& other);
|
|
|
|
virtual ~FontDataForRangeSet() = default;
|
|
|
|
- void Trace(Visitor* visitor) const {
|
|
- visitor->Trace(font_data_);
|
|
- visitor->Trace(range_set_);
|
|
- }
|
|
+ void Trace(Visitor* visitor) const { visitor->Trace(font_data_); }
|
|
|
|
bool Contains(UChar32 test_char) const {
|
|
return !range_set_ || range_set_->Contains(test_char);
|
|
@@ -58,7 +56,7 @@ class PLATFORM_EXPORT FontDataForRangeSe
|
|
bool IsEntireRange() const {
|
|
return !range_set_ || range_set_->IsEntireRange();
|
|
}
|
|
- const UnicodeRangeSet* Ranges() const { return range_set_.Get(); }
|
|
+ UnicodeRangeSet* Ranges() const { return range_set_.get(); }
|
|
bool HasFontData() const { return font_data_; }
|
|
const SimpleFontData* FontData() const { return font_data_.Get(); }
|
|
|
|
@@ -74,7 +72,7 @@ class PLATFORM_EXPORT FontDataForRangeSe
|
|
|
|
protected:
|
|
Member<const SimpleFontData> font_data_;
|
|
- Member<const UnicodeRangeSet> range_set_;
|
|
+ scoped_refptr<UnicodeRangeSet> range_set_;
|
|
};
|
|
|
|
} // namespace blink
|
|
--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
|
|
+++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
|
|
@@ -508,10 +508,10 @@ const OpenTypeVerticalData& HarfBuzzFace
|
|
return *harfbuzz_font_data_->VerticalData();
|
|
}
|
|
|
|
-hb_font_t* HarfBuzzFace::GetScaledFont(const UnicodeRangeSet* range_set,
|
|
+hb_font_t* HarfBuzzFace::GetScaledFont(scoped_refptr<UnicodeRangeSet> range_set,
|
|
VerticalLayoutCallbacks vertical_layout,
|
|
float specified_size) const {
|
|
- harfbuzz_font_data_->range_set_ = range_set;
|
|
+ harfbuzz_font_data_->range_set_ = std::move(range_set);
|
|
harfbuzz_font_data_->UpdateFallbackMetricsAndScale(*platform_data_,
|
|
vertical_layout);
|
|
|
|
--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
|
|
+++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
|
|
@@ -66,7 +66,7 @@ class HarfBuzzFace final : public Garbag
|
|
// Passing in specified_size in order to control selecting the right value
|
|
// from the trak table. If not set, the size of the internal FontPlatformData
|
|
// object will be used.
|
|
- hb_font_t* GetScaledFont(const UnicodeRangeSet*,
|
|
+ hb_font_t* GetScaledFont(scoped_refptr<UnicodeRangeSet>,
|
|
VerticalLayoutCallbacks,
|
|
float specified_size) const;
|
|
|
|
--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
|
|
+++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
|
|
@@ -32,7 +32,7 @@ struct HarfBuzzFontData final : public G
|
|
HarfBuzzFontData(const HarfBuzzFontData&) = delete;
|
|
HarfBuzzFontData& operator=(const HarfBuzzFontData&) = delete;
|
|
|
|
- void Trace(Visitor* visitor) const { visitor->Trace(range_set_); }
|
|
+ void Trace(Visitor*) const {}
|
|
|
|
// The vertical origin and vertical advance functions in HarfBuzzFace require
|
|
// the ascent and height metrics as fallback in case no specific vertical
|
|
@@ -98,7 +98,7 @@ struct HarfBuzzFontData final : public G
|
|
SpaceGlyphInOpenTypeTables::kUnknown;
|
|
|
|
scoped_refptr<OpenTypeVerticalData> vertical_data_;
|
|
- Member<const UnicodeRangeSet> range_set_;
|
|
+ scoped_refptr<UnicodeRangeSet> range_set_;
|
|
};
|
|
|
|
} // namespace blink
|
|
--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
|
|
+++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
|
|
@@ -289,7 +289,7 @@ void RoundHarfBuzzBufferPositions(hb_buf
|
|
inline bool ShapeRange(hb_buffer_t* buffer,
|
|
const FontFeatures& font_features,
|
|
const SimpleFontData* current_font,
|
|
- const UnicodeRangeSet* current_font_range_set,
|
|
+ scoped_refptr<UnicodeRangeSet> current_font_range_set,
|
|
UScriptCode current_run_script,
|
|
hb_direction_t direction,
|
|
hb_language_t language,
|
|
@@ -325,7 +325,7 @@ inline bool ShapeRange(hb_buffer_t* buff
|
|
hb_buffer_set_direction(buffer, direction);
|
|
|
|
hb_font_t* hb_font =
|
|
- face->GetScaledFont(current_font_range_set,
|
|
+ face->GetScaledFont(std::move(current_font_range_set),
|
|
HB_DIRECTION_IS_VERTICAL(direction)
|
|
? HarfBuzzFace::kPrepareForVerticalLayout
|
|
: HarfBuzzFace::kNoVerticalLayout,
|
|
--- a/third_party/blink/renderer/platform/fonts/unicode_range_set.cc
|
|
+++ b/third_party/blink/renderer/platform/fonts/unicode_range_set.cc
|
|
@@ -31,8 +31,8 @@
|
|
|
|
namespace blink {
|
|
|
|
-UnicodeRangeSet::UnicodeRangeSet(HeapVector<UnicodeRange>&& ranges)
|
|
- : ranges_(std::move(ranges)) {
|
|
+UnicodeRangeSet::UnicodeRangeSet(const Vector<UnicodeRange>& ranges)
|
|
+ : ranges_(ranges) {
|
|
if (ranges_.empty())
|
|
return;
|
|
|
|
--- a/third_party/blink/renderer/platform/fonts/unicode_range_set.h
|
|
+++ b/third_party/blink/renderer/platform/fonts/unicode_range_set.h
|
|
@@ -26,12 +26,13 @@
|
|
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_UNICODE_RANGE_SET_H_
|
|
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_UNICODE_RANGE_SET_H_
|
|
|
|
-#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
|
|
-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
|
|
#include "third_party/blink/renderer/platform/platform_export.h"
|
|
+#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
|
|
#include "third_party/blink/renderer/platform/wtf/text/character_names.h"
|
|
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
|
|
#include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h"
|
|
+#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
|
|
+#include "third_party/blink/renderer/platform/wtf/vector.h"
|
|
|
|
namespace blink {
|
|
|
|
@@ -55,14 +56,13 @@ struct PLATFORM_EXPORT UnicodeRange fina
|
|
UChar32 to_;
|
|
};
|
|
|
|
-class PLATFORM_EXPORT UnicodeRangeSet
|
|
- : public GarbageCollected<UnicodeRangeSet> {
|
|
+class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> {
|
|
+ USING_FAST_MALLOC(UnicodeRangeSet);
|
|
+
|
|
public:
|
|
- explicit UnicodeRangeSet(HeapVector<UnicodeRange>&&);
|
|
+ explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
|
|
UnicodeRangeSet() = default;
|
|
|
|
- void Trace(Visitor* visitor) const { visitor->Trace(ranges_); }
|
|
-
|
|
bool Contains(UChar32) const;
|
|
bool IntersectsWith(const String&) const;
|
|
bool IsEntireRange() const { return ranges_.empty(); }
|
|
@@ -71,8 +71,7 @@ class PLATFORM_EXPORT UnicodeRangeSet
|
|
bool operator==(const UnicodeRangeSet& other) const;
|
|
|
|
private:
|
|
- HeapVector<UnicodeRange>
|
|
- ranges_; // If empty, represents the whole code space.
|
|
+ Vector<UnicodeRange> ranges_; // If empty, represents the whole code space.
|
|
};
|
|
|
|
} // namespace blink
|