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

Unified Diff: third_party/WebKit/Source/core/dom/DOMArrayBufferView.h

Issue 1878463002: Move DOMArrayBuffer, DOMArrayBufferViews and DataView to the heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tidy Created 4 years, 8 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: third_party/WebKit/Source/core/dom/DOMArrayBufferView.h
diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h b/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h
index 9818d8d16caf95d95c06d60ef4afeb8e33de530c..238d8aea2b2f541b76327343792bf653759a727d 100644
--- a/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h
+++ b/third_party/WebKit/Source/core/dom/DOMArrayBufferView.h
@@ -10,11 +10,10 @@
#include "core/dom/DOMArrayBuffer.h"
#include "core/dom/DOMSharedArrayBuffer.h"
#include "wtf/ArrayBufferView.h"
-#include "wtf/RefCounted.h"
namespace blink {
-class CORE_EXPORT DOMArrayBufferView : public RefCounted<DOMArrayBufferView>, public ScriptWrappable {
+class CORE_EXPORT DOMArrayBufferView : public GarbageCollectedFinalized<DOMArrayBufferView>, public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
public:
typedef WTF::ArrayBufferView::ViewType ViewType;
@@ -31,29 +30,29 @@ public:
virtual ~DOMArrayBufferView() { }
- PassRefPtr<DOMArrayBuffer> buffer() const
+ DOMArrayBuffer* buffer() const
{
DCHECK(!isShared());
- if (!m_domArrayBuffer) {
+ if (!m_domArrayBuffer)
m_domArrayBuffer = DOMArrayBuffer::create(view()->buffer());
- }
- return static_pointer_cast<DOMArrayBuffer>(m_domArrayBuffer);
+
+ return static_cast<DOMArrayBuffer*>(m_domArrayBuffer.get());
}
- PassRefPtr<DOMSharedArrayBuffer> bufferShared() const
+ DOMSharedArrayBuffer* bufferShared() const
{
DCHECK(isShared());
- if (!m_domArrayBuffer) {
+ if (!m_domArrayBuffer)
m_domArrayBuffer = DOMSharedArrayBuffer::create(view()->buffer());
- }
- return static_pointer_cast<DOMSharedArrayBuffer>(m_domArrayBuffer);
+
+ return static_cast<DOMSharedArrayBuffer*>(m_domArrayBuffer.get());
}
- PassRefPtr<DOMArrayBufferBase> bufferBase() const
+ DOMArrayBufferBase* bufferBase() const
{
- if (isShared()) {
+ if (isShared())
return bufferShared();
- }
+
return buffer();
}
@@ -74,14 +73,20 @@ public:
return v8::Local<v8::Object>();
}
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ visitor->trace(m_domArrayBuffer);
+ }
+
protected:
explicit DOMArrayBufferView(PassRefPtr<WTF::ArrayBufferView> bufferView)
: m_bufferView(bufferView)
{
DCHECK(m_bufferView);
}
- DOMArrayBufferView(PassRefPtr<WTF::ArrayBufferView> bufferView, PassRefPtr<DOMArrayBufferBase> domArrayBuffer)
- : m_bufferView(bufferView), m_domArrayBuffer(domArrayBuffer)
+ DOMArrayBufferView(PassRefPtr<WTF::ArrayBufferView> bufferView, DOMArrayBufferBase* domArrayBuffer)
+ : m_bufferView(bufferView)
+ , m_domArrayBuffer(domArrayBuffer)
{
DCHECK(m_bufferView);
DCHECK(m_domArrayBuffer);
@@ -90,7 +95,7 @@ protected:
private:
RefPtr<WTF::ArrayBufferView> m_bufferView;
- mutable RefPtr<DOMArrayBufferBase> m_domArrayBuffer;
+ mutable Member<DOMArrayBufferBase> m_domArrayBuffer;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698