Title: [163732] trunk/Source/WebCore
Revision
163732
Author
a...@apple.com
Date
2014-02-08 17:21:32 -0800 (Sat, 08 Feb 2014)

Log Message

Remove some unused functions from SerializedScriptValue
https://bugs.webkit.org/show_bug.cgi?id=128407

Reviewed by Oliver Hunt.

Removed more unused code, particularly in API helpers. Renamed one serialize()
function to create(), because it does the same thing as other create() functions.

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::put):
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::deserialize):
* bindings/js/SerializedScriptValue.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163731 => 163732)


--- trunk/Source/WebCore/ChangeLog	2014-02-09 01:13:50 UTC (rev 163731)
+++ trunk/Source/WebCore/ChangeLog	2014-02-09 01:21:32 UTC (rev 163732)
@@ -1,3 +1,20 @@
+2014-02-08  Alexey Proskuryakov  <a...@apple.com>
+
+        Remove some unused functions from SerializedScriptValue
+        https://bugs.webkit.org/show_bug.cgi?id=128407
+
+        Reviewed by Oliver Hunt.
+
+        Removed more unused code, particularly in API helpers. Renamed one serialize()
+        function to create(), because it does the same thing as other create() functions.
+
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::put):
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedScriptValue::create):
+        (WebCore::SerializedScriptValue::deserialize):
+        * bindings/js/SerializedScriptValue.h:
+
 2014-02-08  Brady Eidson  <beid...@apple.com>
 
         IDB: storage/indexeddb/mozilla/versionchange-abort.html fails

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (163731 => 163732)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2014-02-09 01:13:50 UTC (rev 163731)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2014-02-09 01:21:32 UTC (rev 163732)
@@ -145,7 +145,7 @@
 
     // FIXME: Expose the JS engine exception state through ScriptState.
     bool didThrow = false;
