Title: [132820] branches/chromium/1271/Source/WebCore
Revision
132820
Author
[email protected]
Date
2012-10-29 10:48:32 -0700 (Mon, 29 Oct 2012)

Log Message

Revert 128379 - IndexedDB: Use ScriptValue instead of SerializedScriptValue when possible
https://bugs.webkit.org/show_bug.cgi?id=94023

Patch by Alec Flett <[email protected]> on 2012-09-12
Reviewed by Kentaro Hara.

Transition the put/add/update methods to accept direct ScriptValue
objects rather than SerializedScriptValues, to eliminate lots of
redundant deserialization/serialization steps while storing
values.

Also see https://bugs.webkit.org/show_bug.cgi?id=95409 for
followup get/openCursor work, following this.

No new tests, this is a performance refactor of core IDB
functionality. Most existing tests cover correctness. Tests that
might fail include:

storage/indexeddb/objectstore-basics.html
storage/indexeddb/keypath-basics.html
storage/indexeddb/index-basics.html

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::update):
* Modules/indexeddb/IDBCursor.h:
(IDBCursor):
* Modules/indexeddb/IDBCursor.idl:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::generateIndexKeysForValue):
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(WebCore):
* Modules/indexeddb/IDBObjectStore.h:
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
(IDBObjectStore):
* Modules/indexeddb/IDBObjectStore.idl:
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore):
(WebCore::createIDBKeyFromScriptValueAndKeyPath):
(WebCore::deserializeIDBValue):
(WebCore::canInjectIDBKeyIntoScriptValue):
* bindings/v8/IDBBindingUtilities.h:
(WebCore):

[email protected]
Review URL: https://codereview.chromium.org/11336016

Modified Paths

Property Changed

Diff

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.cpp	2012-10-29 17:48:32 UTC (rev 132820)
@@ -125,9 +125,10 @@
     return m_source.get();
 }
 
-PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBCursor::update(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, ExceptionCode& ec)
 {
     IDB_TRACE("IDBCursor::update");
+    RefPtr<SerializedScriptValue> value = prpValue;
 
     if (!m_gotValue || isKeyCursor()) {
         ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
@@ -141,12 +142,17 @@
         ec = IDBDatabaseException::READ_ONLY_ERR;
         return 0;
     }
+    if (value->blobURLs().size() > 0) {
+        // FIXME: Add Blob/File/FileList support
+        ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
+        return 0;
+    }
 
     RefPtr<IDBObjectStore> objectStore = effectiveObjectStore();
     const IDBKeyPath& keyPath = objectStore->metadata().keyPath;
     const bool usesInLineKeys = !keyPath.isNull();
     if (usesInLineKeys) {
-        RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath);
+        RefPtr<IDBKey> keyPathKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath);
         if (!keyPathKey || !keyPathKey->isEqual(m_currentPrimaryKey.get())) {
             ec = IDBDatabaseException::DATA_ERR;
             return 0;

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.h (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.h	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.h	2012-10-29 17:48:32 UTC (rev 132820)
@@ -75,7 +75,7 @@
     PassRefPtr<IDBAny> value();
     IDBAny* source() const;
 
-    PassRefPtr<IDBRequest> update(ScriptExecutionContext*, ScriptValue&, ExceptionCode&);
+    PassRefPtr<IDBRequest> update(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, ExceptionCode&);
     void advance(long, ExceptionCode&);
     void continueFunction(PassRefPtr<IDBKey>, ExceptionCode&);
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, ExceptionCode&);
Property changes on: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.h
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.idl (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.idl	2012-10-29 17:48:32 UTC (rev 132820)
@@ -39,7 +39,7 @@
         readonly attribute IDBKey primaryKey;
         readonly attribute IDBAny source;
 
-        [CallWith=ScriptExecutionContext] IDBRequest update(in any value)
+        [CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value)
             raises (IDBDatabaseException);
         void advance(in long count)
             raises (IDBDatabaseException);
Property changes on: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBCursor.idl
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-10-29 17:48:32 UTC (rev 132820)
@@ -105,11 +105,11 @@
 }
 
 static void generateIndexKeysForValue(const IDBIndexMetadata& indexMetadata,
-                                      const ScriptValue& objectValue,
+                                      PassRefPtr<SerializedScriptValue> objectValue,
                                       IDBObjectStore::IndexKeys* indexKeys)
 {
     ASSERT(indexKeys);
-    RefPtr<IDBKey> indexKey = createIDBKeyFromScriptValueAndKeyPath(objectValue, indexMetadata.keyPath);
+    RefPtr<IDBKey> indexKey = createIDBKeyFromSerializedValueAndKeyPath(objectValue, indexMetadata.keyPath);
 
     if (!indexKey)
         return;
@@ -129,21 +129,22 @@
     }
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::add");
     return put(IDBObjectStoreBackendInterface::AddOnly, IDBAny::create(this), context, value, key, ec);
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::put");
     return put(IDBObjectStoreBackendInterface::AddOrUpdate, IDBAny::create(this), context, value, key, ec);
 }
 
-PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptExecutionContext* context, ScriptValue& value, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
+PassRefPtr<IDBRequest> IDBObjectStore::put(IDBObjectStoreBackendInterface::PutMode putMode, PassRefPtr<IDBAny> source, ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::put");
+    RefPtr<SerializedScriptValue> value = prpValue;
     RefPtr<IDBKey> key = prpKey;
     if (m_deleted) {
         ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
@@ -157,15 +158,7 @@
         ec = IDBDatabaseException::READ_ONLY_ERR;
         return 0;
     }
-
-    ScriptState* state = ScriptState::current();
-    RefPtr<SerializedScriptValue> serializedValue = value.serialize(state);
-    if (state->hadException()) {
-        ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
-        return 0;
-    }
-
-    if (serializedValue->blobURLs().size() > 0) {
+    if (value->blobURLs().size() > 0) {
         // FIXME: Add Blob/File/FileList support
         ec = IDBDatabaseException::IDB_DATA_CLONE_ERR;
         return 0;
@@ -184,7 +177,7 @@
         return 0;
     }
     if (usesInLineKeys) {
-        RefPtr<IDBKey> keyPathKey = createIDBKeyFromScriptValueAndKeyPath(value, keyPath);
+        RefPtr<IDBKey> keyPathKey = createIDBKeyFromSerializedValueAndKeyPath(value, keyPath);
         if (keyPathKey && !keyPathKey->isValid()) {
             ec = IDBDatabaseException::DATA_ERR;
             return 0;
@@ -194,7 +187,9 @@
             return 0;
         }
         if (hasKeyGenerator && !keyPathKey) {
-            if (!canInjectIDBKeyIntoScriptValue(value, keyPath)) {
+            RefPtr<IDBKey> dummyKey = IDBKey::createNumber(-1);
+            RefPtr<SerializedScriptValue> valueAfterInjection = injectIDBKeyIntoSerializedValue(dummyKey, value, keyPath);
+            if (!valueAfterInjection) {
                 ec = IDBDatabaseException::DATA_ERR;
                 return 0;
             }
@@ -218,7 +213,7 @@
     ASSERT(indexKeys.size() == indexNames.size());
 
     RefPtr<IDBRequest> request = IDBRequest::create(context, source, m_transaction.get());
-    m_backend->putWithIndexKeys(serializedValue.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec);
+    m_backend->putWithIndexKeys(value.release(), key.release(), putMode, request, m_transaction->backend(), indexNames, indexKeys, ec);
     if (ec) {
         request->markEarlyDeath();
         return 0;
@@ -318,7 +313,7 @@
     {
     }
 
-    virtual void handleEvent(ScriptExecutionContext* context, Event* event)
+    virtual void handleEvent(ScriptExecutionContext*, Event* event)
     {
         ASSERT(event->type() == eventNames().successEvent);
         EventTarget* target = event->target();
@@ -341,8 +336,7 @@
             RefPtr<IDBAny> valueAny = cursor->value();
 
             ASSERT(valueAny->type() == IDBAny::SerializedScriptValueType);
-            RefPtr<SerializedScriptValue> serializedValue = valueAny->serializedScriptValue();
-            ScriptValue value(deserializeIDBValue(context, serializedValue));
+            RefPtr<SerializedScriptValue> value = valueAny->serializedScriptValue();
 
             IDBObjectStore::IndexKeys indexKeys;
             generateIndexKeysForValue(m_indexMetadata, value, &indexKeys);
Property changes on: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.h	2012-10-29 17:48:32 UTC (rev 132820)
@@ -64,8 +64,8 @@
     PassRefPtr<IDBTransaction> transaction() const { return m_transaction; }
     bool autoIncrement() const { return m_metadata.autoIncrement; }
 
-    PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec) { return add(context, value, 0, ec);  }
-    PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, ScriptValue& value, ExceptionCode& ec) { return put(context, value, 0, ec);  }
+    PassRefPtr<IDBRequest> add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return add(context, value, 0, ec);  }
+    PassRefPtr<IDBRequest> put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, ExceptionCode& ec) { return put(context, value, 0, ec);  }
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, ExceptionCode& ec) { return openCursor(context, static_cast<IDBKeyRange*>(0), ec); } 
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec) { return openCursor(context, keyRange, IDBCursor::directionNext(), ec); } 
     PassRefPtr<IDBRequest> openCursor(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec) { return openCursor(context, key, IDBCursor::directionNext(), ec); } 
@@ -77,8 +77,8 @@
 
     PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
     PassRefPtr<IDBRequest> get(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
-    PassRefPtr<IDBRequest> add(ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
-    PassRefPtr<IDBRequest> put(ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> add(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> put(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
     PassRefPtr<IDBRequest> deleteFunction(ScriptExecutionContext*, PassRefPtr<IDBKey> key, ExceptionCode&);
     PassRefPtr<IDBRequest> clear(ScriptExecutionContext*, ExceptionCode&);
@@ -97,7 +97,7 @@
     PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKeyRange>, ExceptionCode&);
     PassRefPtr<IDBRequest> count(ScriptExecutionContext*, PassRefPtr<IDBKey>, ExceptionCode&);
 
-    PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefPtr<IDBAny> source, ScriptExecutionContext*, ScriptValue&, PassRefPtr<IDBKey>, ExceptionCode&);
+    PassRefPtr<IDBRequest> put(IDBObjectStoreBackendInterface::PutMode, PassRefPtr<IDBAny> source, ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, ExceptionCode&);
     void markDeleted() { m_deleted = true; }
     void transactionFinished();
 
Property changes on: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.h
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl	2012-10-29 17:48:32 UTC (rev 132820)
@@ -34,9 +34,9 @@
         readonly attribute IDBTransaction transaction;
         readonly attribute boolean autoIncrement;
 
-        [CallWith=ScriptExecutionContext] IDBRequest put(in any value, in [Optional] IDBKey key)
+        [CallWith=ScriptExecutionContext] IDBRequest put(in SerializedScriptValue value, in [Optional] IDBKey key)
             raises (IDBDatabaseException);
-        [CallWith=ScriptExecutionContext] IDBRequest add(in any value, in [Optional] IDBKey key)
+        [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] IDBKey key)
             raises (IDBDatabaseException);
         [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKeyRange? keyRange)
             raises (IDBDatabaseException);
Property changes on: branches/chromium/1271/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp	2012-10-29 17:48:32 UTC (rev 132820)
@@ -35,7 +35,6 @@
 #include "SerializedScriptValue.h"
 #include "V8Binding.h"
 #include "V8IDBKey.h"
-#include "WorldContextHandle.h"
 #include <wtf/MathExtras.h>
 #include <wtf/Vector.h>
 
@@ -86,8 +85,10 @@
     return IDBKey::createInvalid();
 }
 
+namespace {
+
 template<typename T>
-static bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value)
+bool getValueFrom(T indexOrName, v8::Handle<v8::Value>& v8Value)
 {
     v8::Local<v8::Object> object = v8Value->ToObject();
     if (!object->Has(indexOrName))
@@ -97,72 +98,49 @@
 }
 
 template<typename T>
-static bool setValue(v8::Handle<v8::Value>& v8Object, T indexOrName, const v8::Handle<v8::Value>& v8Value)
+bool setValue(v8::Handle<v8::Value>& v8Object, T indexOrName, const v8::Handle<v8::Value>& v8Value)
 {
     v8::Local<v8::Object> object = v8Object->ToObject();
     return object->Set(indexOrName, v8Value);
 }
 
-static bool get(v8::Handle<v8::Value>& object, const String& keyPathElement, v8::Handle<v8::Value>& result)
+bool get(v8::Handle<v8::Value>& object, const String& keyPathElement)
 {
     if (object->IsString() && keyPathElement == "length") {
         int32_t length = v8::Handle<v8::String>::Cast(object)->Length();
-        result = v8::Number::New(length);
+        object = v8::Number::New(length);
         return true;
     }
-    return object->IsObject() && getValueFrom(v8String(keyPathElement), result);
+    return object->IsObject() && getValueFrom(v8String(keyPathElement), object);
 }
 
-static bool canSet(v8::Handle<v8::Value>& object, const String& keyPathElement)
+bool set(v8::Handle<v8::Value>& object, const String& keyPathElement, const v8::Handle<v8::Value>& v8Value)
 {
-    return object->IsObject();
+    return object->IsObject() && setValue(object, v8String(keyPathElement), v8Value);
 }
 
-static bool set(v8::Handle<v8::Value>& object, const String& keyPathElement, const v8::Handle<v8::Value>& v8Value)
+v8::Handle<v8::Value> getNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
 {
-    return canSet(object, keyPathElement) && setValue(object, v8String(keyPathElement), v8Value);
-}
-
-static v8::Handle<v8::Value> getNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
-{
     v8::Handle<v8::Value> currentValue(rootValue);
+
     ASSERT(index <= keyPathElements.size());
     for (size_t i = 0; i < index; ++i) {
-        v8::Handle<v8::Value> parentValue(currentValue);
-        if (!get(parentValue, keyPathElements[i], currentValue))
+        if (!get(currentValue, keyPathElements[i]))
             return v8Undefined();
     }
 
     return currentValue;
 }
 
-static bool canInjectNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
+v8::Handle<v8::Value> ensureNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
 {
-    if (!rootValue->IsObject())
-        return false;
-
     v8::Handle<v8::Value> currentValue(rootValue);
 
     ASSERT(index <= keyPathElements.size());
     for (size_t i = 0; i < index; ++i) {
         v8::Handle<v8::Value> parentValue(currentValue);
         const String& keyPathElement = keyPathElements[i];
-        if (!get(parentValue, keyPathElement, currentValue))
-            return canSet(parentValue, keyPathElement);
-    }
-    return true;
-}
-
-
-static v8::Handle<v8::Value> ensureNthValueOnKeyPath(v8::Handle<v8::Value>& rootValue, const Vector<String>& keyPathElements, size_t index)
-{
-    v8::Handle<v8::Value> currentValue(rootValue);
-
-    ASSERT(index <= keyPathElements.size());
-    for (size_t i = 0; i < index; ++i) {
-        v8::Handle<v8::Value> parentValue(currentValue);
-        const String& keyPathElement = keyPathElements[i];
-        if (!get(parentValue, keyPathElement, currentValue)) {
+        if (!get(currentValue, keyPathElement)) {
             v8::Handle<v8::Object> object = v8::Object::New();
             if (!set(parentValue, keyPathElement, object))
                 return v8Undefined();
@@ -173,42 +151,8 @@
     return currentValue;
 }
 
-static PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue& value, const String& keyPath)
-{
-    Vector<String> keyPathElements;
-    IDBKeyPathParseError error;
-    IDBParseKeyPath(keyPath, keyPathElements, error);
-    ASSERT(error == IDBKeyPathParseErrorNone);
+} // anonymous namespace
 
-    v8::Handle<v8::Value> v8Value(value.v8Value());
-    v8::Handle<v8::Value> v8Key(getNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size()));
-    if (v8Key.IsEmpty())
-        return 0;
-    return createIDBKeyFromValue(v8Key);
-}
-
-PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue& value, const IDBKeyPath& keyPath)
-{
-    IDB_TRACE("createIDBKeyFromScriptValueAndKeyPath");
-    ASSERT(!keyPath.isNull());
-
-    v8::HandleScope scope;
-    if (keyPath.type() == IDBKeyPath::ArrayType) {
-        IDBKey::KeyArray result;
-        const Vector<String>& array = keyPath.array();
-        for (size_t i = 0; i < array.size(); ++i) {
-            RefPtr<IDBKey> key = createIDBKeyFromScriptValueAndKeyPath(value, array[i]);
-            if (!key)
-                return 0;
-            result.append(key);
-        }
-        return IDBKey::createArray(result);
-    }
-
-    ASSERT(keyPath.type() == IDBKeyPath::StringType);
-    return createIDBKeyFromScriptValueAndKeyPath(value, keyPath.string());
-}
-
 static PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> prpValue, const String& keyPath)
 {
     Vector<String> keyPathElements;
@@ -228,13 +172,6 @@
     return createIDBKeyFromValue(v8Key);
 }
 
