Commit 3079e627 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Get rid of unused function ShapeResult::MutableUnique()

This patch gets rid of |unused function ShapeResult::MutableUnique()|
for improving code health.

Change-Id: I6ab5c02b8ee6d92128fd44486212c9df56fba8d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412117
Auto-Submit: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807373}
parent 443ea6a2
...@@ -203,22 +203,6 @@ INSTANTIATE_TEST_SUITE_P(HarfBuzzShaperTest, ...@@ -203,22 +203,6 @@ INSTANTIATE_TEST_SUITE_P(HarfBuzzShaperTest,
testing::Values(TextDirection::kLtr, testing::Values(TextDirection::kLtr,
TextDirection::kRtl)); TextDirection::kRtl));
TEST_F(HarfBuzzShaperTest, MutableUnique) {
scoped_refptr<ShapeResult> result =
ShapeResult::Create(&font, 0, 0, TextDirection::kLtr);
EXPECT_TRUE(result->HasOneRef());
// At this point, |result| has only one ref count.
scoped_refptr<ShapeResult> result2 = result->MutableUnique();
EXPECT_EQ(result.get(), result2.get());
EXPECT_FALSE(result2->HasOneRef());
// Since |result| has 2 ref counts, it should return a clone.
scoped_refptr<ShapeResult> result3 = result->MutableUnique();
EXPECT_NE(result.get(), result3.get());
EXPECT_TRUE(result3->HasOneRef());
}
TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsLatin) { TEST_F(HarfBuzzShaperTest, ResolveCandidateRunsLatin) {
String latin_common = To16Bit("ABC DEF.", 8); String latin_common = To16Bit("ABC DEF.", 8);
HarfBuzzShaper shaper(latin_common); HarfBuzzShaper shaper(latin_common);
......
...@@ -414,12 +414,6 @@ size_t ShapeResult::ByteSize() const { ...@@ -414,12 +414,6 @@ size_t ShapeResult::ByteSize() const {
return self_byte_size; return self_byte_size;
} }
scoped_refptr<ShapeResult> ShapeResult::MutableUnique() const {
if (HasOneRef())
return const_cast<ShapeResult*>(this);
return ShapeResult::Create(*this);
}
unsigned ShapeResult::NextSafeToBreakOffset(unsigned index) const { unsigned ShapeResult::NextSafeToBreakOffset(unsigned index) const {
for (auto* it = runs_.begin(); it != runs_.end(); ++it) { for (auto* it = runs_.begin(); it != runs_.end(); ++it) {
const auto& run = *it; const auto& run = *it;
......
...@@ -155,10 +155,6 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> { ...@@ -155,10 +155,6 @@ class PLATFORM_EXPORT ShapeResult : public RefCounted<ShapeResult> {
const OpenTypeMathStretchData::AssemblyParameters&); const OpenTypeMathStretchData::AssemblyParameters&);
~ShapeResult(); ~ShapeResult();
// Returns a mutable unique instance. If |this| has more than 1 ref count,
// a clone is created.
scoped_refptr<ShapeResult> MutableUnique() const;
// The logical width of this result. // The logical width of this result.
float Width() const { return width_; } float Width() const { return width_; }
LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); } LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); }
......
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