Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1152)

Unified Diff: Source/web/WebRange.cpp

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/WebRange.cpp
diff --git a/Source/web/WebRange.cpp b/Source/web/WebRange.cpp
index e4fce81f6f93a11d22f234d51600caef9201c9e7..564ea5502a324952910685b6907f876d67b9e13d 100644
--- a/Source/web/WebRange.cpp
+++ b/Source/web/WebRange.cpp
@@ -52,20 +52,14 @@ using namespace WebCore;
namespace blink {
-class WebRangePrivate : public Range {
-};
-
void WebRange::reset()
{
- assign(0);
+ m_private.reset();
}
void WebRange::assign(const WebRange& other)
{
- WebRangePrivate* p = const_cast<WebRangePrivate*>(other.m_private);
- if (p)
- p->ref();
- assign(p);
+ m_private = other.m_private;
}
int WebRange::startOffset() const
@@ -143,28 +137,14 @@ WebVector<WebFloatQuad> WebRange::textQuads() const
return quads;
}
-WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range)
- : m_private(static_cast<WebRangePrivate*>(range.leakRef()))
-{
-}
-
-WebRange& WebRange::operator=(const WTF::PassRefPtr<WebCore::Range>& range)
-{
- assign(static_cast<WebRangePrivate*>(range.leakRef()));
- return *this;
-}
-
-WebRange::operator WTF::PassRefPtr<WebCore::Range>() const
+WebRange::WebRange(const PassRefPtrWillBeRawPtr<WebCore::Range>& range)
+ : m_private(range)
{
- return PassRefPtr<Range>(const_cast<WebRangePrivate*>(m_private));
}
-void WebRange::assign(WebRangePrivate* p)
+WebRange::operator PassRefPtrWillBeRawPtr<WebCore::Range>() const
{
- // p is already ref'd for us by the caller
- if (m_private)
- m_private->deref();
- m_private = p;
+ return m_private.get();
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698