Commit ad1137cb authored by akling@apple.com's avatar akling@apple.com
Browse files

Make some things that return never-null pointers return references instead.

<http://webkit.org/b/119660>

Reviewed by Antti Koivisto.

Source/WebCore:

These functions never return null anyway, so remove any ambiguity by letting
them return references instead of pointers.

- Node::ensureRareData()
- Element::ensureUniqueElementData()
- Element::ensureShadow()
- Element::ensureUserAgentShadowRoot()
- StyledElement::ensureMutableInlineStyle()
- NodeRareData::ensureNodeLists()
- NodeRareData::ensureMutationObserverData()
- EventTarget::ensureEventTargetData()
- Document::ensureStyleResolver()
- Document::selectorQueryCache()
- Document::mediaQueryMatcher()
- FlowThreadController::ensureRenderFlowThreadWithName()
- HTMLTrackElement::ensureTrack()
- SVGElement::ensureSVGRareData()
- AnimationControllerPrivate::ensureCompositeAnimation()

Source/WebKit/qt:

* Api/qwebelement.cpp:
(QWebElement::styleProperty):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e687dd4
2013-08-11 Andreas Kling <akling@apple.com>
Make some things that return never-null pointers return references instead.
<http://webkit.org/b/119660>
Reviewed by Antti Koivisto.
These functions never return null anyway, so remove any ambiguity by letting
them return references instead of pointers.
- Node::ensureRareData()
- Element::ensureUniqueElementData()
- Element::ensureShadow()
- Element::ensureUserAgentShadowRoot()
- StyledElement::ensureMutableInlineStyle()
- NodeRareData::ensureNodeLists()
- NodeRareData::ensureMutationObserverData()
- EventTarget::ensureEventTargetData()
- Document::ensureStyleResolver()
- Document::selectorQueryCache()
- Document::mediaQueryMatcher()
- FlowThreadController::ensureRenderFlowThreadWithName()
- HTMLTrackElement::ensureTrack()
- SVGElement::ensureSVGRareData()
- AnimationControllerPrivate::ensureCompositeAnimation()
2013-08-11 Sam Weinig <sam@webkit.org>
 
Cleanup MediaQueryListListener
......@@ -66,7 +66,7 @@ public:
protected:
virtual EventTargetData* eventTargetData() { return &m_eventTargetData; }
virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
virtual EventTargetData& ensureEventTargetData() { return m_eventTargetData; }
private:
explicit BatteryManager(Navigator*);
......
......@@ -103,7 +103,7 @@ private:
virtual void derefEventTarget() OVERRIDE { deref(); }
virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventTargetData; }
virtual EventTargetData& ensureEventTargetData() OVERRIDE { return m_eventTargetData; }
EventTargetData m_eventTargetData;
};
......
......@@ -99,10 +99,10 @@ private:
virtual void stop() OVERRIDE;
// EventTarget
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData() { return &m_eventTargetData; }
virtual EventTargetData* ensureEventTargetData() { return &m_eventTargetData; }
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetData; }
virtual EventTargetData& ensureEventTargetData() OVERRIDE { return m_eventTargetData; }
void completeAbort();
......
......@@ -378,9 +378,9 @@ EventTargetData* IDBDatabase::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* IDBDatabase::ensureEventTargetData()
EventTargetData& IDBDatabase::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
} // namespace WebCore
......
......@@ -115,10 +115,10 @@ private:
virtual void stop() OVERRIDE;
// EventTarget
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
void closeConnection();
......
......@@ -564,9 +564,9 @@ EventTargetData* IDBRequest::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* IDBRequest::ensureEventTargetData()
EventTargetData& IDBRequest::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
} // namespace WebCore
......
......@@ -135,10 +135,10 @@ private:
virtual void stop() OVERRIDE;
// EventTarget
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
PassRefPtr<IDBCursor> getResultCursor();
void setResultCursor(PassRefPtr<IDBCursor>, PassRefPtr<IDBKey>, PassRefPtr<IDBKey> primaryKey, const ScriptValue&);
......
......@@ -442,9 +442,9 @@ EventTargetData* IDBTransaction::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* IDBTransaction::ensureEventTargetData()
EventTargetData& IDBTransaction::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
IDBDatabaseBackendInterface* IDBTransaction::backendDB() const
......
......@@ -132,10 +132,10 @@ private:
virtual void stop() OVERRIDE;
// EventTarget
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
enum State {
Inactive, // Created or started, but not in an event callback
......
......@@ -317,9 +317,9 @@ EventTargetData* MediaSource::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* MediaSource::ensureEventTargetData()
EventTargetData& MediaSource::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
void MediaSource::scheduleEvent(const AtomicString& eventName)
......
......@@ -82,7 +82,7 @@ private:
virtual void stop() OVERRIDE;
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
......
......@@ -109,9 +109,9 @@ EventTargetData* SourceBufferList::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* SourceBufferList::ensureEventTargetData()
EventTargetData& SourceBufferList::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
} // namespace WebCore
......
......@@ -66,7 +66,7 @@ public:
protected:
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
private:
SourceBufferList(ScriptExecutionContext*, GenericEventQueue*);
......
......@@ -251,9 +251,9 @@ EventTargetData* MediaStream::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* MediaStream::ensureEventTargetData()
EventTargetData& MediaStream::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
void MediaStream::addRemoteTrack(MediaStreamComponent* component)
......
......@@ -84,7 +84,7 @@ protected:
// EventTarget
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
// ContextDestructionObserver
virtual void contextDestroyed();
......
......@@ -164,9 +164,9 @@ EventTargetData* MediaStreamTrack::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* MediaStreamTrack::ensureEventTargetData()
EventTargetData& MediaStreamTrack::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
} // namespace WebCore
......
......@@ -77,7 +77,7 @@ private:
// EventTarget
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
EventTargetData m_eventTargetData;
......
......@@ -149,9 +149,9 @@ EventTargetData* RTCDTMFSender::eventTargetData()
return &m_eventTargetData;
}
EventTargetData* RTCDTMFSender::ensureEventTargetData()
EventTargetData& RTCDTMFSender::ensureEventTargetData()
{
return &m_eventTargetData;
return m_eventTargetData;
}
void RTCDTMFSender::scheduleDispatchEvent(PassRefPtr<Event> event)
......
......@@ -75,7 +75,7 @@ private:
// EventTarget
virtual EventTargetData* eventTargetData() OVERRIDE;
virtual EventTargetData* ensureEventTargetData() OVERRIDE;
virtual EventTargetData& ensureEventTargetData() OVERRIDE;
virtual void refEventTarget() OVERRIDE { ref(); }
virtual void derefEventTarget() OVERRIDE { deref(); }
EventTargetData m_eventTargetData;
......
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