Title: [260311] trunk/Source
Revision
260311
Author
[email protected]
Date
2020-04-18 08:57:14 -0700 (Sat, 18 Apr 2020)

Log Message

[WTF] Move DataRef.h from WebCore to WTF to utilize it in JSC
https://bugs.webkit.org/show_bug.cgi?id=210689

Reviewed by Anders Carlsson.

Source/WebCore:

No behavior change, just moving header from WebCore to WTF.

* Headers.cmake:
* WebCore.xcodeproj/project.pbxproj:
* rendering/style/NinePieceImage.h:
* rendering/style/RenderStyle.h:
* rendering/style/SVGRenderStyle.h:
* rendering/style/StyleRareInheritedData.cpp:
* rendering/style/StyleRareInheritedData.h:
* rendering/style/StyleRareNonInheritedData.h:

Source/WTF:

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/DataRef.h: Renamed from Source/WebCore/rendering/style/DataRef.h.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (260310 => 260311)


--- trunk/Source/WTF/ChangeLog	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WTF/ChangeLog	2020-04-18 15:57:14 UTC (rev 260311)
@@ -1,3 +1,14 @@
+2020-04-18  Yusuke Suzuki  <[email protected]>
+
+        [WTF] Move DataRef.h from WebCore to WTF to utilize it in JSC
+        https://bugs.webkit.org/show_bug.cgi?id=210689
+
+        Reviewed by Anders Carlsson.
+
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/DataRef.h: Renamed from Source/WebCore/rendering/style/DataRef.h.
+
 2020-04-17  Saam Barati  <[email protected]>
 
         GetTypedArrayByteOffset is broken on arm64e

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (260310 => 260311)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2020-04-18 15:57:14 UTC (rev 260311)
@@ -709,6 +709,7 @@
 		E31BDE2822E913CC0029B105 /* MachVMSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachVMSPI.h; sourceTree = "<group>"; };
 		E3200AB41E9A536D003B59D2 /* PlatformRegisters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformRegisters.h; sourceTree = "<group>"; };
 		E32A207323C5902D0034A092 /* NakedRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NakedRef.h; sourceTree = "<group>"; };
+		E339C163244B4E8700359DA9 /* DataRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataRef.h; sourceTree = "<group>"; };
 		E33D5F871FBED66700BF625E /* RecursableLambda.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecursableLambda.h; sourceTree = "<group>"; };
 		E34CD0D022810A020020D299 /* Packed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Packed.h; sourceTree = "<group>"; };
 		E360C7642127B85B00C90F0E /* UnalignedAccess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnalignedAccess.h; sourceTree = "<group>"; };
@@ -989,6 +990,7 @@
 				A8A47275151A825A004123FF /* CurrentTime.cpp */,
 				A8A47277151A825A004123FF /* DataLog.cpp */,
 				A8A47278151A825A004123FF /* DataLog.h */,
+				E339C163244B4E8700359DA9 /* DataRef.h */,
 				A8A47279151A825A004123FF /* DateMath.cpp */,
 				A8A4727A151A825A004123FF /* DateMath.h */,
 				0F95B63220CB4B7700479635 /* DebugHeap.cpp */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (260310 => 260311)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2020-04-18 15:57:14 UTC (rev 260311)
@@ -47,6 +47,7 @@
     CryptographicallyRandomNumber.h
     DataLog.h
     DataMutex.h
+    DataRef.h
     DateMath.h
     DebugHeap.h
     DebugUtilities.h

Copied: trunk/Source/WTF/wtf/DataRef.h (from rev 260309, trunk/Source/WebCore/rendering/style/DataRef.h) (0 => 260311)


--- trunk/Source/WTF/wtf/DataRef.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/DataRef.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2003-2020 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#pragma once
+
+#include <wtf/Ref.h>
+
+namespace WTF {
+
+template <typename T>
+class DataRef {
+public:
+    DataRef(Ref<T>&& data)
+        : m_data(WTFMove(data))
+    {
+    }
+
+    DataRef(const DataRef& other)
+        : m_data(other.m_data.copyRef())
+    {
+    }
+
+    DataRef& operator=(const DataRef& other)
+    {
+        m_data = other.m_data.copyRef();
+        return *this;
+    }
+
+    DataRef(DataRef&&) = default;
+    DataRef& operator=(DataRef&&) = default;
+
+    DataRef replace(DataRef&& other)
+    {
+        return m_data.replace(WTFMove(other.m_data));
+    }
+
+    operator const T&() const
+    {
+        return m_data;
+    }
+
+    const T* ptr() const
+    {
+        return m_data.ptr();
+    }
+
+    const T& get() const
+    {
+        return m_data;
+    }
+
+    const T& operator*() const
+    {
+        return m_data;
+    }
+
+    const T* operator->() const
+    {
+        return m_data.ptr();
+    }
+
+    T& access()
+    {
+        if (!m_data->hasOneRef())
+            m_data = m_data->copy();
+        return m_data;
+    }
+
+    bool operator==(const DataRef& other) const
+    {
+        return m_data.ptr() == other.m_data.ptr() || m_data.get() == other.m_data.get();
+    }
+
+    bool operator!=(const DataRef& other) const
+    {
+        return !(*this == other);
+    }
+
+private:
+    Ref<T> m_data;
+};
+
+} // namespace WTF
+
+using WTF::DataRef;