-// FIXME: The only reason this exists is because we need a v8::Context and scope inside a timer. Is there a better / more general way to do this?
-ScriptValue deserializeIDBValue(ScriptExecutionContext* scriptContext, PassRefPtr<SerializedScriptValue> prpValue)
-{
-    v8::HandleScope handleScope;
-    v8::Context::Scope contextScope(toV8Context(scriptContext, UseCurrentWorld));
-    return ScriptValue(prpValue->deserialize());
-}
 
 PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue> prpValue, const IDBKeyPath& keyPath)
 {
@@ -286,22 +223,6 @@
     return SerializedScriptValue::create(v8Value);
 }
 
-bool canInjectIDBKeyIntoScriptValue(const ScriptValue& scriptValue, const IDBKeyPath& keyPath)
-{
-    IDB_TRACE("canInjectIDBKeyIntoScriptValue");
-    ASSERT(keyPath.type() == IDBKeyPath::StringType);
-    Vector<String> keyPathElements;
-    IDBKeyPathParseError error;
-    IDBParseKeyPath(keyPath.string(), keyPathElements, error);
-    ASSERT(error == IDBKeyPathParseErrorNone);
-
-    if (!keyPathElements.size())
-        return false;
-
-    v8::Handle<v8::Value> v8Value(scriptValue.v8Value());
-    return canInjectNthValueOnKeyPath(v8Value, keyPathElements, keyPathElements.size() - 1);
-}
-
 } // namespace WebCore
 
 #endif
