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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.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/bindings/core/v8/SerializedScriptValue.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
index 912db456d7b6a161151cef12680409bf1a023e7a..df2907e44b0ccaa4c984120f191d15bb4c6b8b4f 100644
--- a/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.cpp
@@ -137,7 +137,7 @@ PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
OwnPtr<ArrayBufferContentsArray> contents = adoptPtr(new ArrayBufferContentsArray(arrayBuffers.size()));
- HashSet<DOMArrayBufferBase*> visited;
+ HeapHashSet<Member<DOMArrayBufferBase>> visited;
for (size_t i = 0; i < arrayBuffers.size(); i++) {
if (visited.contains(arrayBuffers[i].get()))
continue;
@@ -152,12 +152,12 @@ PassOwnPtr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValu
} else {
Vector<v8::Local<v8::ArrayBuffer>, 4> bufferHandles;
v8::HandleScope handleScope(isolate);
- acculumateArrayBuffersForAllWorlds(isolate, static_pointer_cast<DOMArrayBuffer>(arrayBuffers[i]).get(), bufferHandles);
+ acculumateArrayBuffersForAllWorlds(isolate, static_cast<DOMArrayBuffer*>(arrayBuffers[i].get()), bufferHandles);
bool isNeuterable = true;
for (size_t j = 0; j < bufferHandles.size(); j++)
isNeuterable &= bufferHandles[j]->IsNeuterable();
- RefPtr<DOMArrayBufferBase> toTransfer = arrayBuffers[i];
+ DOMArrayBufferBase* toTransfer = arrayBuffers[i];
if (!isNeuterable)
toTransfer = DOMArrayBuffer::create(arrayBuffers[i]->buffer());
bool result = toTransfer->transfer(contents->at(i));
@@ -233,26 +233,26 @@ bool SerializedScriptValue::extractTransferables(v8::Isolate* isolate, v8::Local
}
ports.append(port);
} else if (V8ArrayBuffer::hasInstance(transferrable, isolate)) {
- RefPtr<DOMArrayBuffer> arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferrable));
+ DOMArrayBuffer* arrayBuffer = V8ArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferrable));
if (arrayBuffers.contains(arrayBuffer)) {
exceptionState.throwDOMException(DataCloneError, "ArrayBuffer at index " + String::number(i) + " is a duplicate of an earlier ArrayBuffer.");
return false;
}
- arrayBuffers.append(arrayBuffer.release());
+ arrayBuffers.append(arrayBuffer);
} else if (V8SharedArrayBuffer::hasInstance(transferrable, isolate)) {
- RefPtr<DOMSharedArrayBuffer> sharedArrayBuffer = V8SharedArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferrable));
+ DOMSharedArrayBuffer* sharedArrayBuffer = V8SharedArrayBuffer::toImpl(v8::Local<v8::Object>::Cast(transferrable));
if (arrayBuffers.contains(sharedArrayBuffer)) {
exceptionState.throwDOMException(DataCloneError, "SharedArrayBuffer at index " + String::number(i) + " is a duplicate of an earlier SharedArrayBuffer.");
return false;
}
- arrayBuffers.append(sharedArrayBuffer.release());
+ arrayBuffers.append(sharedArrayBuffer);
} else if (V8ImageBitmap::hasInstance(transferrable, isolate)) {
- RawPtr<ImageBitmap> imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Object>::Cast(transferrable));
+ ImageBitmap* imageBitmap = V8ImageBitmap::toImpl(v8::Local<v8::Object>::Cast(transferrable));
if (imageBitmaps.contains(imageBitmap)) {
exceptionState.throwDOMException(DataCloneError, "ImageBitmap at index " + String::number(i) + " is a duplicate of an earlier ImageBitmap.");
return false;
}
- imageBitmaps.append(imageBitmap.release());
+ imageBitmaps.append(imageBitmap);
} else {
exceptionState.throwTypeError("Value at index " + String::number(i) + " does not have a transferable type.");
return false;

Powered by Google App Engine
This is Rietveld 408576698