Changeset 195524 in webkit


Ignore:
Timestamp:
Jan 24, 2016, 10:13:09 PM (10 years ago)
Author:
Gyuyoung Kim
Message:

Reduce PassRefPtr uses in dom - 4
https://bugs.webkit.org/show_bug.cgi?id=153270

Reviewed by Darin Adler.

As a step to remove PassRefPtr uses, this patch reduces the uses in WebCore/dom.

Source/WebCore:

  • bindings/js/JSDeviceMotionEventCustom.cpp:

(WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):

  • dom/DeviceMotionData.cpp:

(WebCore::DeviceMotionData::create):
(WebCore::DeviceMotionData::DeviceMotionData):

  • dom/DeviceMotionData.h:
  • dom/Document.cpp:

(WebCore::Document::setBodyOrFrameset):
(WebCore::Document::setFocusedElement):
(WebCore::Document::setDecoder):
(WebCore::Document::pushCurrentScript):

  • dom/Document.h:
  • dom/Event.cpp:

(WebCore::Event::cloneFor):

  • dom/Event.h:
  • dom/MouseEvent.cpp:

(WebCore::MouseEvent::cloneFor):

  • dom/MouseEvent.h:
  • dom/NodeIterator.cpp:

(WebCore::NodeIterator::NodePointer::NodePointer):
(WebCore::NodeIterator::NodeIterator):

  • dom/NodeIterator.h:

(WebCore::NodeIterator::create):

  • html/RadioInputType.cpp:

(WebCore::RadioInputType::handleKeydownEvent):

  • platform/ios/DeviceMotionClientIOS.mm:

(WebCore::DeviceMotionClientIOS::motionChanged):

  • xml/XSLTProcessor.cpp:

(WebCore::XSLTProcessor::createDocumentFromSource):

Source/WebKit/win:

  • Plugins/PluginView.cpp:

(WebCore::PluginView::focusPluginElement):

Source/WebKit2:

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::focusPluginElement):

