Remove WTF::ListRefPtr class
authormikhail.pozdnyakov@intel.com <mikhail.pozdnyakov@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2013 17:12:44 +0000 (17:12 +0000)
committermikhail.pozdnyakov@intel.com <mikhail.pozdnyakov@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2013 17:12:44 +0000 (17:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115516

Reviewed by Anders Carlsson.

ListRefPtr was used only by FontFamily class, besides it strongly depended
on FontFamily class semantics which made it non-generic and inappropriate
for being present inside WTF.

This patch removes WTF::ListRefPtr class and moves its the functionality
into FontFamily class.

Source/WebCore:

No new tests, no change in the behavior.

* page/FrameTree.h:
(FrameTree):
* platform/graphics/FontFamily.h:
(FontFamily):
(WebCore::FontFamily::~FontFamily):
(WebCore):

Source/WTF:

* GNUmakefile.list.am:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/Forward.h:
(WTF):
* wtf/ListRefPtr.h: Removed.

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

13 files changed:
Source/WTF/ChangeLog
Source/WTF/GNUmakefile.list.am
Source/WTF/WTF.pro
Source/WTF/WTF.vcproj/WTF.vcproj
Source/WTF/WTF.vcxproj/WTF.vcxproj
Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/Forward.h
Source/WTF/wtf/ListRefPtr.h [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameTree.h
Source/WebCore/platform/graphics/FontFamily.h

index 79b5068..e7f37c3 100644 (file)
@@ -1,3 +1,28 @@
+2013-05-03  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
+
+        Remove WTF::ListRefPtr class
+        https://bugs.webkit.org/show_bug.cgi?id=115516
+
+        Reviewed by Anders Carlsson.
+
+        ListRefPtr was used only by FontFamily class, besides it strongly depended
+        on FontFamily class semantics which made it non-generic and inappropriate
+        for being present inside WTF.
+
+        This patch removes WTF::ListRefPtr class and moves its the functionality
+        into FontFamily class.
+
+        * GNUmakefile.list.am:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.vcxproj/WTF.vcxproj.filters:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/Forward.h:
+        (WTF):
+        * wtf/ListRefPtr.h: Removed.
+
 2013-05-02  Brent Fulgham  <bfulgham@webkit.org>
 
         [WinCairo] Unreviewed build fix.
index 064241b..e14090b 100644 (file)
@@ -79,7 +79,6 @@ wtf_sources += \
     Source/WTF/wtf/Int8Array.h \
     Source/WTF/wtf/IntegralTypedArrayBase.h \
     Source/WTF/wtf/ListHashSet.h \
-    Source/WTF/wtf/ListRefPtr.h \
     Source/WTF/wtf/Locker.h \
     Source/WTF/wtf/MD5.cpp \
     Source/WTF/wtf/MD5.h \
index cec6a4b..883c838 100644 (file)
@@ -84,7 +84,6 @@ HEADERS += \
     Int32Array.h \
     Int8Array.h \
     ListHashSet.h \
-    ListRefPtr.h \
     Locker.h \
     MainThread.h \
     MallocZoneSupport.h \
index 43ab641..716314f 100644 (file)
                        >
                </File>
                <File
-                       RelativePath="..\wtf\ListRefPtr.h"
-                       >
-               </File>
-               <File
                        RelativePath="..\wtf\Locker.h"
                        >
                </File>
index e08c13f..adcb6bc 100644 (file)
     <ClInclude Include="..\wtf\Int32Array.h" />\r
     <ClInclude Include="..\wtf\Int8Array.h" />\r
     <ClInclude Include="..\wtf\ListHashSet.h" />\r
-    <ClInclude Include="..\wtf\ListRefPtr.h" />\r
     <ClInclude Include="..\wtf\Locker.h" />\r
     <ClInclude Include="..\wtf\MainThread.h" />\r
     <ClInclude Include="..\wtf\MallocZoneSupport.h" />\r
index 25ff0ed..e36660a 100644 (file)
     <ClInclude Include="..\wtf\ListHashSet.h">\r
       <Filter>wtf</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\wtf\ListRefPtr.h">\r
-      <Filter>wtf</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\wtf\Locker.h">\r
       <Filter>wtf</Filter>\r
     </ClInclude>\r
index b422027..fde4d67 100644 (file)
                A8A473DF151A825B004123FF /* Int32Array.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472BF151A825A004123FF /* Int32Array.h */; };
                A8A473E0151A825B004123FF /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */; };
                A8A473E1151A825B004123FF /* ListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C1151A825A004123FF /* ListHashSet.h */; };
