Diff
Modified: trunk/Source/WebCore/ChangeLog (194200 => 194201)
--- trunk/Source/WebCore/ChangeLog 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/ChangeLog 2015-12-17 02:13:00 UTC (rev 194201)
@@ -1,3 +1,39 @@
+2015-12-16 Gyuyoung Kim <[email protected]>
+
+ Reduce PassRefPtr uses in dom - 2
+ https://bugs.webkit.org/show_bug.cgi?id=151936
+
+ Reviewed by Darin Adler.
+
+ Change PassRefPtr with RefPtr<Foo>&&, WTF::move(), Foo*, and Foo&.
+
+ * dom/ScopedEventQueue.h:
+ * dom/ScriptedAnimationController.cpp:
+ (WebCore::ScriptedAnimationController::registerCallback):
+ * dom/ScriptedAnimationController.h:
+ * dom/StaticNodeList.h:
+ * dom/Traversal.cpp:
+ (WebCore::NodeIteratorBase::NodeIteratorBase):
+ * dom/Traversal.h:
+ * dom/TreeWalker.cpp:
+ (WebCore::TreeWalker::TreeWalker):
+ (WebCore::TreeWalker::setCurrentNode):
+ * dom/TreeWalker.h:
+ (WebCore::TreeWalker::create):
+ * dom/UserActionElementSet.h:
+ * dom/WebKitNamedFlow.cpp:
+ (WebCore::WebKitNamedFlow::WebKitNamedFlow):
+ (WebCore::WebKitNamedFlow::create):
+ (WebCore::WebKitNamedFlow::getRegionsByContent):
+ (WebCore::WebKitNamedFlow::getRegions):
+ (WebCore::WebKitNamedFlow::getContent):
+ * dom/WebKitNamedFlow.h:
+ * dom/WheelEvent.cpp:
+ (WebCore::WheelEvent::WheelEvent):
+ (WebCore::WheelEvent::initWheelEvent):
+ (WebCore::WheelEvent::initWebKitWheelEvent):
+ * dom/WheelEvent.h:
+
2015-12-16 Simon Fraser <[email protected]>
Simplify isOverlayScrollbar() logic
Modified: trunk/Source/WebCore/dom/Document.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/Document.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/Document.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -1748,7 +1748,7 @@
ec = TypeError;
return nullptr;
}
- return TreeWalker::create(root, whatToShow, WTF::move(filter));
+ return TreeWalker::create(*root, whatToShow, WTF::move(filter));
}
RefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned long whatToShow, ExceptionCode& ec)
Modified: trunk/Source/WebCore/dom/NamedFlowCollection.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/NamedFlowCollection.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/NamedFlowCollection.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -76,7 +76,7 @@
return *namedFlow;
}
- RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName);
+ RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(*this, flowName);
m_namedFlows.add(newFlow.get());
InspectorInstrumentation::didCreateNamedFlow(document(), *newFlow);
Modified: trunk/Source/WebCore/dom/NodeIterator.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/NodeIterator.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/NodeIterator.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -77,7 +77,7 @@
}
NodeIterator::NodeIterator(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
- : NodeIteratorBase(rootNode, whatToShow, WTF::move(filter))
+ : NodeIteratorBase(*rootNode, whatToShow, WTF::move(filter))
, m_referenceNode(root(), true)
{
root()->document().attachNodeIterator(this);
Modified: trunk/Source/WebCore/dom/ScopedEventQueue.h (194200 => 194201)
--- trunk/Source/WebCore/dom/ScopedEventQueue.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/ScopedEventQueue.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -33,7 +33,6 @@
#include <wtf/NeverDestroyed.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
Modified: trunk/Source/WebCore/dom/StaticNodeList.h (194200 => 194201)
--- trunk/Source/WebCore/dom/StaticNodeList.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/StaticNodeList.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -62,11 +62,11 @@
class StaticElementList final : public NodeList {
public:
- static PassRefPtr<StaticElementList> adopt(Vector<Ref<Element>>& elements)
+ static Ref<StaticElementList> adopt(Vector<Ref<Element>>& elements)
{
- RefPtr<StaticElementList> nodeList = adoptRef(new StaticElementList);
+ Ref<StaticElementList> nodeList = adoptRef(*new StaticElementList);
nodeList->m_elements.swap(elements);
- return nodeList.release();
+ return nodeList;
}
static Ref<StaticElementList> createEmpty()
Modified: trunk/Source/WebCore/dom/Traversal.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/Traversal.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/Traversal.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -30,7 +30,7 @@
namespace WebCore {
-NodeIteratorBase::NodeIteratorBase(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& nodeFilter)
+NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& nodeFilter)
: m_root(rootNode)
, m_whatToShow(whatToShow)
, m_filter(WTF::move(nodeFilter))
Modified: trunk/Source/WebCore/dom/Traversal.h (194200 => 194201)
--- trunk/Source/WebCore/dom/Traversal.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/Traversal.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -35,17 +35,17 @@
class NodeIteratorBase {
public:
- Node* root() const { return m_root.get(); }
+ Node* root() const { return &m_root; }
unsigned long whatToShow() const { return m_whatToShow; }
NodeFilter* filter() const { return m_filter.get(); }
bool expandEntityReferences() const { return false; }
protected:
- NodeIteratorBase(PassRefPtr<Node>, unsigned long whatToShow, RefPtr<NodeFilter>&&);
+ NodeIteratorBase(Node&, unsigned long whatToShow, RefPtr<NodeFilter>&&);
short acceptNode(Node*) const;
private:
- RefPtr<Node> m_root;
+ Node& m_root;
unsigned long m_whatToShow;
RefPtr<NodeFilter> m_filter;
};
Modified: trunk/Source/WebCore/dom/TreeWalker.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/TreeWalker.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/TreeWalker.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -33,13 +33,13 @@
namespace WebCore {
-TreeWalker::TreeWalker(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
+TreeWalker::TreeWalker(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
: NodeIteratorBase(rootNode, whatToShow, WTF::move(filter))
, m_current(root())
{
}
-void TreeWalker::setCurrentNode(PassRefPtr<Node> node, ExceptionCode& ec)
+void TreeWalker::setCurrentNode(Node* node, ExceptionCode& ec)
{
if (!node) {
ec = NOT_SUPPORTED_ERR;
Modified: trunk/Source/WebCore/dom/TreeWalker.h (194200 => 194201)
--- trunk/Source/WebCore/dom/TreeWalker.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/TreeWalker.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -37,13 +37,13 @@
class TreeWalker : public ScriptWrappable, public RefCounted<TreeWalker>, public NodeIteratorBase {
public:
- static Ref<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
+ static Ref<TreeWalker> create(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
{
return adoptRef(*new TreeWalker(rootNode, whatToShow, WTF::move(filter)));
}
Node* currentNode() const { return m_current.get(); }
- void setCurrentNode(PassRefPtr<Node>, ExceptionCode&);
+ void setCurrentNode(Node*, ExceptionCode&);
Node* parentNode();
Node* firstChild();
@@ -54,7 +54,7 @@
Node* nextNode();
private:
- TreeWalker(PassRefPtr<Node>, unsigned long whatToShow, RefPtr<NodeFilter>&&);
+ TreeWalker(Node&, unsigned long whatToShow, RefPtr<NodeFilter>&&);
enum class SiblingTraversalType { Previous, Next };
template<SiblingTraversalType> Node* traverseSiblings();
Modified: trunk/Source/WebCore/dom/UserActionElementSet.h (194200 => 194201)
--- trunk/Source/WebCore/dom/UserActionElementSet.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/UserActionElementSet.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -29,7 +29,6 @@
#define UserActionElementSet_h
#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
Modified: trunk/Source/WebCore/dom/WebKitNamedFlow.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/WebKitNamedFlow.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/WebKitNamedFlow.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -39,7 +39,7 @@
namespace WebCore {
-WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName)
+WebKitNamedFlow::WebKitNamedFlow(NamedFlowCollection& manager, const AtomicString& flowThreadName)
: m_flowThreadName(flowThreadName)
, m_flowManager(manager)
, m_parentFlowThread(nullptr)
@@ -49,10 +49,10 @@
WebKitNamedFlow::~WebKitNamedFlow()
{
// The named flow is not "strong" referenced from anywhere at this time so it shouldn't be reused if the named flow is recreated.
- m_flowManager->discardNamedFlow(this);
+ m_flowManager.discardNamedFlow(this);
}
-Ref<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName)
+Ref<WebKitNamedFlow> WebKitNamedFlow::create(NamedFlowCollection& manager, const AtomicString& flowThreadName)
{
return adoptRef(*new WebKitNamedFlow(manager, flowThreadName));
}
@@ -64,8 +64,8 @@
bool WebKitNamedFlow::overset() const
{
- if (m_flowManager->document())
- m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+ if (m_flowManager.document())
+ m_flowManager.document()->updateLayoutIgnorePendingStylesheets();
// The renderer may be destroyed or created after the style update.
// Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
@@ -92,8 +92,8 @@
int WebKitNamedFlow::firstEmptyRegionIndex() const
{
- if (m_flowManager->document())
- m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+ if (m_flowManager.document())
+ m_flowManager.document()->updateLayoutIgnorePendingStylesheets();
if (!m_parentFlowThread)
return -1;
@@ -117,13 +117,13 @@
return -1;
}
-PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
+Ref<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
{
if (!contentNode)
return StaticElementList::createEmpty();
- if (m_flowManager->document())
- m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+ if (m_flowManager.document())
+ m_flowManager.document()->updateLayoutIgnorePendingStylesheets();
// The renderer may be destroyed or created after the style update.
// Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
@@ -151,10 +151,10 @@
return StaticElementList::adopt(regionElements);
}
-PassRefPtr<NodeList> WebKitNamedFlow::getRegions()
+Ref<NodeList> WebKitNamedFlow::getRegions()
{
- if (m_flowManager->document())
- m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+ if (m_flowManager.document())
+ m_flowManager.document()->updateLayoutIgnorePendingStylesheets();
// The renderer may be destroyed or created after the style update.
// Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
@@ -178,10 +178,10 @@
return StaticElementList::adopt(regionElements);
}
-PassRefPtr<NodeList> WebKitNamedFlow::getContent()
+Ref<NodeList> WebKitNamedFlow::getContent()
{
- if (m_flowManager->document())
- m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+ if (m_flowManager.document())
+ m_flowManager.document()->updateLayoutIgnorePendingStylesheets();
// The renderer may be destroyed or created after the style update.
// Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
@@ -216,17 +216,17 @@
if (flowState() == FlowStateNull)
return;
- dispatchEvent(UIEvent::create(eventNames().webkitregionoversetchangeEvent, false, false, m_flowManager->document()->defaultView(), 0));
+ dispatchEvent(UIEvent::create(eventNames().webkitregionoversetchangeEvent, false, false, m_flowManager.document()->defaultView(), 0));
}
ScriptExecutionContext* WebKitNamedFlow::scriptExecutionContext() const
{
- return m_flowManager->document();
+ return m_flowManager.document();
}
Node* WebKitNamedFlow::ownerNode() const
{
- return m_flowManager->document();
+ return m_flowManager.document();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/dom/WebKitNamedFlow.h (194200 => 194201)
--- trunk/Source/WebCore/dom/WebKitNamedFlow.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/WebKitNamedFlow.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -48,16 +48,16 @@
class WebKitNamedFlow final : public RefCounted<WebKitNamedFlow>, public EventTargetWithInlineData {
public:
- static Ref<WebKitNamedFlow> create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName);
+ static Ref<WebKitNamedFlow> create(NamedFlowCollection& manager, const AtomicString& flowThreadName);
~WebKitNamedFlow();
const AtomicString& name() const;
bool overset() const;
int firstEmptyRegionIndex() const;
- PassRefPtr<NodeList> getRegionsByContent(Node*);
- PassRefPtr<NodeList> getRegions();
- PassRefPtr<NodeList> getContent();
+ Ref<NodeList> getRegionsByContent(Node*);
+ Ref<NodeList> getRegions();
+ Ref<NodeList> getContent();
using RefCounted<WebKitNamedFlow>::ref;
using RefCounted<WebKitNamedFlow>::deref;
@@ -81,7 +81,7 @@
void dispatchRegionOversetChangeEvent();
private:
- WebKitNamedFlow(PassRefPtr<NamedFlowCollection>, const AtomicString&);
+ WebKitNamedFlow(NamedFlowCollection&, const AtomicString&);
// EventTarget implementation.
virtual void refEventTarget() override { ref(); }
@@ -90,7 +90,7 @@
// The name of the flow thread as specified in CSS.
AtomicString m_flowThreadName;
- RefPtr<NamedFlowCollection> m_flowManager;
+ NamedFlowCollection& m_flowManager;
RenderNamedFlowThread* m_parentFlowThread;
};
Modified: trunk/Source/WebCore/dom/WheelEvent.cpp (194200 => 194201)
--- trunk/Source/WebCore/dom/WheelEvent.cpp 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/WheelEvent.cpp 2015-12-17 02:13:00 UTC (rev 194201)
@@ -65,7 +65,7 @@
{
}
-WheelEvent::WheelEvent(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
+WheelEvent::WheelEvent(const PlatformWheelEvent& event, AbstractView* view)
: MouseEvent(eventNames().wheelEvent, true, true, event.timestamp(), view, 0, event.globalPosition().x(), event.globalPosition().y(), event.position().x(), event.position().y()
#if ENABLE(POINTER_LOCK)
, 0, 0
@@ -81,7 +81,7 @@
{
}
-void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+void WheelEvent::initWheelEvent(int rawDeltaX, int rawDeltaY, AbstractView* view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
@@ -104,7 +104,7 @@
initCoordinates(IntPoint(pageX, pageY));
}
-void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+void WheelEvent::initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, AbstractView* view, int screenX, int screenY, int pageX, int pageY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
initWheelEvent(rawDeltaX, rawDeltaY, view, screenX, screenY, pageX, pageY, ctrlKey, altKey, shiftKey, metaKey);
}
Modified: trunk/Source/WebCore/dom/WheelEvent.h (194200 => 194201)
--- trunk/Source/WebCore/dom/WheelEvent.h 2015-12-17 01:50:26 UTC (rev 194200)
+++ trunk/Source/WebCore/dom/WheelEvent.h 2015-12-17 02:13:00 UTC (rev 194201)
@@ -64,16 +64,16 @@
return adoptRef(*new WheelEvent(type, initializer));
}
- static Ref<WheelEvent> create(const PlatformWheelEvent& event, PassRefPtr<AbstractView> view)
+ static Ref<WheelEvent> create(const PlatformWheelEvent& event, AbstractView* view)
{
return adoptRef(*new WheelEvent(event, view));
}
- void initWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
+ void initWheelEvent(int rawDeltaX, int rawDeltaY, AbstractView*,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
- void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, PassRefPtr<AbstractView>,
+ void initWebKitWheelEvent(int rawDeltaX, int rawDeltaY, AbstractView*,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
@@ -100,7 +100,7 @@
private:
WheelEvent();
WheelEvent(const AtomicString&, const WheelEventInit&);
- WheelEvent(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
+ WheelEvent(const PlatformWheelEvent&, AbstractView*);
virtual bool isWheelEvent() const override;