[M130] Use std::optional string for FontFaceCreationParams 10/320510/3
authorsidpaswan <s.paswan@samsung.com>
Tue, 4 Mar 2025 10:51:15 +0000 (16:21 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 25 Mar 2025 00:24:57 +0000 (00:24 +0000)
In M130, tct-transitions tests crash after calling the dtor of FontFaceCreationParams while freeing the string. This patch uses std::optional<std::string> instead of std::string.

reference : https://chromium-review.googlesource.com/c/chromium/src/+/5629253

Change-Id: Icda090f72609fc95957e7019852cef44f6859c9c
Signed-off-by: sidpaswan <s.paswan@samsung.com>
third_party/blink/renderer/platform/fonts/font_face_creation_params.h

index 8f0aa2f1c14b639680b7c2f7cd23b112a3349f3f..35e2776e0e677839e0c261289f9c862fe1d7919f 100644 (file)
@@ -79,7 +79,7 @@ class FontFaceCreationParams {
   }
   const std::string& Filename() const {
     DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex);
-#if defined(ADDRESS_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_TIZEN)
     DCHECK(filename_.has_value());
     return *filename_;
 #else
@@ -126,7 +126,7 @@ class FontFaceCreationParams {
   AtomicString family_;
 
   void SetFilename(std::string& filename) {
-#if defined(ADDRESS_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_TIZEN)
     *filename_ = filename;
 #else
     filename_ = filename;
@@ -134,7 +134,7 @@ class FontFaceCreationParams {
   }
 
   bool FilenameEqual(const FontFaceCreationParams& other) const {
-#if defined(ADDRESS_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_TIZEN)
     if (!filename_.has_value() || !other.filename_.has_value()) {
       return filename_.has_value() == other.filename_.has_value();
     }
@@ -145,14 +145,14 @@ class FontFaceCreationParams {
   }
 
   bool HasFilename() const {
-#if defined(ADDRESS_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_TIZEN)
     return filename_.has_value();
 #else
     return true;
 #endif
   }
 
-#if defined(ADDRESS_SANITIZER)
+#if defined(ADDRESS_SANITIZER) || BUILDFLAG(IS_TIZEN)
   // We put the `std::string` behind an optional as ASAN counter checks require
   // that we properly call constructors and destructors for all strings. This is
   // not the case when `FontFaceCreationParams` is used in `WTF::HashMap` as key