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/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index 40ab585..86d4e82 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -61,6 +61,7 @@
#include <wtf/CurrentTime.h>
#include <wtf/HashSet.h>
+#include <wtf/Ref.h>
#include <wtf/Vector.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringConcatenate.h>
@@ -747,7 +748,7 @@
return;
ErrorString errorString;
- RefPtr<WebKitNamedFlow> protector(namedFlow);
+ Ref<WebKitNamedFlow> protect(*namedFlow);
m_frontend->regionLayoutUpdated(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
}
@@ -769,7 +770,7 @@
return;
ErrorString errorString;
- RefPtr<WebKitNamedFlow> protector(namedFlow);
+ Ref<WebKitNamedFlow> protect(*namedFlow);
m_frontend->regionOversetChanged(buildObjectForNamedFlow(&errorString, namedFlow, documentNodeId));
}