Commit 49030778 authored by ap@apple.com's avatar ap@apple.com

Remove some duplicate checks from SerializedScriptValue

https://bugs.webkit.org/show_bug.cgi?id=125358

Reviewed by Geoffrey Garen.

There is no need to call inherits() before WebCore's toXXX(JSValue) functions.

Also, the result of toArrayBuffer() is a raw pointer, not a RefPtr (it's confusing
because toArrayBufferView returns a RefPtr).

* bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160250 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 98cdcaa0
2013-12-06 Alexey Proskuryakov <ap@apple.com>
Remove some duplicate checks from SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=125358
Reviewed by Geoffrey Garen.
There is no need to call inherits() before WebCore's toXXX(JSValue) functions.
Also, the result of toArrayBuffer() is a raw pointer, not a RefPtr (it's confusing
because toArrayBufferView returns a RefPtr).
* bindings/js/SerializedScriptValue.cpp: (WebCore::CloneSerializer::dumpIfTerminal):
2013-12-06 Tim Horton <timothy_horton@apple.com> 2013-12-06 Tim Horton <timothy_horton@apple.com>
Remove Image::decodedSize() Remove Image::decodedSize()
...@@ -156,7 +156,7 @@ static unsigned typedArrayElementSize(ArrayBufferViewSubtag tag) ...@@ -156,7 +156,7 @@ static unsigned typedArrayElementSize(ArrayBufferViewSubtag tag)
} }
/* CurrentVersion tracks the serialization version so that persistant stores /* CurrentVersion tracks the serialization version so that persistent stores
* are able to correctly bail out in the case of encountering newer formats. * are able to correctly bail out in the case of encountering newer formats.
* *
* Initial version was 1. * Initial version was 1.
...@@ -644,13 +644,12 @@ private: ...@@ -644,13 +644,12 @@ private:
write(obj->internalValue().asNumber()); write(obj->internalValue().asNumber());
return true; return true;
} }
if (obj->inherits(JSFile::info())) { if (File* file = toFile(obj)) {
write(FileTag); write(FileTag);
write(toFile(obj)); write(file);
return true; return true;
} }
if (obj->inherits(JSFileList::info())) { if (FileList* list = toFileList(obj)) {
FileList* list = toFileList(obj);
write(FileListTag); write(FileListTag);
unsigned length = list->length(); unsigned length = list->length();
write(length); write(length);
...@@ -658,17 +657,15 @@ private: ...@@ -658,17 +657,15 @@ private:
write(list->item(i)); write(list->item(i));
return true; return true;
} }
if (obj->inherits(JSBlob::info())) { if (Blob* blob = toBlob(obj)) {
write(BlobTag); write(BlobTag);
Blob* blob = toBlob(obj);
m_blobURLs.append(blob->url()); m_blobURLs.append(blob->url());
write(blob->url()); write(blob->url());
write(blob->type()); write(blob->type());
write(blob->size()); write(blob->size());
return true; return true;
} }
if (obj->inherits(JSImageData::info())) { if (ImageData* data = toImageData(obj)) {
ImageData* data = toImageData(obj);
write(ImageDataTag); write(ImageDataTag);
write(data->width()); write(data->width());
write(data->height()); write(data->height());
...@@ -702,8 +699,7 @@ private: ...@@ -702,8 +699,7 @@ private:
code = ValidationError; code = ValidationError;
return true; return true;
} }
if (obj->inherits(JSArrayBuffer::info())) { if (ArrayBuffer* arrayBuffer = toArrayBuffer(obj)) {
RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(obj);
if (arrayBuffer->isNeutered()) { if (arrayBuffer->isNeutered()) {
code = ValidationError; code = ValidationError;
return true; return true;
...@@ -718,7 +714,7 @@ private: ...@@ -718,7 +714,7 @@ private:
return true; return true;
write(ArrayBufferTag); write(ArrayBufferTag);
write(arrayBuffer->byteLength()); write(arrayBuffer->byteLength());
write(static_cast<const uint8_t *>(arrayBuffer->data()), arrayBuffer->byteLength()); write(static_cast<const uint8_t*>(arrayBuffer->data()), arrayBuffer->byteLength());
return true; return true;
} }
if (obj->inherits(JSArrayBufferView::info())) { if (obj->inherits(JSArrayBufferView::info())) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment