Commit fde404a2 authored by mikhail.pozdnyakov@intel.com's avatar mikhail.pozdnyakov@intel.com
Browse files

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.

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: http://svn.webkit.org/repository/webkit/trunk@149523 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d54a5762
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.
......
......@@ -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 \
......
......@@ -84,7 +84,6 @@ HEADERS += \
Int32Array.h \
Int8Array.h \
ListHashSet.h \
ListRefPtr.h \
Locker.h \
MainThread.h \
MallocZoneSupport.h \
......
......@@ -894,10 +894,6 @@
RelativePath="..\wtf\ListHashSet.h"
>
</File>
<File
RelativePath="..\wtf\ListRefPtr.h"
>
</File>
<File
RelativePath="..\wtf\Locker.h"
>
......
......@@ -160,7 +160,6 @@
<ClInclude Include="..\wtf\Int32Array.h" />
<ClInclude Include="..\wtf\Int8Array.h" />
<ClInclude Include="..\wtf\ListHashSet.h" />
<ClInclude Include="..\wtf\ListRefPtr.h" />
<ClInclude Include="..\wtf\Locker.h" />
<ClInclude Include="..\wtf\MainThread.h" />
<ClInclude Include="..\wtf\MallocZoneSupport.h" />
......
......@@ -483,9 +483,6 @@
<ClInclude Include="..\wtf\ListHashSet.h">
<Filter>wtf</Filter>
</ClInclude>
<ClInclude Include="..\wtf\ListRefPtr.h">
<Filter>wtf</Filter>
</ClInclude>
<ClInclude Include="..\wtf\Locker.h">
<Filter>wtf</Filter>
</ClInclude>
......
......@@ -139,7 +139,6 @@
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 */; };
......@@ -415,7 +414,6 @@
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>"; };
......@@ -690,7 +688,6 @@
A8A472BD151A825A004123FF /* Int8Array.h */,
A8A472C0151A825A004123FF /* IntegralTypedArrayBase.h */,
A8A472C1151A825A004123FF /* ListHashSet.h */,
A8A472C2151A825A004123FF /* ListRefPtr.h */,
A8A472C3151A825A004123FF /* Locker.h */,
A8A472C6151A825A004123FF /* MainThread.cpp */,
A8A472C7151A825B004123FF /* MainThread.h */,
......@@ -1004,7 +1001,6 @@
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 */,
......
......@@ -43,7 +43,6 @@ set(WTF_HEADERS
HashTraits.h
HexNumber.h
ListHashSet.h
ListRefPtr.h
Locker.h
MD5.h
MainThread.h
......
......@@ -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;
......
/*
* 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
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
......
......@@ -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;
......
......@@ -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();
......
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