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

Unified Diff: third_party/WebKit/Source/core/dom/DOMDataView.cpp

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/DOMDataView.cpp
diff --git a/third_party/WebKit/Source/core/dom/DOMDataView.cpp b/third_party/WebKit/Source/core/dom/DOMDataView.cpp
index d95163d4cc25f01a63b355a3f5703f48e5b570d8..b76e0a4b3b020de67612dea5df6a313ba3ff571f 100644
--- a/third_party/WebKit/Source/core/dom/DOMDataView.cpp
+++ b/third_party/WebKit/Source/core/dom/DOMDataView.cpp
@@ -15,7 +15,7 @@ namespace {
class DataView final : public ArrayBufferView {
public:
- static PassRefPtr<DataView> create(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength)
+ static PassRefPtr<DataView> create(ArrayBuffer* buffer, unsigned byteOffset, unsigned byteLength)
{
RELEASE_ASSERT(byteOffset <= buffer->byteLength());
CheckedInt<uint32_t> checkedOffset(byteOffset);
@@ -37,7 +37,7 @@ protected:
}
private:
- DataView(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned byteLength)
+ DataView(ArrayBuffer* buffer, unsigned byteOffset, unsigned byteLength)
: ArrayBufferView(buffer, byteOffset)
, m_byteLength(byteLength) { }
@@ -46,20 +46,14 @@ private:
} // anonymous namespace
-PassRefPtr<DOMDataView> DOMDataView::create(PassRefPtr<DOMArrayBufferBase> prpBuffer, unsigned byteOffset, unsigned byteLength)
+DOMDataView* DOMDataView::create(DOMArrayBufferBase* buffer, unsigned byteOffset, unsigned byteLength)
{
- RefPtr<DOMArrayBufferBase> buffer = prpBuffer;
RefPtr<DataView> dataView = DataView::create(buffer->buffer(), byteOffset, byteLength);
- return adoptRef(new DOMDataView(dataView.release(), buffer.release()));
+ return new DOMDataView(dataView, buffer);
}
v8::Local<v8::Object> DOMDataView::wrap(v8::Isolate* isolate, v8::Local<v8::Object> creationContext)
{
- // It's possible that no one except for the new wrapper owns this object at
- // this moment, so we have to prevent GC to collect this object until the
- // object gets associated with the wrapper.
- RefPtr<DOMDataView> protect(this);
-
DCHECK(!DOMDataStore::containsWrapper(this, isolate));
const WrapperTypeInfo* wrapperTypeInfo = this->wrapperTypeInfo();

Powered by Google App Engine
This is Rietveld 408576698