Modified: trunk/Source/WebCore/ChangeLog (260310 => 260311)


--- trunk/Source/WebCore/ChangeLog	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/ChangeLog	2020-04-18 15:57:14 UTC (rev 260311)
@@ -1,3 +1,21 @@
+2020-04-18  Yusuke Suzuki  <[email protected]>
+
+        [WTF] Move DataRef.h from WebCore to WTF to utilize it in JSC
+        https://bugs.webkit.org/show_bug.cgi?id=210689
+
+        Reviewed by Anders Carlsson.
+
+        No behavior change, just moving header from WebCore to WTF.
+
+        * Headers.cmake:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/style/NinePieceImage.h:
+        * rendering/style/RenderStyle.h:
+        * rendering/style/SVGRenderStyle.h:
+        * rendering/style/StyleRareInheritedData.cpp:
+        * rendering/style/StyleRareInheritedData.h:
+        * rendering/style/StyleRareNonInheritedData.h:
+
 2020-04-18  David Kilzer  <[email protected]>
 
         Attempt #2 to fix tvOS build

Modified: trunk/Source/WebCore/Headers.cmake (260310 => 260311)


--- trunk/Source/WebCore/Headers.cmake	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/Headers.cmake	2020-04-18 15:57:14 UTC (rev 260311)
@@ -1413,7 +1413,6 @@
     rendering/style/BorderData.h
     rendering/style/BorderValue.h
     rendering/style/CounterDirectives.h
-    rendering/style/DataRef.h
     rendering/style/FillLayer.h
     rendering/style/GapLength.h
     rendering/style/GridArea.h

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (260310 => 260311)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-04-18 15:57:14 UTC (rev 260311)
@@ -3769,7 +3769,6 @@
 		BC2272BD0E82EAAE00E7F975 /* StyleRareNonInheritedData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2272BB0E82EAAE00E7F975 /* StyleRareNonInheritedData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC2272E40E82EE9B00E7F975 /* StyleRareInheritedData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2272E20E82EE9B00E7F975 /* StyleRareInheritedData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC2273040E82F1E600E7F975 /* StyleInheritedData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2273020E82F1E600E7F975 /* StyleInheritedData.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		BC22746F0E83664500E7F975 /* DataRef.h in Headers */ = {isa = PBXBuildFile; fileRef = BC22746E0E83664500E7F975 /* DataRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC2274790E8366E200E7F975 /* SVGRenderStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2274750E8366E200E7F975 /* SVGRenderStyle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2274770E8366E200E7F975 /* SVGRenderStyleDefs.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		BC23EE920DAED2BC009FDC91 /* CSSImageGeneratorValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23EE910DAED2BC009FDC91 /* CSSImageGeneratorValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -13174,7 +13173,6 @@
 		BC2272E20E82EE9B00E7F975 /* StyleRareInheritedData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRareInheritedData.h; sourceTree = "<group>"; };
 		BC2273010E82F1E600E7F975 /* StyleInheritedData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleInheritedData.cpp; sourceTree = "<group>"; };
 		BC2273020E82F1E600E7F975 /* StyleInheritedData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleInheritedData.h; sourceTree = "<group>"; };
-		BC22746E0E83664500E7F975 /* DataRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataRef.h; sourceTree = "<group>"; };
 		BC2274740E8366E200E7F975 /* SVGRenderStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderStyle.cpp; sourceTree = "<group>"; };
 		BC2274750E8366E200E7F975 /* SVGRenderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGRenderStyle.h; sourceTree = "<group>"; };
 		BC2274760E8366E200E7F975 /* SVGRenderStyleDefs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGRenderStyleDefs.cpp; sourceTree = "<group>"; };
@@ -25729,7 +25727,6 @@
 				BC5EB94F0E82056B00B25965 /* CounterDirectives.h */,
 				BC2272A10E82E87C00E7F975 /* CursorData.h */,
 				BC2272AC0E82E8F300E7F975 /* CursorList.h */,
-				BC22746E0E83664500E7F975 /* DataRef.h */,
 				BC5EB69C0E81DAEB00B25965 /* FillLayer.cpp */,
 				BC5EB69D0E81DAEB00B25965 /* FillLayer.h */,
 				8E33CD93201A29C100E39093 /* GapLength.cpp */,
@@ -30003,7 +30000,6 @@
 				E517670320B88C1400D41167 /* DataListSuggestionInformation.h in Headers */,
 				E52CF54F20A35A2800DADA27 /* DataListSuggestionPicker.h in Headers */,
 				E52CF54D20A268AC00DADA27 /* DataListSuggestionsClient.h in Headers */,
-				BC22746F0E83664500E7F975 /* DataRef.h in Headers */,
 				BC64641C11D7F416006455B0 /* DatasetDOMStringMap.h in Headers */,
 				85031B3E0A44EFC700F992E0 /* DataTransfer.h in Headers */,
 				81AC5999131636E60009A7E0 /* DataTransferItem.h in Headers */,

Deleted: trunk/Source/WebCore/rendering/style/DataRef.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/DataRef.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/DataRef.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#pragma once
-
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-template <typename T> class DataRef {
-public:
-    DataRef(Ref<T>&& data)
-        : m_data(WTFMove(data))
-    {
-    }
-
-    DataRef(const DataRef& other)
-        : m_data(other.m_data.copyRef())
-    {
-    }
-
-    DataRef& operator=(const DataRef& other)
-    {
-        m_data = other.m_data.copyRef();
-        return *this;
-    }
-
-    DataRef(DataRef&&) = default;
-    DataRef& operator=(DataRef&&) = default;
-
-    DataRef replace(DataRef&& other)
-    {
-        return m_data.replace(WTFMove(other.m_data));
-    }
-
-    operator const T&() const
-    {
-        return m_data;
-    }
-
-    const T* ptr() const
-    {
-        return m_data.ptr();
-    }
-
-    const T& get() const
-    {
-        return m_data;
-    }
-
-    const T& operator*() const
-    {
-        return m_data;
-    }
-
-    const T* operator->() const
-    {
-        return m_data.ptr();
-    }
-
-    T& access()
-    {
-        if (!m_data->hasOneRef())
-            m_data = m_data->copy();
-        return m_data;
-    }
-
-    bool operator==(const DataRef& other) const
-    {
-        return m_data.ptr() == other.m_data.ptr() || m_data.get() == other.m_data.get();
-    }
-
-    bool operator!=(const DataRef& other) const
-    {
-        return !(*this == other);
-    }
-
-private:
-    Ref<T> m_data;
-};
-
-} // namespace WebCore

