Commit 87a467cc authored by andersca@apple.com's avatar andersca@apple.com

ScriptWrappable subclasses shouldn't have to include WeakInlines.h

https://bugs.webkit.org/show_bug.cgi?id=114641

Reviewed by Alexey Proskuryakov.

Source/JavaScriptCore:

Move back the Weak constructor, destructor and clear() to Weak.h. Add a new weakClearSlowCase function
and put it in Weak.cpp.

* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* heap/Weak.cpp: Added.
* heap/Weak.h:
* heap/WeakInlines.h:
* heap/WeakSetInlines.h:

Source/WebCore:

Remove ScriptWrappableInlines.h includes, they're not needed anymore.

* css/WebKitCSSMatrix.cpp:
* dom/ClientRect.cpp:
* dom/ClientRectList.cpp:
* dom/Clipboard.cpp:
* dom/DOMStringMap.cpp:
* dom/Event.cpp:
* dom/MutationRecord.cpp:
* fileapi/FileList.cpp:
* page/BarInfo.cpp:
* plugins/DOMMimeTypeArray.cpp:
* plugins/DOMPlugin.cpp:
* plugins/DOMPluginArray.cpp:
* storage/Storage.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@148479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c65e38e6
......@@ -147,9 +147,10 @@ set(JavaScriptCore_SOURCES
heap/MarkStack.cpp
heap/SlotVisitor.cpp
heap/SuperRegion.cpp
heap/WeakSet.cpp
heap/WeakHandleOwner.cpp
heap/Weak.cpp
heap/WeakBlock.cpp
heap/WeakHandleOwner.cpp
heap/WeakSet.cpp
debugger/Debugger.cpp
debugger/DebuggerActivation.cpp
......
2013-04-15 Anders Carlsson <andersca@apple.com>
ScriptWrappable subclasses shouldn't have to include WeakInlines.h
https://bugs.webkit.org/show_bug.cgi?id=114641
Reviewed by Alexey Proskuryakov.
Move back the Weak constructor, destructor and clear() to Weak.h. Add a new weakClearSlowCase function
and put it in Weak.cpp.
* CMakeLists.txt:
* GNUmakefile.list.am:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:
* Target.pri:
* heap/Weak.cpp: Added.
* heap/Weak.h:
* heap/WeakInlines.h:
* heap/WeakSetInlines.h:
2013-04-15 Mark Hahnenberg <mhahnenberg@apple.com>
HeapTimer lifetime should be less complicated
......@@ -364,6 +364,7 @@ javascriptcore_sources += \
Source/JavaScriptCore/heap/UnconditionalFinalizer.h \
Source/JavaScriptCore/heap/VTableSpectrum.cpp \
Source/JavaScriptCore/heap/VTableSpectrum.h \
Source/JavaScriptCore/heap/Weak.cpp \
Source/JavaScriptCore/heap/Weak.h \
Source/JavaScriptCore/heap/WeakBlock.cpp \
Source/JavaScriptCore/heap/WeakBlock.h \
......
......@@ -2801,6 +2801,10 @@
RelativePath="..\..\heap\VTableSpectrum.h"
>
</File>
<File
RelativePath="..\..\heap\Weak.cpp"
>
</File>
<File
RelativePath="..\..\heap\Weak.h"
>
......
......@@ -213,6 +213,7 @@
<ClCompile Include="..\heap\SlotVisitor.cpp" />
<ClCompile Include="..\heap\SuperRegion.cpp" />
<ClCompile Include="..\heap\VTableSpectrum.cpp" />
<ClCompile Include="..\heap\Weak.cpp" />
<ClCompile Include="..\heap\WeakBlock.cpp" />
<ClCompile Include="..\heap\WeakHandleOwner.cpp" />
<ClCompile Include="..\heap\WeakSet.cpp" />
......
......@@ -261,6 +261,9 @@
<ClCompile Include="..\heap\VTableSpectrum.cpp">
<Filter>heap</Filter>
</ClCompile>
<ClCompile Include="..\heap\Weak.cpp">
<Filter>heap</Filter>
</ClCompile>
<ClCompile Include="..\heap\WeakBlock.cpp">
<Filter>heap</Filter>
</ClCompile>
......
......@@ -506,6 +506,7 @@
14F7256514EE265E00B1652B /* WeakHandleOwner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14F7256314EE265E00B1652B /* WeakHandleOwner.cpp */; };
14F7256614EE265E00B1652B /* WeakHandleOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F7256414EE265E00B1652B /* WeakHandleOwner.h */; settings = {ATTRIBUTES = (Private, ); }; };
14F97447138C853E00DA1C67 /* HeapRootVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F97446138C853E00DA1C67 /* HeapRootVisitor.h */; settings = {ATTRIBUTES = (Private, ); }; };
1ACF7377171CA6FB00C9BB1E /* Weak.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACF7376171CA6FB00C9BB1E /* Weak.cpp */; };
2600B5A6152BAAA70091EE5F /* JSStringJoiner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2600B5A4152BAAA70091EE5F /* JSStringJoiner.cpp */; };
2600B5A7152BAAA70091EE5F /* JSStringJoiner.h in Headers */ = {isa = PBXBuildFile; fileRef = 2600B5A5152BAAA70091EE5F /* JSStringJoiner.h */; };
41359CF30FDD89AD00206180 /* DateConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateConversion.h */; };
......@@ -1373,6 +1374,7 @@
14F7256314EE265E00B1652B /* WeakHandleOwner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakHandleOwner.cpp; sourceTree = "<group>"; };
14F7256414EE265E00B1652B /* WeakHandleOwner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakHandleOwner.h; sourceTree = "<group>"; };
14F97446138C853E00DA1C67 /* HeapRootVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapRootVisitor.h; sourceTree = "<group>"; };
1ACF7376171CA6FB00C9BB1E /* Weak.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Weak.cpp; sourceTree = "<group>"; };
1C9051420BA9E8A70081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1C9051430BA9E8A70081E9D0 /* JavaScriptCore.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = JavaScriptCore.xcconfig; sourceTree = "<group>"; };
1C9051440BA9E8A70081E9D0 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
......@@ -2158,6 +2160,7 @@
0F5F08CE146C762F000472A9 /* UnconditionalFinalizer.h */,
0FC815121405118600CFA603 /* VTableSpectrum.cpp */,
0FC815141405118D00CFA603 /* VTableSpectrum.h */,
1ACF7376171CA6FB00C9BB1E /* Weak.cpp */,
142E3133134FF0A600AFADB5 /* Weak.h */,
14E84F9914EE1ACC00D6D5D4 /* WeakBlock.cpp */,
14E84F9A14EE1ACC00D6D5D4 /* WeakBlock.h */,
......@@ -4067,6 +4070,7 @@
86704B8412DBA33700A9FE7B /* YarrInterpreter.cpp in Sources */,
86704B8612DBA33700A9FE7B /* YarrJIT.cpp in Sources */,
86704B8912DBA33700A9FE7B /* YarrPattern.cpp in Sources */,
1ACF7377171CA6FB00C9BB1E /* Weak.cpp in Sources */,
86704B4212DB8A8100A9FE7B /* YarrSyntaxChecker.cpp in Sources */,
0F98206016BFE38100240D02 /* PreciseJumpTargets.cpp in Sources */,
0FBE0F7216C1DB030082C5E8 /* DFGCPSRethreadingPhase.cpp in Sources */,
......
......@@ -86,9 +86,10 @@ SOURCES += \
heap/CopyVisitor.cpp \
heap/ConservativeRoots.cpp \
heap/DFGCodeBlocks.cpp \
heap/WeakSet.cpp \
heap/WeakHandleOwner.cpp \
heap/Weak.cpp \
heap/WeakBlock.cpp \
heap/WeakHandleOwner.cpp \
heap/WeakSet.cpp \
heap/HandleSet.cpp \
heap/HandleStack.cpp \
heap/BlockAllocator.cpp \
......
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Weak.h"
#include "WeakSetInlines.h"
namespace JSC {
void weakClearSlowCase(WeakImpl*& impl)
{
ASSERT(impl);
WeakSet::deallocate(impl);
impl = 0;
}
} // namespace JSC
......@@ -35,11 +35,22 @@ template<typename T> class PassWeak;
class WeakImpl;
class WeakHandleOwner;
// This is a free function rather than a Weak<T> member function so we can put it in Weak.cpp.
JS_EXPORT_PRIVATE void weakClearSlowCase(WeakImpl*&);
template<typename T> class Weak {
WTF_MAKE_NONCOPYABLE(Weak);
public:
Weak();
explicit Weak(std::nullptr_t);
Weak()
: m_impl(0)
{
}
explicit Weak(std::nullptr_t)
: m_impl(0)
{
}
explicit Weak(T*, WeakHandleOwner* = 0, void* context = 0);
enum HashTableDeletedValueTag { HashTableDeletedValue };
......@@ -48,7 +59,10 @@ public:
template<typename U> Weak(const PassWeak<U>&);
~Weak();
~Weak()
{
clear();
}
void swap(Weak&);
Weak& operator=(const PassWeak<T>&);
......@@ -65,7 +79,12 @@ public:
operator UnspecifiedBoolType*() const;
PassWeak<T> release();
void clear();
void clear()
{
if (!m_impl)
return;
weakClearSlowCase(m_impl);
}
private:
static WeakImpl* hashTableDeletedValue();
......
......@@ -33,16 +33,6 @@
namespace JSC {
template<typename T> inline Weak<T>::Weak()
: m_impl(0)
{
}
template<typename T> inline Weak<T>::Weak(std::nullptr_t)
: m_impl(0)
{
}
template<typename T> inline Weak<T>::Weak(T* cell, WeakHandleOwner* weakOwner, void* context)
: m_impl(cell ? WeakSet::allocate(cell, weakOwner, context) : 0)
{
......@@ -63,11 +53,6 @@ template<typename T> template<typename U> inline Weak<T>::Weak(const PassWeak<U
{
}
template<typename T> inline Weak<T>::~Weak()
{
clear();
}
template<class T> inline void swap(Weak<T>& a, Weak<T>& b)
{
a.swap(b);
......@@ -126,14 +111,6 @@ template<typename T> inline PassWeak<T> Weak<T>::release()
return tmp;
}
template<typename T> inline void Weak<T>::clear()
{
if (!m_impl)
return;
WeakSet::deallocate(m_impl);
m_impl = 0;
}
template<typename T> inline WeakImpl* Weak<T>::hashTableDeletedValue()
{
return reinterpret_cast<WeakImpl*>(-1);
......
......@@ -26,7 +26,7 @@
#ifndef WeakSetInlines_h
#define WeakSetInlines_h
#include "WeakSet.h"
#include "MarkedBlock.h"
namespace JSC {
......
2013-04-15 Anders Carlsson <andersca@apple.com>
ScriptWrappable subclasses shouldn't have to include WeakInlines.h
https://bugs.webkit.org/show_bug.cgi?id=114641
Reviewed by Alexey Proskuryakov.
Remove ScriptWrappableInlines.h includes, they're not needed anymore.
* css/WebKitCSSMatrix.cpp:
* dom/ClientRect.cpp:
* dom/ClientRectList.cpp:
* dom/Clipboard.cpp:
* dom/DOMStringMap.cpp:
* dom/Event.cpp:
* dom/MutationRecord.cpp:
* fileapi/FileList.cpp:
* page/BarInfo.cpp:
* plugins/DOMMimeTypeArray.cpp:
* plugins/DOMPlugin.cpp:
* plugins/DOMPluginArray.cpp:
* storage/Storage.cpp:
2013-04-15 Igor Oliveira <igor.o@sisa.samsung.com>
Call directly RenderBlock::deleteLineBoxTree
......@@ -30,7 +30,6 @@
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "ExceptionCode.h"
#include "ScriptWrappableInlines.h"
#include "StylePropertySet.h"
#include "StyleResolver.h"
#include <wtf/MathExtras.h>
......
......@@ -27,8 +27,6 @@
#include "config.h"
#include "ClientRect.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
ClientRect::ClientRect()
......
......@@ -29,7 +29,6 @@
#include "ExceptionCode.h"
#include "ClientRect.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
......
......@@ -30,7 +30,6 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "Image.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
......
......@@ -26,8 +26,6 @@
#include "config.h"
#include "DOMStringMap.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
DOMStringMap::DOMStringMap()
......
......@@ -26,7 +26,6 @@
#include "EventDispatcher.h"
#include "EventNames.h"
#include "EventTarget.h"
#include "ScriptWrappableInlines.h"
#include "UserGestureIndicator.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/CurrentTime.h>
......
......@@ -35,7 +35,6 @@
#include "Node.h"
#include "NodeList.h"
#include "QualifiedName.h"
#include "ScriptWrappableInlines.h"
#include "StaticNodeList.h"
#include <wtf/Assertions.h>
#include <wtf/StdLibExtras.h>
......
......@@ -27,7 +27,6 @@
#include "FileList.h"
#include "File.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
......
......@@ -32,7 +32,6 @@
#include "Chrome.h"
#include "Frame.h"
#include "Page.h"
#include "ScriptWrappableInlines.h"
namespace WebCore {
......
......@@ -24,7 +24,6 @@
#include "Frame.h"
#include "Page.h"
#include "PluginData.h"
#include "ScriptWrappableInlines.h"
#include <wtf/text/AtomicString.h>
namespace WebCore {
......
......@@ -21,7 +21,6 @@
#include "PluginData.h"
#include "Frame.h"
#include "ScriptWrappableInlines.h"
#include <wtf/text/AtomicString.h>
namespace WebCore {
......
......@@ -24,7 +24,6 @@
#include "Frame.h"
#include "Page.h"
#include "PluginData.h"
#include "ScriptWrappableInlines.h"
#include <wtf/text/AtomicString.h>
namespace WebCore {
......
......@@ -28,7 +28,6 @@
#include "Frame.h"
#include "Page.h"
#include "ScriptWrappableInlines.h"
#include "Settings.h"
#include <wtf/PassRefPtr.h>
#include <wtf/text/WTFString.h>
......
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