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/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp
index ce2fca1..80877c1 100644
--- a/Source/WebCore/loader/NavigationScheduler.cpp
+++ b/Source/WebCore/loader/NavigationScheduler.cpp
@@ -50,6 +50,7 @@
#include "ScriptController.h"
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
+#include <wtf/Ref.h>
namespace WebCore {
@@ -420,7 +421,7 @@
return;
}
- RefPtr<Frame> protect(m_frame);
+ Ref<Frame> protect(*m_frame);
OwnPtr<ScheduledNavigation> redirect(m_redirect.release());
redirect->fire(m_frame);
@@ -431,7 +432,7 @@
{
ASSERT(m_frame->page());
- RefPtr<Frame> protect(m_frame);
+ Ref<Frame> protect(*m_frame);
// If a redirect was scheduled during a load, then stop the current load.
// Otherwise when the current load transitions from a provisional to a