source: webkit/trunk/JavaScriptCore/wtf/RefCounted.h@ 34544

Last change on this file since 34544 was 34544, checked in by Darin Adler, 17 years ago

JavaScriptCore:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • kjs/nodes.cpp: (KJS::ParserRefCounted::hasOneRef): Added. Replaces refcount.
  • kjs/nodes.h: Replaced refcount with hasOneRef.
  • wtf/ListRefPtr.h: (WTF::ListRefPtr::~ListRefPtr): Changed to use hasOneRef instead of refcount, so this class can be used with the RefCounted template.
  • wtf/RefCounted.h: (WTF::RefCounted::hasOneRef): Made const, since there's no reason for it to be non-const.

WebCore:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • WebCore.base.exp: Added some new exports needed for functions that are now non-virtual.
  • WebCore.xcodeproj/project.pbxproj: Moved the "icon" group to the correct location in the project. Before it was inside "appcache"!
  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty):
  • dom/Clipboard.cpp: (WebCore::Clipboard::Clipboard):
  • editing/mac/EditorMac.mm: (WebCore::Editor::newGeneralClipboard):
  • editing/qt/EditorQt.cpp: (WebCore::Editor::newGeneralClipboard):
  • editing/wx/EditorWx.cpp: (WebCore::Editor::newGeneralClipboard):
  • loader/DocumentLoader.cpp: (WebCore::DocumentLoader::DocumentLoader):
  • loader/DocumentLoader.h: (WebCore::DocumentLoader::create):
  • loader/icon/IconDatabase.cpp: (WebCore::IconDatabase::defaultIcon): (WebCore::IconDatabase::setIconDataForIconURL): (WebCore::IconDatabase::setIconURLForPageURL): (WebCore::IconDatabase::getOrCreateIconRecord): (WebCore::IconDatabase::performURLImport):
  • loader/icon/IconDatabase.h:
  • loader/icon/IconRecord.cpp: (WebCore::IconRecord::IconRecord):
  • loader/icon/IconRecord.h: (WebCore::IconRecord::create):
  • page/EventHandler.h:
  • page/Frame.cpp: (WebCore::Frame::Frame):
  • page/Frame.h: (WebCore::Frame::create):
  • page/gtk/EventHandlerGtk.cpp: (WebCore::EventHandler::createDraggingClipboard):
  • page/mac/EventHandlerMac.mm: (WebCore::EventHandler::createDraggingClipboard):
  • page/qt/EventHandlerQt.cpp: (WebCore::EventHandler::createDraggingClipboard):
  • page/win/EventHandlerWin.cpp: (WebCore::EventHandler::createDraggingClipboard):
  • page/wx/EventHandlerWx.cpp: (WebCore::EventHandler::createDraggingClipboard):
  • platform/Cursor.h: (WebCore::SharedCursor::create): (WebCore::SharedCursor::~SharedCursor): (WebCore::SharedCursor::SharedCursor):
  • platform/DragData.h:
  • platform/PopupMenu.h: (WebCore::PopupMenu::create): (WebCore::PopupMenu::isActive):
  • platform/ScrollBar.cpp: (WebCore::Scrollbar::Scrollbar):
  • platform/SearchPopupMenu.h: (WebCore::SearchPopupMenu::create):
  • platform/graphics/FontFamily.cpp: (WebCore::FontFamily::FontFamily): (WebCore::operator==):
  • platform/graphics/FontFamily.h: (WebCore::FontFamily::FontFamily): (WebCore::SharedFontFamily::create): (WebCore::SharedFontFamily::SharedFontFamily): (WebCore::operator!=): (WebCore::FontFamily::next): (WebCore::FontFamily::appendFamily): (WebCore::FontFamily::releaseNext):
  • platform/graphics/Icon.h:
  • platform/graphics/gtk/IconGtk.cpp: (WebCore::Icon::Icon): (WebCore::Icon::~Icon): (WebCore::Icon::newIconForFile):
  • platform/graphics/mac/IconMac.mm: (WebCore::Icon::Icon): (WebCore::Icon::newIconForFile):
  • platform/graphics/qt/IconQt.cpp: (WebCore::Icon::Icon): (WebCore::Icon::newIconForFile):
  • platform/graphics/win/IconWin.cpp: (WebCore::Icon::Icon): (WebCore::Icon::~Icon): (WebCore::Icon::newIconForFile):
  • platform/gtk/ClipboardGtk.cpp: (WebCore::Editor::newGeneralClipboard):
  • platform/gtk/ClipboardGtk.h: (WebCore::ClipboardGtk::create):
  • platform/gtk/PlatformScrollBar.h: (WebCore::PlatformScrollbar::create):
  • platform/gtk/PopupMenuGtk.cpp: (WebCore::PopupMenu::PopupMenu):
  • platform/gtk/ScrollViewGtk.cpp: (WebCore::ScrollViewScrollbar::create): (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar): (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
  • platform/mac/ClipboardMac.h: (WebCore::ClipboardMac::create):
  • platform/mac/DragDataMac.mm: (WebCore::DragData::createClipboard): (WebCore::DragData::containsCompatibleContent):
  • platform/mac/PlatformScrollBar.h: (WebCore::PlatformScrollbar::create): (WebCore::PlatformScrollbar::horizontalScrollbarHeight): (WebCore::PlatformScrollbar::verticalScrollbarWidth):
  • platform/mac/PopupMenuMac.mm: (WebCore::PopupMenu::PopupMenu):
  • platform/qt/ClipboardQt.h: (WebCore::ClipboardQt::create):
  • platform/qt/DragDataQt.cpp: (WebCore::DragData::createClipboard):
  • platform/qt/PlatformScrollBar.h: (WebCore::PlatformScrollbar::create):
  • platform/qt/PopupMenuQt.cpp: (WebCore::PopupMenu::PopupMenu):
  • platform/qt/ScrollViewQt.cpp: (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar): (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
  • platform/win/ClipboardWin.h: (WebCore::ClipboardWin::create):
  • platform/win/CursorWin.cpp: (WebCore::Cursor::Cursor): (WebCore::loadSharedCursor):
  • platform/win/DragDataWin.cpp: (WebCore::DragData::createClipboard):
  • platform/win/EditorWin.cpp: (WebCore::Editor::newGeneralClipboard):
  • platform/win/PlatformScrollBar.h: (WebCore::PlatformScrollbar::create):
  • platform/win/PopupMenuWin.cpp: (WebCore::PopupMenu::PopupMenu): (WebCore::PopupMenu::show):
  • platform/win/ScrollViewWin.cpp: (WebCore::ScrollView::ScrollViewPrivate::setHasHorizontalScrollbar): (WebCore::ScrollView::ScrollViewPrivate::setHasVerticalScrollbar):
  • platform/wx/ClipboardWx.h: (WebCore::ClipboardWx::create):
  • platform/wx/PlatformScrollBar.h: (WebCore::PlatformScrollbar::create):
  • platform/wx/PopupMenuWx.cpp: (WebCore::PopupMenu::PopupMenu):
  • platform/wx/TemporaryLinkStubs.cpp: (Icon::Icon): (Icon::newIconForFile):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::createScrollbar):
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::updateFromElement):
  • svg/graphics/SVGImage.cpp: (WebCore::SVGImage::dataChanged):
  • svg/graphics/SVGImageEmptyClients.h: (WebCore::SVGEmptyFrameLoaderClient::createDocumentLoader):

