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:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194324
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-12-20 Gyuyoung Kim <gyuyoung.kim@webkit.org>
+
+ 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-20 Michael Catanzaro <mcatanzaro@igalia.com>
[SOUP] Performs DNS prefetch when a proxy is configured (information leak)
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)
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);
}
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);
#include <wtf/NeverDestroyed.h>
#include <wtf/Noncopyable.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
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()
namespace WebCore {
-NodeIteratorBase::NodeIteratorBase(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& nodeFilter)
- : m_root(rootNode)
+NodeIteratorBase::NodeIteratorBase(Node& rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& nodeFilter)
+ : m_root(&rootNode)
, m_whatToShow(whatToShow)
, m_filter(WTF::move(nodeFilter))
{
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:
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;
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();
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();
#define UserActionElementSet_h
#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
namespace WebCore {
-WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName)
+WebKitNamedFlow::WebKitNamedFlow(NamedFlowCollection& manager, const AtomicString& flowThreadName)
: m_flowThreadName(flowThreadName)
- , m_flowManager(manager)
+ , m_flowManager(&manager)
, m_parentFlowThread(nullptr)
{
}
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));
}
return -1;
}
-PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
+Ref<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
{
if (!contentNode)
return StaticElementList::createEmpty();
return StaticElementList::adopt(regionElements);
}
-PassRefPtr<NodeList> WebKitNamedFlow::getRegions()
+Ref<NodeList> WebKitNamedFlow::getRegions()
{
if (m_flowManager->document())
m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
return StaticElementList::adopt(regionElements);
}
-PassRefPtr<NodeList> WebKitNamedFlow::getContent()
+Ref<NodeList> WebKitNamedFlow::getContent()
{
if (m_flowManager->document())
m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
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;
void dispatchRegionOversetChangeEvent();
private:
- WebKitNamedFlow(PassRefPtr<NamedFlowCollection>, const AtomicString&);
+ WebKitNamedFlow(NamedFlowCollection&, const AtomicString&);
// EventTarget implementation.
virtual void refEventTarget() override { ref(); }
{
}
-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
{
}
-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;
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);
}
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);
private:
WheelEvent();
WheelEvent(const AtomicString&, const WheelEventInit&);
- WheelEvent(const PlatformWheelEvent&, PassRefPtr<AbstractView>);
+ WheelEvent(const PlatformWheelEvent&, AbstractView*);
virtual bool isWheelEvent() const override;