-               A8A473E2151A825B004123FF /* ListRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C2151A825A004123FF /* ListRefPtr.h */; };
                A8A473E3151A825B004123FF /* Locker.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A472C3151A825A004123FF /* Locker.h */; };
                A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C5151A825A004123FF /* MainThreadMac.mm */; };
                A8A473E5151A825B004123FF /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A472C6151A825A004123FF /* MainThread.cpp */; };
                A8A472BF151A825A004123FF /* Int32Array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Int32Array.h; sourceTree = "<group>"; };
                A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegralTypedArrayBase.h; sourceTree = "<group>"; };
                A8A472C1151A825A004123FF /* ListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListHashSet.h; sourceTree = "<group>"; };
-               A8A472C2151A825A004123FF /* ListRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ListRefPtr.h; sourceTree = "<group>"; };
                A8A472C3151A825A004123FF /* Locker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Locker.h; sourceTree = "<group>"; };
                A8A472C5151A825A004123FF /* MainThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MainThreadMac.mm; sourceTree = "<group>"; };
                A8A472C6151A825A004123FF /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
                                A8A472BD151A825A004123FF /* Int8Array.h */,
                                A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */,
                                A8A472C1151A825A004123FF /* ListHashSet.h */,
-                               A8A472C2151A825A004123FF /* ListRefPtr.h */,
                                A8A472C3151A825A004123FF /* Locker.h */,
                                A8A472C6151A825A004123FF /* MainThread.cpp */,
                                A8A472C7151A825B004123FF /* MainThread.h */,
                                26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */,
                                A8A473E0151A825B004123FF /* IntegralTypedArrayBase.h in Headers */,
                                A8A473E1151A825B004123FF /* ListHashSet.h in Headers */,
-                               A8A473E2151A825B004123FF /* ListRefPtr.h in Headers */,
                                A8A473E3151A825B004123FF /* Locker.h in Headers */,
                                A8A473E6151A825B004123FF /* MainThread.h in Headers */,
                                A8A473E7151A825B004123FF /* MallocZoneSupport.h in Headers */,
