[SVG -> OTF Converter] Make Placeholder a move-only type
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Dec 2014 18:45:05 +0000 (18:45 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 23 Dec 2014 18:45:05 +0000 (18:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139870

Reviewed by Anders Carlsson.

No new tests because there is no behavior change.

* svg/SVGToOTFFontConversion.cpp:
(WebCore::SVGToOTFFontConverter::Placeholder::Placeholder):
(WebCore::SVGToOTFFontConverter::Placeholder::populate):
(WebCore::SVGToOTFFontConverter::Placeholder::~Placeholder):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@177688 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/svg/SVGToOTFFontConversion.cpp

index eff7158a88bea02eb00e854148e87fcd46de779b..9afb0250bda8845f08be931636b716c15f947228 100644 (file)
@@ -1,3 +1,17 @@
+2014-12-23  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [SVG -> OTF Converter] Make Placeholder a move-only type
+        https://bugs.webkit.org/show_bug.cgi?id=139870
+
+        Reviewed by Anders Carlsson.
+
+        No new tests because there is no behavior change.
+
+        * svg/SVGToOTFFontConversion.cpp:
+        (WebCore::SVGToOTFFontConverter::Placeholder::Placeholder):
+        (WebCore::SVGToOTFFontConverter::Placeholder::populate):
+        (WebCore::SVGToOTFFontConverter::Placeholder::~Placeholder):
+
 2014-12-23  Chris Dumez  <cdumez@apple.com>
 
         Move color CSS properties to the new StyleBuilder
index c17d62eca8b713776e207aca478148e21d276802..2640516523edd8ea845b2311882f8221c2746ab8 100644 (file)
@@ -83,32 +83,45 @@ private:
             : m_converter(converter)
             , m_baseOfOffset(baseOfOffset)
             , m_location(m_converter.m_result.size())
+        {
+            m_converter.append16(0);
+        }
+
+        Placeholder(Placeholder&& other)
+            : m_converter(other.m_converter)
+            , m_baseOfOffset(other.m_baseOfOffset)
+            , m_location(other.m_location)
 #if !ASSERT_DISABLED
-            , m_written(false)
+            , m_active(other.m_active)
 #endif
         {
-            m_converter.append16(0);
+#if !ASSERT_DISABLED
+            other.m_active = false;
+#endif
         }
+
         void populate()
         {
-            ASSERT(!m_written);
+            ASSERT(m_active);
             size_t delta = m_converter.m_result.size() - m_baseOfOffset;
             ASSERT(delta < std::numeric_limits<uint16_t>::max());
             m_converter.overwrite16(m_location, delta);
 #if !ASSERT_DISABLED
-            m_written = true;
+            m_active = false;
 #endif
         }
+
         ~Placeholder()
         {
-            ASSERT(m_written);
+            ASSERT(!m_active);
         }
+
     private:
         SVGToOTFFontConverter& m_converter;
         const size_t m_baseOfOffset;
         const size_t m_location;
 #if !ASSERT_DISABLED
-        bool m_written;
+        bool m_active = { true };
 #endif
     };