Location:
trunk/Source
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r195523 r195524  
     12016-01-24  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
     2
     3        Reduce PassRefPtr uses in dom - 4
     4        https://bugs.webkit.org/show_bug.cgi?id=153270
     5
     6        Reviewed by Darin Adler.
     7
     8        As a step to remove PassRefPtr uses, this patch reduces the uses in WebCore/dom.
     9
     10        * bindings/js/JSDeviceMotionEventCustom.cpp:
     11        (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
     12        * dom/DeviceMotionData.cpp:
     13        (WebCore::DeviceMotionData::create):
     14        (WebCore::DeviceMotionData::DeviceMotionData):
     15        * dom/DeviceMotionData.h:
     16        * dom/Document.cpp:
     17        (WebCore::Document::setBodyOrFrameset):
     18        (WebCore::Document::setFocusedElement):
     19        (WebCore::Document::setDecoder):
     20        (WebCore::Document::pushCurrentScript):
     21        * dom/Document.h:
     22        * dom/Event.cpp:
     23        (WebCore::Event::cloneFor):
     24        * dom/Event.h:
     25        * dom/MouseEvent.cpp:
     26        (WebCore::MouseEvent::cloneFor):
     27        * dom/MouseEvent.h:
     28        * dom/NodeIterator.cpp:
     29        (WebCore::NodeIterator::NodePointer::NodePointer):
     30        (WebCore::NodeIterator::NodeIterator):
     31        * dom/NodeIterator.h:
     32        (WebCore::NodeIterator::create):
     33        * html/RadioInputType.cpp:
     34        (WebCore::RadioInputType::handleKeydownEvent):
     35        * platform/ios/DeviceMotionClientIOS.mm:
     36        (WebCore::DeviceMotionClientIOS::motionChanged):
     37        * xml/XSLTProcessor.cpp:
     38        (WebCore::XSLTProcessor::createDocumentFromSource):
     39
    1402016-01-24  Myles C. Maxfield  <mmaxfield@apple.com>
    241
  • trunk/Source/WebCore/bindings/js/JSDeviceMotionEventCustom.cpp

    r191887 r195524  
    189189    bool intervalProvided = !state.argument(6).isUndefinedOrNull();
    190190    double interval = state.argument(6).toNumber(&state);
    191     RefPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, intervalProvided, interval);
    192     wrapped().initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get());
     191    auto deviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), intervalProvided, interval);
     192    wrapped().initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.ptr());
    193193    return jsUndefined();
    194194}
  • trunk/Source/WebCore/dom/DeviceMotionData.cpp

    r180441 r195524  
    6969}
    7070
    71 Ref<DeviceMotionData> DeviceMotionData::create(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity,
    72                                                PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval)
     71Ref<DeviceMotionData> DeviceMotionData::create(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
    7372{
    74     return adoptRef(*new DeviceMotionData(acceleration, accelerationIncludingGravity, rotationRate, canProvideInterval, interval));
     73    return adoptRef(*new DeviceMotionData(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), canProvideInterval, interval));
    7574}
    7675
     
    8180}
    8281
    83 DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity,
    84                                    PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval)
    85     : m_acceleration(acceleration)
    86     , m_accelerationIncludingGravity(accelerationIncludingGravity)
    87     , m_rotationRate(rotationRate)
     82DeviceMotionData::DeviceMotionData(RefPtr<Acceleration>&& acceleration, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&& rotationRate, bool canProvideInterval, double interval)
     83    : m_acceleration(WTFMove(acceleration))
     84    , m_accelerationIncludingGravity(WTFMove(accelerationIncludingGravity))
     85    , m_rotationRate(WTFMove(rotationRate))
    8886    , m_canProvideInterval(canProvideInterval)
    8987    , m_interval(interval)
  • trunk/Source/WebCore/dom/DeviceMotionData.h

    r180441 r195524  
    2727#define DeviceMotionData_h
    2828
    29 #include <wtf/PassRefPtr.h>
    3029#include <wtf/RefCounted.h>
    3130#include <wtf/RefPtr.h>
     
    8483
    8584    WEBCORE_EXPORT static Ref<DeviceMotionData> create();
    86     WEBCORE_EXPORT static Ref<DeviceMotionData> create(PassRefPtr<Acceleration>, PassRefPtr<Acceleration> accelerationIncludingGravity,
    87                                         PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval);
     85    WEBCORE_EXPORT static Ref<DeviceMotionData> create(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
    8886
    8987    const Acceleration* acceleration() const { return m_acceleration.get(); }
     
    9593private:
    9694    DeviceMotionData();
    97     DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Acceleration> accelerationIncludingGravity,
    98                      PassRefPtr<RotationRate> rotationRate, bool canProvideInterval, double interval);
     95    DeviceMotionData(RefPtr<Acceleration>&&, RefPtr<Acceleration>&& accelerationIncludingGravity, RefPtr<RotationRate>&&, bool canProvideInterval, double interval);
    9996
    10097    RefPtr<Acceleration> m_acceleration;
  • trunk/Source/WebCore/dom/Document.cpp

    r195520 r195524  
    25872587}
    25882588
    2589 void Document::setBodyOrFrameset(PassRefPtr<HTMLElement> prpNewBody, ExceptionCode& ec)
    2590 {
    2591     RefPtr<HTMLElement> newBody = prpNewBody;
    2592 
     2589void Document::setBodyOrFrameset(RefPtr<HTMLElement>&& newBody, ExceptionCode& ec)
     2590{
    25932591    // FIXME: This does not support setting a <frameset> Element, only a <body>. This does
    25942592    // not match the HTML specification:
     
    37653763#endif
    37663764
    3767 bool Document::setFocusedElement(PassRefPtr<Element> prpNewFocusedElement, FocusDirection direction)
    3768 {
    3769     RefPtr<Element> newFocusedElement = prpNewFocusedElement;
    3770 
     3765bool Document::setFocusedElement(Element* element, FocusDirection direction)
     3766{
     3767    RefPtr<Element> newFocusedElement = element;
    37713768    // Make sure newFocusedElement is actually in this document
    37723769    if (newFocusedElement && (&newFocusedElement->document() != this))
     
    45734570}
    45744571
    4575 void Document::setDecoder(PassRefPtr<TextResourceDecoder> decoder)
    4576 {
    4577     m_decoder = decoder;
     4572void Document::setDecoder(RefPtr<TextResourceDecoder>&& decoder)
     4573{
     4574    m_decoder = WTFMove(decoder);
    45784575}
    45794576
     
    48424839}
    48434840
    4844 void Document::pushCurrentScript(PassRefPtr<HTMLScriptElement> newCurrentScript)
     4841void Document::pushCurrentScript(HTMLScriptElement* newCurrentScript)
    48454842{
    48464843    ASSERT(newCurrentScript);
  • trunk/Source/WebCore/dom/Document.h

    r195520 r195524  
    734734    void setSelectedStylesheetSet(const String&);
    735735
    736     WEBCORE_EXPORT bool setFocusedElement(PassRefPtr<Element>, FocusDirection = FocusDirectionNone);
     736    WEBCORE_EXPORT bool setFocusedElement(Element*, FocusDirection = FocusDirectionNone);
    737737    Element* focusedElement() const { return m_focusedElement.get(); }
    738738    UserActionElementSet& userActionElements()  { return m_userActionElements; }
     
    925925    HTMLBodyElement* body() const;
    926926    WEBCORE_EXPORT HTMLElement* bodyOrFrameset() const;
    927     void setBodyOrFrameset(PassRefPtr<HTMLElement>, ExceptionCode&);
     927    void setBodyOrFrameset(RefPtr<HTMLElement>&&, ExceptionCode&);
    928928
    929929    Location* location() const;
     
    958958
    959959    HTMLScriptElement* currentScript() const { return !m_currentScriptStack.isEmpty() ? m_currentScriptStack.last().get() : nullptr; }
    960     void pushCurrentScript(PassRefPtr<HTMLScriptElement>);
     960    void pushCurrentScript(HTMLScriptElement*);
    961961    void popCurrentScript();
    962962
     
    10571057    bool shouldCreateRenderers();
    10581058
    1059     void setDecoder(PassRefPtr<TextResourceDecoder>);
     1059    void setDecoder(RefPtr<TextResourceDecoder>&&);
    10601060    TextResourceDecoder* decoder() const { return m_decoder.get(); }
    10611061
  • trunk/Source/WebCore/dom/Event.cpp

    r194496 r195524  
    158158}
    159159
    160 PassRefPtr<Event> Event::cloneFor(HTMLIFrameElement*) const
     160Ref<Event> Event::cloneFor(HTMLIFrameElement*) const
    161161{
    162162    return Event::create(type(), bubbles(), cancelable());
  • trunk/Source/WebCore/dom/Event.h

    r194452 r195524  
    180180    bool isBeingDispatched() const { return eventPhase(); }
    181181
    182     virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const;
     182    virtual Ref<Event> cloneFor(HTMLIFrameElement*) const;
    183183
    184184    virtual EventTarget* relatedTarget() const { return nullptr; }
  • trunk/Source/WebCore/dom/MouseEvent.cpp

    r194896 r195524  
    238238}
    239239
    240 PassRefPtr<Event> MouseEvent::cloneFor(HTMLIFrameElement* iframe) const
     240Ref<Event> MouseEvent::cloneFor(HTMLIFrameElement* iframe) const
    241241{
    242242    ASSERT(iframe);
    243     RefPtr<MouseEvent> clonedMouseEvent = MouseEvent::create();
     243    Ref<MouseEvent> clonedMouseEvent = MouseEvent::create();
    244244    Frame* frame = iframe->document().frame();
    245245    FrameView* frameView = frame ? frame->view() : nullptr;
     
    254254        0);
    255255    clonedMouseEvent->setForce(force());
    256     return clonedMouseEvent.release();
     256    return WTFMove(clonedMouseEvent);
    257257}
    258258
  • trunk/Source/WebCore/dom/MouseEvent.h

    r194896 r195524  
    105105    virtual int which() const override;
    106106
    107     virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const override;
     107    virtual Ref<Event> cloneFor(HTMLIFrameElement*) const override;
    108108
    109109protected:
  • trunk/Source/WebCore/dom/NodeIterator.cpp

    r194496 r195524  
    3838}
    3939
    40 NodeIterator::NodePointer::NodePointer(PassRefPtr<Node> n, bool b)
     40NodeIterator::NodePointer::NodePointer(Node* n, bool b)
    4141    : node(n)
    4242    , isPointerBeforeNode(b)
     
    7777}
    7878
    79 NodeIterator::NodeIterator(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
     79NodeIterator::NodeIterator(Node* rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
    8080    : NodeIteratorBase(*rootNode, whatToShow, WTFMove(filter))
    8181    , m_referenceNode(root(), true)
  • trunk/Source/WebCore/dom/NodeIterator.h

    r194496 r195524  
    3838    class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public NodeIteratorBase {
    3939    public:
    40         static Ref<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
     40        static Ref<NodeIterator> create(Node* rootNode, unsigned long whatToShow, RefPtr<NodeFilter>&& filter)
    4141        {
    4242            return adoptRef(*new NodeIterator(rootNode, whatToShow, WTFMove(filter)));
     
    5555
    5656    private:
    57         NodeIterator(PassRefPtr<Node>, unsigned long whatToShow, RefPtr<NodeFilter>&&);
     57        NodeIterator(Node*, unsigned long whatToShow, RefPtr<NodeFilter>&&);
    5858
    5959        struct NodePointer {
     
    6161            bool isPointerBeforeNode;
    6262            NodePointer();
    63             NodePointer(PassRefPtr<Node>, bool);
     63            NodePointer(Node*, bool);
    6464            void clear();
    6565            bool moveToNext(Node* root);
  • trunk/Source/WebCore/html/RadioInputType.cpp

    r179143 r195524  
    9191            break;
    9292        if (inputElement->isRadioButton() && inputElement->name() == element().name() && inputElement->isFocusable()) {
    93             element().document().setFocusedElement(inputElement);
     93            element().document().setFocusedElement(inputElement.get());
    9494            inputElement->dispatchSimulatedClick(event, SendNoEvents, DoNotShowPressedLook);
    9595            event->setDefaultHandled();
  • trunk/Source/WebCore/platform/ios/DeviceMotionClientIOS.mm

    r161589 r195524  
    121121#endif // PLATFORM(IOS_SIMULATOR)
    122122
    123     m_currentDeviceMotionData = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, true, kMotionUpdateInterval);
     123    m_currentDeviceMotionData = DeviceMotionData::create(WTFMove(acceleration), WTFMove(accelerationIncludingGravity), WTFMove(rotationRate), true, kMotionUpdateInterval);
    124124    m_controller->didChangeDeviceMotion(m_currentDeviceMotionData.get());
    125125}
  • trunk/Source/WebCore/xml/XSLTProcessor.cpp

    r195520 r195524  
    104104    RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create(sourceMIMEType);
    105105    decoder->setEncoding(sourceEncoding.isEmpty() ? UTF8Encoding() : TextEncoding(sourceEncoding), TextResourceDecoder::EncodingFromXMLHeader);
    106     result->setDecoder(decoder.release());
     106    result->setDecoder(WTFMove(decoder));
    107107
    108108    result->setContent(documentSource);
  • trunk/Source/WebKit/win/ChangeLog

    r195487 r195524  
     12016-01-24  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
     2
     3        Reduce PassRefPtr uses in dom - 4
     4        https://bugs.webkit.org/show_bug.cgi?id=153270
     5
     6        Reviewed by Darin Adler.
     7
     8        As a step to remove PassRefPtr uses, this patch reduces the uses in WebCore/dom.
     9
     10        * Plugins/PluginView.cpp:
     11        (WebCore::PluginView::focusPluginElement):
     12
    1132016-01-17  Ada Chan  <adachan@apple.com>
    214
  • trunk/Source/WebKit2/ChangeLog

    r195510 r195524  
     12016-01-24  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
     2
     3        Reduce PassRefPtr uses in dom - 4
     4        https://bugs.webkit.org/show_bug.cgi?id=153270
     5
     6        Reviewed by Darin Adler.
     7
     8        As a step to remove PassRefPtr uses, this patch reduces the uses in WebCore/dom.
     9
     10        * WebProcess/Plugins/PluginView.cpp:
     11        (WebKit::PluginView::focusPluginElement):
     12
    1132016-01-23  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r193468 r195524  
    11521152        page->focusController().setFocusedElement(m_pluginElement.get(), frame());
    11531153    else
    1154         frame()->document()->setFocusedElement(m_pluginElement);
     1154        frame()->document()->setFocusedElement(m_pluginElement.get());
    11551155}
    11561156
Note: See TracChangeset for help on using the changeset viewer.