index da0b3b5..f764e4c 100644 (file)
@@ -43,7 +43,6 @@ set(WTF_HEADERS
     HashTraits.h
     HexNumber.h
     ListHashSet.h
-    ListRefPtr.h
     Locker.h
     MD5.h
     MainThread.h
index ad51614..5333077 100644 (file)
@@ -26,7 +26,6 @@
 namespace WTF {
 
     template<typename T> class Function;
-    template<typename T> class ListRefPtr;
     template<typename T> class OwnArrayPtr;
     template<typename T> class OwnPtr;
     template<typename T> class PassOwnArrayPtr;
@@ -60,7 +59,6 @@ namespace WTF {
 }
 
 using WTF::Function;
-using WTF::ListRefPtr;
 using WTF::OwnArrayPtr;
 using WTF::OwnPtr;
 using WTF::PassOwnArrayPtr;
diff --git a/Source/WTF/wtf/ListRefPtr.h b/Source/WTF/wtf/ListRefPtr.h
deleted file mode 100644 (file)
index 4ba0632..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Copyright (C) 2005, 2006, 2008 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.
- *
- */
-
-#ifndef WTF_ListRefPtr_h
-#define WTF_ListRefPtr_h
-
-#include <wtf/RefPtr.h>
-
-namespace WTF {
-
-    // Specialized version of RefPtr desgined for use in singly-linked lists. 
-    // Derefs the list iteratively to avoid recursive derefing that can overflow the stack.
-    template <typename T> class ListRefPtr : public RefPtr<T> {
-    public:
-        ListRefPtr() : RefPtr<T>() {}
-        ListRefPtr(T* ptr) : RefPtr<T>(ptr) {}
-        ListRefPtr(const RefPtr<T>& o) : RefPtr<T>(o) {}
-        // see comment in PassRefPtr.h for why this takes const reference
-        template <typename U> ListRefPtr(const PassRefPtr<U>& o) : RefPtr<T>(o) {}
-        
-        ~ListRefPtr()
-        {
-            RefPtr<T> reaper = this->release();
-            while (reaper && reaper->hasOneRef())
-                reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
-        }
-        
-        ListRefPtr& operator=(T* optr) { RefPtr<T>::operator=(optr); return *this; }
-        ListRefPtr& operator=(const RefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
-        ListRefPtr& operator=(const PassRefPtr<T>& o) { RefPtr<T>::operator=(o); return *this; }
-        template <typename U> ListRefPtr& operator=(const RefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
-        template <typename U> ListRefPtr& operator=(const PassRefPtr<U>& o) { RefPtr<T>::operator=(o); return *this; }
-    };
-
-    template <typename T> inline T* getPtr(const ListRefPtr<T>& p)
-    {
-        return p.get();
-    }
-
-} // namespace WTF
-
-using WTF::ListRefPtr;
-
-#endif // WTF_ListRefPtr_h
index 4844b7b..0dd3709 100644 (file)
@@ -1,3 +1,26 @@
+2013-05-03  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
+
+        Remove WTF::ListRefPtr class
+        https://bugs.webkit.org/show_bug.cgi?id=115516
+
+        Reviewed by Anders Carlsson.
+
+        ListRefPtr was used only by FontFamily class, besides it strongly depended
+        on FontFamily class semantics which made it non-generic and inappropriate
+        for being present inside WTF.
+
+        This patch removes WTF::ListRefPtr class and moves its the functionality
+        into FontFamily class.
+
+        No new tests, no change in the behavior.
+
+        * page/FrameTree.h:
+        (FrameTree):
+        * platform/graphics/FontFamily.h:
+        (FontFamily):
+        (WebCore::FontFamily::~FontFamily):
+        (WebCore):
+
 2013-05-03  Allan Sandfeld Jensen  <allan.jensen@digia.com>
 
         Crash when calling QWebFrame::evaluateJavaScript
index 4a69b32..5ee7171 100644 (file)
@@ -93,7 +93,6 @@ namespace WebCore {
         AtomicString m_name; // The actual frame name (may be empty).
         AtomicString m_uniqueName;
 
-        // FIXME: use ListRefPtr?
         RefPtr<Frame> m_nextSibling;
         Frame* m_previousSibling;
         RefPtr<Frame> m_firstChild;
index bd867cd..d831d88 100644 (file)
@@ -27,7 +27,7 @@
 #define FontFamily_h
 
 #include <wtf/RefCounted.h>
-#include <wtf/ListRefPtr.h>
+#include <wtf/RefPtr.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
@@ -37,6 +37,7 @@ class SharedFontFamily;
 class FontFamily {
 public:
     FontFamily() { }
+    ~FontFamily();
 
     void setFamily(const AtomicString& family) { m_family = family; }
     const AtomicString& family() const { return m_family; }
@@ -49,7 +50,7 @@ public:
 
 private:
     AtomicString m_family;
-    ListRefPtr<SharedFontFamily> m_next;
+    RefPtr<SharedFontFamily> m_next;
 };
 
 class SharedFontFamily : public FontFamily, public RefCounted<SharedFontFamily> {
@@ -66,6 +67,15 @@ private:
 bool operator==(const FontFamily&, const FontFamily&);
 inline bool operator!=(const FontFamily& a, const FontFamily& b) { return !(a == b); }
 
+inline FontFamily::~FontFamily()
+{
+    // This code came from removed ListRefPtr to avoid possible overflowing the stack.
+    // FIXME: Do we really need it?
+    RefPtr<SharedFontFamily> reaper = m_next.release();
+    while (reaper && reaper->hasOneRef())
+        reaper = reaper->releaseNext(); // implicitly protects reaper->next, then derefs reaper
+}
+
 inline const FontFamily* FontFamily::next() const
 {
     return m_next.get();