Title: [160250] trunk/Source/WebCore
Revision
160250
Author
a...@apple.com
Date
2013-12-06 14:31:39 -0800 (Fri, 06 Dec 2013)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160249 => 160250)


--- trunk/Source/WebCore/ChangeLog	2013-12-06 22:31:22 UTC (rev 160249)
+++ trunk/Source/WebCore/ChangeLog	2013-12-06 22:31:39 UTC (rev 160250)
@@ -1,3 +1,17 @@
+2013-12-06  Alexey Proskuryakov  <a...@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_hor...@apple.com>
 
         Remove Image::decodedSize()

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (160249 => 160250)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2013-12-06 22:31:22 UTC (rev 160249)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2013-12-06 22:31:39 UTC (rev 160250)
@@ -156,7 +156,7 @@
 
 }
 
-/* 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.
  *
  * Initial version was 1.
@@ -644,13 +644,12 @@
                 write(obj->internalValue().asNumber());
                 return true;
             }
-            if (obj->inherits(JSFile::info())) {
+            if (File* file = toFile(obj)) {
                 write(FileTag);
-                write(toFile(obj));
+                write(file);
                 return true;
             }
-            if (obj->inherits(JSFileList::info())) {
-                FileList* list = toFileList(obj);
+            if (FileList* list = toFileList(obj)) {
                 write(FileListTag);
                 unsigned length = list->length();
                 write(length);
@@ -658,17 +657,15 @@
                     write(list->item(i));
                 return true;
             }
-            if (obj->inherits(JSBlob::info())) {
+            if (Blob* blob = toBlob(obj)) {
                 write(BlobTag);
-                Blob* blob = toBlob(obj);
                 m_blobURLs.append(blob->url());
                 write(blob->url());
                 write(blob->type());
                 write(blob->size());
                 return true;
             }
-            if (obj->inherits(JSImageData::info())) {
-                ImageData* data = ""
+            if (ImageData* data = "" {
                 write(ImageDataTag);
                 write(data->width());
                 write(data->height());
@@ -702,8 +699,7 @@
                 code = ValidationError;
                 return true;
             }
-            if (obj->inherits(JSArrayBuffer::info())) {
-                RefPtr<ArrayBuffer> arrayBuffer = toArrayBuffer(obj);
+            if (ArrayBuffer* arrayBuffer = toArrayBuffer(obj)) {
                 if (arrayBuffer->isNeutered()) {
                     code = ValidationError;
                     return true;
@@ -718,7 +714,7 @@
                     return true;
                 write(ArrayBufferTag);
                 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;
             }
             if (obj->inherits(JSArrayBufferView::info())) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to