Ref: A smart pointer for the reference age.
<https://webkit.org/b/120570>
Reviewed by Antti Koivisto.
Source/WebCore:
Use Ref<T> for various stack guards where null checking isn't needed.
Source/WTF:
Add a very simple simple Ref<T> smart pointer class that is never null.
It's initialized by passing a T& to the constructor and cannot be assigned to.
operator-> is not overloaded, to prevent unsafe-looking code.
The value is extracted by "T& get()", since C++ does not let you override operator.()
* wtf/Ref.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154962 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp
index edbddd2..f902610 100644
--- a/Source/WebCore/html/HTMLTableElement.cpp
+++ b/Source/WebCore/html/HTMLTableElement.cpp
@@ -40,6 +40,7 @@
#include "HTMLTableSectionElement.h"
#include "RenderTable.h"
#include "StylePropertySet.h"
+#include <wtf/Ref.h>
namespace WebCore {
@@ -189,7 +190,7 @@
return 0;
}
- RefPtr<Node> protectFromMutationEvents(this);
+ Ref<HTMLTableElement> protectFromMutationEvents(*this);
RefPtr<HTMLTableRowElement> lastRow = 0;
RefPtr<HTMLTableRowElement> row = 0;