Modified: trunk/Source/WebCore/rendering/style/NinePieceImage.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/NinePieceImage.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/NinePieceImage.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -23,9 +23,9 @@
 
 #pragma once
 
-#include "DataRef.h"
 #include "LengthBox.h"
 #include "StyleImage.h"
+#include <wtf/DataRef.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -31,7 +31,6 @@
 #include "CSSPropertyNames.h"
 #include "Color.h"
 #include "CounterDirectives.h"
-#include "DataRef.h"
 #include "FilterOperations.h"
 #include "FontCascadeDescription.h"
 #include "GapLength.h"
@@ -68,6 +67,7 @@
 #include "TransformOperations.h"
 #include "UnicodeBidi.h"
 #include <memory>
+#include <wtf/DataRef.h>
 #include <wtf/Forward.h>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/OptionSet.h>

Modified: trunk/Source/WebCore/rendering/style/SVGRenderStyle.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/SVGRenderStyle.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -23,10 +23,10 @@
 
 #pragma once
 
-#include "DataRef.h"
 #include "RenderStyleConstants.h"
 #include "SVGRenderStyleDefs.h"
 #include "WindRule.h"
+#include <wtf/DataRef.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2020-04-18 15:57:14 UTC (rev 260311)
@@ -23,7 +23,6 @@
 #include "StyleRareInheritedData.h"
 
 #include "CursorList.h"
-#include "DataRef.h"
 #include "QuotesData.h"
 #include "RenderStyle.h"
 #include "RenderStyleConstants.h"
@@ -32,6 +31,7 @@
 #include "StyleCustomPropertyData.h"
 #include "StyleFilterData.h"
 #include "StyleImage.h"
+#include <wtf/DataRef.h>
 #include <wtf/PointerComparison.h>
 
 namespace WebCore {

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -25,12 +25,12 @@
 #pragma once
 
 #include "Color.h"
-#include "DataRef.h"
 #include "Length.h"
 #include "StyleCustomPropertyData.h"
 #include "TabSize.h"
 #include "TextDecorationThickness.h"
 #include "TextUnderlineOffset.h"
+#include <wtf/DataRef.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/AtomString.h>
 

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h (260310 => 260311)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2020-04-18 14:59:11 UTC (rev 260310)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.h	2020-04-18 15:57:14 UTC (rev 260311)
@@ -27,7 +27,6 @@
 #include "CSSPropertyNames.h"
 #include "ClipPathOperation.h"
 #include "CounterDirectives.h"
-#include "DataRef.h"
 #include "FillLayer.h"
 #include "GapLength.h"
 #include "LengthPoint.h"
@@ -38,6 +37,7 @@
 #include "StyleSelfAlignmentData.h"
 #include "WillChangeData.h"
 #include <memory>
+#include <wtf/DataRef.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to