-    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::serialize(value, state, nullptr, nullptr, didThrow);
+    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(value, state, nullptr, nullptr, didThrow);
     if (didThrow) {
         // Setting an explicit ExceptionCode here would defer handling the already thrown exception.
         return 0;

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (163731 => 163732)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2014-02-09 01:13:50 UTC (rev 163731)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp	2014-02-09 01:21:32 UTC (rev 163732)
@@ -2564,14 +2564,12 @@
 }
 #endif
 
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue, 
-                                                                MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers,
-                                                                JSValueRef* exception)
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue, JSValueRef* exception)
 {
     ExecState* exec = toJS(originContext);
     APIEntryShim entryShim(exec);
     JSValue value = toJS(exec, apiValue);
-    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(exec, value, messagePorts, arrayBuffers);
+    RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(exec, value, nullptr, nullptr);
     if (exec->hadException()) {
         if (exception)
             *exception = toRef(exec, exec->exception());
@@ -2582,12 +2580,6 @@
     return serializedValue.release();
 }
 
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(JSContextRef originContext, JSValueRef apiValue,
-                                                                JSValueRef* exception)
-{
-    return create(originContext, apiValue, 0, 0, exception);
-}
-
 String SerializedScriptValue::toString()
 {
     return CloneDeserializer::deserializeString(m_data);
@@ -2603,11 +2595,11 @@
     return result.first;
 }
 
-JSValueRef SerializedScriptValue::deserialize(JSContextRef destinationContext, JSValueRef* exception, MessagePortArray* messagePorts)
+JSValueRef SerializedScriptValue::deserialize(JSContextRef destinationContext, JSValueRef* exception)
 {
     ExecState* exec = toJS(destinationContext);
     APIEntryShim entryShim(exec);
-    JSValue value = deserialize(exec, exec->lexicalGlobalObject(), messagePorts);
+    JSValue value = deserialize(exec, exec->lexicalGlobalObject(), nullptr);
     if (exec->hadException()) {
         if (exception)
             *exception = toRef(exec, exec->exception());
@@ -2618,32 +2610,14 @@
     return toRef(exec, value);
 }
 
-
-JSValueRef SerializedScriptValue::deserialize(JSContextRef destinationContext, JSValueRef* exception)
-{
-    return deserialize(destinationContext, exception, 0);
-}
-
 PassRefPtr<SerializedScriptValue> SerializedScriptValue::nullValue()
 {
     Vector<uint8_t> buffer;
     return adoptRef(new SerializedScriptValue(buffer));
 }
 
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::booleanValue(bool value)
+PassRefPtr<SerializedScriptValue> SerializedScriptValue::create(const Deprecated::ScriptValue& value, JSC::ExecState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
 {
-    Vector<uint8_t> buffer;
-    CloneSerializer::serializeBoolean(value, buffer);
-    return adoptRef(new SerializedScriptValue(buffer));
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::serialize(const Deprecated::ScriptValue& value, JSC::ExecState* scriptState, SerializationErrorMode throwExceptions)
-{
-    return SerializedScriptValue::create(scriptState, value.jsValue(), nullptr, nullptr, throwExceptions);
-}
-
-PassRefPtr<SerializedScriptValue> SerializedScriptValue::serialize(const Deprecated::ScriptValue& value, JSC::ExecState* scriptState, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, bool& didThrow)
-{
     RefPtr<SerializedScriptValue> serializedValue = SerializedScriptValue::create(scriptState, value.jsValue(), messagePorts, arrayBuffers);
     didThrow = scriptState->hadException();
     return serializedValue.release();

Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (163731 => 163732)


--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2014-02-09 01:13:50 UTC (rev 163731)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h	2014-02-09 01:21:32 UTC (rev 163732)
@@ -68,8 +68,6 @@
 #endif
 public:
     static PassRefPtr<SerializedScriptValue> create(JSC::ExecState*, JSC::JSValue, MessagePortArray*, ArrayBufferArray*, SerializationErrorMode = Throwing);
-    static PassRefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef, MessagePortArray*, ArrayBufferArray*, JSValueRef* exception);
-    static PassRefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef, JSValueRef* exception);
 
     static PassRefPtr<SerializedScriptValue> create(const String&);
     static PassRefPtr<SerializedScriptValue> adopt(Vector<uint8_t>& buffer)
@@ -78,18 +76,18 @@
     }
 
     static PassRefPtr<SerializedScriptValue> nullValue();
-    static PassRefPtr<SerializedScriptValue> booleanValue(bool value);
 
-    static PassRefPtr<SerializedScriptValue> serialize(const Deprecated::ScriptValue&, JSC::ExecState*, SerializationErrorMode = Throwing);
-    static PassRefPtr<SerializedScriptValue> serialize(const Deprecated::ScriptValue&, JSC::ExecState*, MessagePortArray*, ArrayBufferArray*, bool&);
+    JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode = Throwing);
+
+    static PassRefPtr<SerializedScriptValue> create(const Deprecated::ScriptValue&, JSC::ExecState*, MessagePortArray*, ArrayBufferArray*, bool& didThrow);
     static Deprecated::ScriptValue deserialize(JSC::ExecState*, SerializedScriptValue*, SerializationErrorMode = Throwing);
 
     static uint32_t wireFormatVersion();
 
     String toString();
-    
-    JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode = Throwing);
-    JSValueRef deserialize(JSContextRef, JSValueRef* exception, MessagePortArray*);
+
+    // API implementation helpers. These don't expose special behavior for ArrayBuffers or MessagePorts.
+    static PassRefPtr<SerializedScriptValue> create(JSContextRef, JSValueRef, JSValueRef* exception);
     JSValueRef deserialize(JSContextRef, JSValueRef* exception);
 
     const Vector<uint8_t>& data() const { return m_data; }
@@ -119,6 +117,7 @@
     SerializedScriptValue(Vector<unsigned char>&);
     SerializedScriptValue(Vector<unsigned char>&, Vector<String>& blobURLs);
     SerializedScriptValue(Vector<unsigned char>&, Vector<String>& blobURLs, PassOwnPtr<ArrayBufferContentsArray>);
+
     Vector<unsigned char> m_data;
     OwnPtr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
     Vector<String> m_blobURLs;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to