WebKit/gtk:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::FrameLoaderClient::createDocumentLoader): Use create instead of new.
  • webkit/webkitwebframe.cpp: (webkit_web_frame_new): Ditto. (webkit_web_frame_init_with_web_view): Ditto.

WebKit/mac:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::createDocumentLoader): Use create instead of new. (WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by a ref call inside the Frame constructor. The lifetime rules for Frame are now the conventional ones without a special case.
  • WebView/WebDataSource.mm: (-[WebDataSource _initWithDocumentLoader:]): Changed argument to be a PassRefPtr, since this function takes ownership of the DocumentLoader. (-[WebDataSource initWithRequest:]): Use create instead of new.
  • WebView/WebDataSourceInternal.h: Changed _initWithDocumentLoader argument to be a PassRefPtr and also cleaned up the header a bit.
  • WebView/WebDocumentLoaderMac.h: (WebDocumentLoaderMac::create): Added. Also made the constructor and a couple of virtual functions private.
  • WebView/WebFrame.mm: (+[WebFrame _createFrameWithPage:frameName:frameView:ownerElement:]): Use create instead of new.

WebKit/qt:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • Api/qwebframe.cpp: (QWebFramePrivate::init): Use create instead of new.
  • WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::FrameLoaderClientQt::createDocumentLoader): Ditto.

WebKit/win:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • WebCoreSupport/WebFrameLoaderClient.cpp: (WebFrameLoaderClient::createFrame): Remove now-obsolete adoptRef that was balanced by a ref call inside the Frame constructor. The lifetime rules for Frame are now the conventional ones without a special case.
  • WebFrame.cpp: (WebFrame::init): Renamed function from initWithWebFrameView and removed the unused IWebFrameView argument (every caller was passing 0). Also changed this to return the WebCore Frame object, which is needed to straighten out the lifetime and ownership issues.
  • WebFrame.h: Ditto.
  • WebView.cpp: (WebView::initWithFrame): Changed to call new init function and use the return value.

WebKit/wx:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Sam.

  • WebKitSupport/FrameLoaderClientWx.cpp: (WebCore::FrameLoaderClientWx::createDocumentLoader): Use create function instead of new.

LayoutTests:

2008-06-14 Darin Adler <Darin Adler>

Reviewed by Maciej.

  • fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
  • fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
  • fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.
  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1/*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 *
19 */
20
21#ifndef RefCounted_h
22#define RefCounted_h
23
24#include <wtf/Assertions.h>
25#include <wtf/Noncopyable.h>
26
27namespace WTF {
28
29template<class T> class RefCounted : Noncopyable {
30public:
31 RefCounted(int initialRefCount = 1)
32 : m_refCount(initialRefCount)
33#ifndef NDEBUG
34 , m_deletionHasBegun(false)
35#endif
36 {
37 }
38
39 void ref()
40 {
41 ASSERT(!m_deletionHasBegun);
42 ++m_refCount;
43 }
44
45 void deref()
46 {
47 ASSERT(!m_deletionHasBegun);
48 ASSERT(m_refCount > 0);
49 if (m_refCount == 1) {
50#ifndef NDEBUG
51 m_deletionHasBegun = true;
52#endif
53 delete static_cast<T*>(this);
54 } else
55 --m_refCount;
56 }
57
58 bool hasOneRef() const
59 {
60 ASSERT(!m_deletionHasBegun);
61 return m_refCount == 1;
62 }
63
64 int refCount() const
65 {
66 return m_refCount;
67 }
68
69private:
70 int m_refCount;
71#ifndef NDEBUG
72 bool m_deletionHasBegun;
73#endif
74};
75
76} // namespace WTF
77
78using WTF::RefCounted;
79
80#endif // RefCounted_h
Note: See TracBrowser for help on using the repository browser.