Property changes on: branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.cpp
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.h (132819 => 132820)


--- branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.h	2012-10-29 17:47:25 UTC (rev 132819)
+++ branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.h	2012-10-29 17:48:32 UTC (rev 132820)
@@ -28,7 +28,6 @@
 
 #if ENABLE(INDEXED_DATABASE)
 
-#include "ScriptValue.h"
 #include <v8.h>
 #include <wtf/Forward.h>
 
@@ -39,15 +38,9 @@
 class SerializedScriptValue;
 
 PassRefPtr<IDBKey> createIDBKeyFromValue(v8::Handle<v8::Value>);
-
-// FIXME: remove the SerializedValue versions when their use is finally removed in https://bugs.webkit.org/show_bug.cgi?id=95409.
 PassRefPtr<IDBKey> createIDBKeyFromSerializedValueAndKeyPath(PassRefPtr<SerializedScriptValue>, const IDBKeyPath&);
 PassRefPtr<SerializedScriptValue> injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey>, PassRefPtr<SerializedScriptValue>, const IDBKeyPath&);
 
-PassRefPtr<IDBKey> createIDBKeyFromScriptValueAndKeyPath(const ScriptValue&, const IDBKeyPath&);
-bool canInjectIDBKeyIntoScriptValue(const ScriptValue&, const IDBKeyPath&);
-ScriptValue deserializeIDBValue(ScriptExecutionContext*, PassRefPtr<SerializedScriptValue>);
-
 }
 
 #endif // ENABLE(INDEXED_DATABASE)
Property changes on: branches/chromium/1271/Source/WebCore/bindings/v8/IDBBindingUtilities.h
___________________________________________________________________

Added: svn:mergeinfo

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to