https://bugs.webkit.org/show_bug.cgi?id=144904
Reviewed by Andreas Kling.
We return Ref when we're sure if pointer can't be null. If not, we use RefPtr instead PassRefPtr.
No new tests, no behavior changes.
* dom/AutocompleteErrorEvent.h:
* dom/DOMNamedFlowCollection.h:
(WebCore::DOMNamedFlowCollection::create):
* dom/MessageChannel.h:
(WebCore::MessageChannel::create):
* dom/MessagePort.h:
* dom/MutationObserver.cpp:
(WebCore::MutationObserver::create):
* dom/MutationObserver.h:
* dom/NamedFlowCollection.h:
* dom/NodeFilter.h:
(WebCore::NodeFilter::create):
* dom/NodeIterator.h:
(WebCore::NodeIterator::create):
* dom/ProcessingInstruction.cpp:
(WebCore::ProcessingInstruction::create):
* dom/ProcessingInstruction.h:
* dom/ScriptedAnimationController.h:
(WebCore::ScriptedAnimationController::create):
* dom/SecurityPolicyViolationEvent.h:
* dom/StaticNodeList.h:
* dom/TemplateContentDocumentFragment.h:
* dom/Touch.cpp:
(WebCore::Touch::cloneWithNewTarget):
* dom/Touch.h:
(WebCore::Touch::create):
* dom/TouchEvent.h:
* dom/TouchList.h:
(WebCore::TouchList::create):
* dom/TreeWalker.h:
(WebCore::TreeWalker::create):
* dom/WebKitNamedFlow.cpp:
(WebCore::WebKitNamedFlow::create):
* dom/WebKitNamedFlow.h:
* dom/default/PlatformMessagePortChannel.cpp:
(WebCore::PlatformMessagePortChannel::create):
* dom/default/PlatformMessagePortChannel.h:
(WebCore::PlatformMessagePortChannel::MessagePortQueue::create):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184225
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-05-12 Gyuyoung Kim <gyuyoung.kim@webkit.org>
+
+ Return Ref instead of PassRefPtr in create() factory functions of WebCore/dom
+ https://bugs.webkit.org/show_bug.cgi?id=144904
+
+ Reviewed by Andreas Kling.
+
+ We return Ref when we're sure if pointer can't be null. If not, we use RefPtr instead PassRefPtr.
+
+ No new tests, no behavior changes.
+
+ * dom/AutocompleteErrorEvent.h:
+ * dom/DOMNamedFlowCollection.h:
+ (WebCore::DOMNamedFlowCollection::create):
+ * dom/MessageChannel.h:
+ (WebCore::MessageChannel::create):
+ * dom/MessagePort.h:
+ * dom/MutationObserver.cpp:
+ (WebCore::MutationObserver::create):
+ * dom/MutationObserver.h:
+ * dom/NamedFlowCollection.h:
+ * dom/NodeFilter.h:
+ (WebCore::NodeFilter::create):
+ * dom/NodeIterator.h:
+ (WebCore::NodeIterator::create):
+ * dom/ProcessingInstruction.cpp:
+ (WebCore::ProcessingInstruction::create):
+ * dom/ProcessingInstruction.h:
+ * dom/ScriptedAnimationController.h:
+ (WebCore::ScriptedAnimationController::create):
+ * dom/SecurityPolicyViolationEvent.h:
+ * dom/StaticNodeList.h:
+ * dom/TemplateContentDocumentFragment.h:
+ * dom/Touch.cpp:
+ (WebCore::Touch::cloneWithNewTarget):
+ * dom/Touch.h:
+ (WebCore::Touch::create):
+ * dom/TouchEvent.h:
+ * dom/TouchList.h:
+ (WebCore::TouchList::create):
+ * dom/TreeWalker.h:
+ (WebCore::TreeWalker::create):
+ * dom/WebKitNamedFlow.cpp:
+ (WebCore::WebKitNamedFlow::create):
+ * dom/WebKitNamedFlow.h:
+ * dom/default/PlatformMessagePortChannel.cpp:
+ (WebCore::PlatformMessagePortChannel::create):
+ * dom/default/PlatformMessagePortChannel.h:
+ (WebCore::PlatformMessagePortChannel::MessagePortQueue::create):
+
2015-05-12 Matt Baker <mattbaker@apple.com>
Web Inspector: REGRESSION (r181625): Timeline recording started from console.profile is always empty
public:
static Ref<AutocompleteErrorEvent> create()
{
- return adoptRef(new AutocompleteErrorEvent);
+ return adoptRef(*new AutocompleteErrorEvent);
}
static Ref<AutocompleteErrorEvent> create(const String& reason)
class DOMNamedFlowCollection : public RefCounted<DOMNamedFlowCollection> {
public:
- static PassRefPtr<DOMNamedFlowCollection> create(const Vector<WebKitNamedFlow*>& namedFlows)
+ static Ref<DOMNamedFlowCollection> create(const Vector<WebKitNamedFlow*>& namedFlows)
{
- return adoptRef(new DOMNamedFlowCollection(namedFlows));
+ return adoptRef(*new DOMNamedFlowCollection(namedFlows));
}
unsigned long length() const;
class MessageChannel : public RefCounted<MessageChannel> {
public:
- static PassRefPtr<MessageChannel> create(ScriptExecutionContext& context) { return adoptRef(new MessageChannel(context)); }
+ static Ref<MessageChannel> create(ScriptExecutionContext& context) { return adoptRef(*new MessageChannel(context)); }
~MessageChannel();
MessagePort* port1() const { return m_port1.get(); }
class MessagePort final : public RefCounted<MessagePort>, public EventTargetWithInlineData {
public:
- static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
+ static Ref<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(*new MessagePort(scriptExecutionContext)); }
virtual ~MessagePort();
void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&);
static unsigned s_observerPriority = 0;
-PassRefPtr<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback)
+Ref<MutationObserver> MutationObserver::create(PassRefPtr<MutationCallback> callback)
{
ASSERT(isMainThread());
- return adoptRef(new MutationObserver(callback));
+ return adoptRef(*new MutationObserver(callback));
}
MutationObserver::MutationObserver(PassRefPtr<MutationCallback> callback)
CharacterDataOldValue = 1 << 6,
};
- static PassRefPtr<MutationObserver> create(PassRefPtr<MutationCallback>);
+ static Ref<MutationObserver> create(PassRefPtr<MutationCallback>);
static void deliverAllMutations();
~MutationObserver();
class NamedFlowCollection final : public RefCounted<NamedFlowCollection>, public ContextDestructionObserver {
public:
- static PassRefPtr<NamedFlowCollection> create(Document* doc) { return adoptRef(new NamedFlowCollection(doc)); }
+ static Ref<NamedFlowCollection> create(Document* doc) { return adoptRef(*new NamedFlowCollection(doc)); }
Vector<RefPtr<WebKitNamedFlow>> namedFlows();
WebKitNamedFlow* flowByName(const String&);
SHOW_NOTATION = 0x00000800
};
- static PassRefPtr<NodeFilter> create(PassRefPtr<NodeFilterCondition> condition)
+ static Ref<NodeFilter> create(PassRefPtr<NodeFilterCondition> condition)
{
- return adoptRef(new NodeFilter(condition));
+ return adoptRef(*new NodeFilter(condition));
}
- static PassRefPtr<NodeFilter> create()
+ static Ref<NodeFilter> create()
{
- return adoptRef(new NodeFilter());
+ return adoptRef(*new NodeFilter());
}
short acceptNode(JSC::ExecState*, Node*) const;
class NodeIterator : public ScriptWrappable, public RefCounted<NodeIterator>, public NodeIteratorBase {
public:
- static PassRefPtr<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
+ static Ref<NodeIterator> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
{
- return adoptRef(new NodeIterator(rootNode, whatToShow, filter, expandEntityReferences));
+ return adoptRef(*new NodeIterator(rootNode, whatToShow, filter, expandEntityReferences));
}
~NodeIterator();
{
}
-RefPtr<ProcessingInstruction> ProcessingInstruction::create(Document& document, const String& target, const String& data)
+Ref<ProcessingInstruction> ProcessingInstruction::create(Document& document, const String& target, const String& data)
{
- return adoptRef(new ProcessingInstruction(document, target, data));
+ return adoptRef(*new ProcessingInstruction(document, target, data));
}
ProcessingInstruction::~ProcessingInstruction()
class ProcessingInstruction final : public CharacterData, private CachedStyleSheetClient {
public:
- static RefPtr<ProcessingInstruction> create(Document&, const String& target, const String& data);
+ static Ref<ProcessingInstruction> create(Document&, const String& target, const String& data);
virtual ~ProcessingInstruction();
const String& target() const { return m_target; }
#endif
{
public:
- static PassRefPtr<ScriptedAnimationController> create(Document* document, PlatformDisplayID displayID)
+ static Ref<ScriptedAnimationController> create(Document* document, PlatformDisplayID displayID)
{
- return adoptRef(new ScriptedAnimationController(document, displayID));
+ return adoptRef(*new ScriptedAnimationController(document, displayID));
}
~ScriptedAnimationController();
void clearDocumentPointer() { m_document = 0; }
class SecurityPolicyViolationEvent final : public Event {
public:
- static PassRefPtr<SecurityPolicyViolationEvent> create()
+ static Ref<SecurityPolicyViolationEvent> create()
{
- return adoptRef(new SecurityPolicyViolationEvent());
+ return adoptRef(*new SecurityPolicyViolationEvent());
}
- static PassRefPtr<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
+ static Ref<SecurityPolicyViolationEvent> create(const AtomicString& type, const SecurityPolicyViolationEventInit& initializer)
{
- return adoptRef(new SecurityPolicyViolationEvent(type, initializer));
+ return adoptRef(*new SecurityPolicyViolationEvent(type, initializer));
}
const String& documentURI() const { return m_documentURI; }
return nodeList.release();
}
- static PassRefPtr<StaticNodeList> createEmpty()
+ static Ref<StaticNodeList> createEmpty()
{
- return adoptRef(new StaticNodeList);
+ return adoptRef(*new StaticNodeList);
}
virtual unsigned length() const override;
return nodeList.release();
}
- static PassRefPtr<StaticElementList> createEmpty()
+ static Ref<StaticElementList> createEmpty()
{
- return adoptRef(new StaticElementList);
+ return adoptRef(*new StaticElementList);
}
virtual unsigned length() const override;
class TemplateContentDocumentFragment final : public DocumentFragment {
public:
- static RefPtr<TemplateContentDocumentFragment> create(Document& document, const Element* host)
+ static Ref<TemplateContentDocumentFragment> create(Document& document, const Element* host)
{
- return adoptRef(new TemplateContentDocumentFragment(document, host));
+ return adoptRef(*new TemplateContentDocumentFragment(document, host));
}
const Element* host() const { return m_host; }
{
}
-PassRefPtr<Touch> Touch::cloneWithNewTarget(EventTarget* eventTarget) const
+Ref<Touch> Touch::cloneWithNewTarget(EventTarget* eventTarget) const
{
- return adoptRef(new Touch(eventTarget, m_identifier, m_clientX, m_clientY, m_screenX, m_screenY, m_pageX, m_pageY, m_radiusX, m_radiusY, m_rotationAngle, m_force, m_absoluteLocation));
+ return adoptRef(*new Touch(eventTarget, m_identifier, m_clientX, m_clientY, m_screenX, m_screenY, m_pageX, m_pageY, m_radiusX, m_radiusY, m_rotationAngle, m_force, m_absoluteLocation));
}
} // namespace WebCore
class Touch : public RefCounted<Touch> {
public:
- static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
+ static Ref<Touch> create(Frame* frame, EventTarget* target,
unsigned identifier, int screenX, int screenY, int pageX, int pageY,
int radiusX, int radiusY, float rotationAngle, float force)
{
- return adoptRef(new Touch(frame, target, identifier, screenX,
+ return adoptRef(*new Touch(frame, target, identifier, screenX,
screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force));
}
float webkitRotationAngle() const { return m_rotationAngle; }
float webkitForce() const { return m_force; }
const LayoutPoint& absoluteLocation() const { return m_absoluteLocation; }
- PassRefPtr<Touch> cloneWithNewTarget(EventTarget*) const;
+ Ref<Touch> cloneWithNewTarget(EventTarget*) const;
private:
Touch(Frame* frame, EventTarget* target, unsigned identifier,
{
return adoptRef(*new TouchEvent);
}
- static PassRefPtr<TouchEvent> create(TouchList* touches,
+ static Ref<TouchEvent> create(TouchList* touches,
TouchList* targetTouches, TouchList* changedTouches,
const AtomicString& type, PassRefPtr<AbstractView> view,
int screenX, int screenY, int pageX, int pageY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
- return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
+ return adoptRef(*new TouchEvent(touches, targetTouches, changedTouches,
type, view, screenX, screenY, pageX, pageY,
ctrlKey, altKey, shiftKey, metaKey));
}
class TouchList : public RefCounted<TouchList> {
public:
- static PassRefPtr<TouchList> create()
+ static Ref<TouchList> create()
{
- return adoptRef(new TouchList);
+ return adoptRef(*new TouchList);
}
unsigned length() const { return m_values.size(); }
class TreeWalker : public ScriptWrappable, public RefCounted<TreeWalker>, public NodeIteratorBase {
public:
- static PassRefPtr<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
+ static Ref<TreeWalker> create(PassRefPtr<Node> rootNode, unsigned whatToShow, PassRefPtr<NodeFilter> filter, bool expandEntityReferences)
{
- return adoptRef(new TreeWalker(rootNode, whatToShow, filter, expandEntityReferences));
+ return adoptRef(*new TreeWalker(rootNode, whatToShow, filter, expandEntityReferences));
}
Node* currentNode() const { return m_current.get(); }
m_flowManager->discardNamedFlow(this);
}
-PassRefPtr<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName)
+Ref<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName)
{
- return adoptRef(new WebKitNamedFlow(manager, flowThreadName));
+ return adoptRef(*new WebKitNamedFlow(manager, flowThreadName));
}
const AtomicString& WebKitNamedFlow::name() const
class WebKitNamedFlow final : public RefCounted<WebKitNamedFlow>, public EventTargetWithInlineData {
public:
- static PassRefPtr<WebKitNamedFlow> create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName);
+ static Ref<WebKitNamedFlow> create(PassRefPtr<NamedFlowCollection> manager, const AtomicString& flowThreadName);
~WebKitNamedFlow();
return 0;
}
-PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing)
+Ref<PlatformMessagePortChannel> PlatformMessagePortChannel::create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing)
{
- return adoptRef(new PlatformMessagePortChannel(incoming, outgoing));
+ return adoptRef(*new PlatformMessagePortChannel(incoming, outgoing));
}
PlatformMessagePortChannel::PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing)
// Wrapper for MessageQueue that allows us to do thread safe sharing by two proxies.
class MessagePortQueue : public ThreadSafeRefCounted<MessagePortQueue> {
public:
- static PassRefPtr<MessagePortQueue> create() { return adoptRef(new MessagePortQueue()); }
+ static Ref<MessagePortQueue> create() { return adoptRef(*new MessagePortQueue()); }
std::unique_ptr<PlatformMessagePortChannel::EventData> tryGetMessage()
{
~PlatformMessagePortChannel();
- static PassRefPtr<PlatformMessagePortChannel> create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
+ static Ref<PlatformMessagePortChannel> create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
PassRefPtr<PlatformMessagePortChannel> entangledChannel();