[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

bulach at chromium.org bulach at chromium.org
Wed Dec 22 12:28:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4898120959c09deb96c8621311d509cf88944b6b
Author: bulach at chromium.org <bulach at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 24 13:25:39 2010 +0000

    2010-08-24  Marcus Bulach  <bulach at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            Hooks IDBKeyPath with IDBObjectStorage::put.
            https://bugs.webkit.org/show_bug.cgi?id=44275
    
            Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
            during IDBObjectStorage::put.
    
            * WebCore.gyp/WebCore.gyp:
            * WebCore.gypi:
            * platform/chromium/ChromiumBridge.h:
            * storage/IDBKeyPathBackendImpl.cpp: Added.
            (IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
            * storage/IDBKeyPathBackendImpl.h: Added.
            * storage/IDBObjectStoreBackendImpl.cpp:
            (WebCore::IDBObjectStoreBackendImpl::put):
            * storage/chromium/IDBKeyPathBackendImpl.cpp: Added.
            (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
    2010-08-24  Marcus Bulach  <bulach at chromium.org>
    
            Reviewed by Jeremy Orlow.
    
            Hooks IDBKeyPath with IDBObjectStorage::put.
            https://bugs.webkit.org/show_bug.cgi?id=44275
    
            Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
            during IDBObjectStorage::put.
    
            * public/WebIDBKey.h:
            (WebKit::WebIDBKey::WebIDBKey):
            * public/WebKitClient.h:
            (WebKit::WebKitClient::createIDBKeysFromSerializedValuesAndKeyPath):
            * src/ChromiumBridge.cpp:
            (WebCore::ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65893 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index efe750c..ea9f92f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-24  Marcus Bulach  <bulach at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        Hooks IDBKeyPath with IDBObjectStorage::put.
+        https://bugs.webkit.org/show_bug.cgi?id=44275
+
+        Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
+        during IDBObjectStorage::put.
+
+        * WebCore.gyp/WebCore.gyp:
+        * WebCore.gypi:
+        * platform/chromium/ChromiumBridge.h:
+        * storage/IDBKeyPathBackendImpl.cpp: Added.
+        (IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
+        * storage/IDBKeyPathBackendImpl.h: Added.
+        * storage/IDBObjectStoreBackendImpl.cpp:
+        (WebCore::IDBObjectStoreBackendImpl::put):
+        * storage/chromium/IDBKeyPathBackendImpl.cpp: Added.
+        (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
+
 2010-08-24  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index 178e459..c625f5f 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -885,6 +885,9 @@
         # Don't build IDBFactoryBackendInterface.  We have our own implementation.
         '../storage/IDBFactoryBackendInterface.cpp',
 
+        # Don't build IDBKeyPathBackendImpl.  We have our own implementation.
+        '../storage/IDBKeyPathBackendImpl.cpp',
+
         # Use history/BackForwardListChromium.cpp instead.
         '../history/BackForwardListImpl.cpp',
 
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 31bd164..d24b5c8 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3534,6 +3534,7 @@
             'storage/ChangeVersionWrapper.h',
             'storage/chromium/DatabaseObserver.h',
             'storage/chromium/IDBFactoryBackendInterface.cpp',
+            'storage/chromium/IDBKeyPathBackendImpl.cpp',
             'storage/chromium/DatabaseTrackerChromium.cpp',
             'storage/chromium/QuotaTracker.cpp',
             'storage/chromium/QuotaTracker.h',
@@ -3595,6 +3596,8 @@
             'storage/IDBErrorEvent.h',
             'storage/IDBFactory.cpp',
             'storage/IDBFactory.h',
+            'storage/IDBKeyPathBackendImpl.cpp',
+            'storage/IDBKeyPathBackendImpl.h',
             'storage/IDBFactoryBackendInterface.cpp',
             'storage/IDBFactoryBackendInterface.h',
             'storage/IDBFactoryBackendImpl.cpp',
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index fc1345e..35ace89 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -72,8 +72,10 @@ namespace WebCore {
     class GraphicsContext;
     class Image;
     class IDBFactoryBackendInterface;
+    class IDBKey;
     class IntRect;
     class KURL;
+    class SerializedScriptValue;
     class Widget;
 
     struct Cookie;
@@ -167,6 +169,8 @@ namespace WebCore {
 
         // IndexedDB ----------------------------------------------------------
         static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
+        // Extracts keyPath from values and returns the corresponding keys.
+        static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys);
 
         // JavaScript ---------------------------------------------------------
         static void notifyJSOutOfMemory(Frame*);
diff --git a/WebCore/storage/IDBKeyPathBackendImpl.cpp b/WebCore/storage/IDBKeyPathBackendImpl.cpp
new file mode 100644
index 0000000..6cc9be5
--- /dev/null
+++ b/WebCore/storage/IDBKeyPathBackendImpl.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBKeyPathBackendImpl.h"
+
+#if PLATFORM(CHROMIUM)
+#error "Chromium should not compile this file and instead define its own version of this factory that navigates the multi-process boundry."
+#endif
+
+void IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue>&, 0> values, const String& keyPath, Vector<RefPtr<IDBKey>, 0>& keys)
+{
+    // FIXME: Implement this method once JSC supports WireFormat for SerializedScriptValue.
+}
diff --git a/WebCore/storage/IDBKeyPathBackendImpl.h b/WebCore/storage/IDBKeyPathBackendImpl.h
new file mode 100644
index 0000000..32af5e3
--- /dev/null
+++ b/WebCore/storage/IDBKeyPathBackendImpl.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBKeyPathBackendImpl_h
+#define IDBKeyPathBackendImpl_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class IDBKey;
+class SerializedScriptValue;
+
+class IDBKeyPathBackendImpl {
+public:
+    static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue>, 0>& values, const String& keyPath, Vector<RefPtr<IDBKey>, 0>& keys);
+};
+
+}
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBKeyPathBackendImpl_h
diff --git a/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
index e5e0b0d..549d0fa 100755
--- a/WebCore/storage/IDBObjectStoreBackendImpl.cpp
+++ b/WebCore/storage/IDBObjectStoreBackendImpl.cpp
@@ -33,6 +33,8 @@
 #include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseException.h"
 #include "IDBIndexBackendImpl.h"
+#include "IDBKeyPath.h"
+#include "IDBKeyPathBackendImpl.h"
 #include "IDBKeyRange.h"
 #include "SQLiteDatabase.h"
 #include "SQLiteStatement.h"
@@ -124,18 +126,25 @@ void IDBObjectStoreBackendImpl::get(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallba
     ASSERT(query.step() != SQLResultRow);
 }
 
-void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
+void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
 {
+    RefPtr<SerializedScriptValue> value = prpValue;
     RefPtr<IDBKey> key = prpKey;
 
     if (!m_keyPath.isNull()) {
         if (key) {
-            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "A key was supplied for an objectStore that has a keyPath.")); 
+            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "A key was supplied for an objectStore that has a keyPath."));
             return;
         }
-        ASSERT_NOT_REACHED();
-        callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "FIXME: keyPath not yet supported."));
-        return;
+        Vector<RefPtr<SerializedScriptValue> > values;
+        values.append(value);
+        Vector<RefPtr<IDBKey> > idbKeys;
+        IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(values, m_keyPath, idbKeys);
+        if (idbKeys.isEmpty()) {
+            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "An invalid keyPath was supplied for an objectStore."));
+            return;
+        }
+        key = idbKeys[0];
     }
 
     if (!key) {
diff --git a/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp b/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp
new file mode 100644
index 0000000..0f10875
--- /dev/null
+++ b/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBKeyPathBackendImpl.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "ChromiumBridge.h"
+
+namespace WebCore {
+
+void IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue>, 0>& values,  const String& keyPath, Vector<RefPtr<IDBKey>, 0>& keys)
+{
+    ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(values, keyPath, keys);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 00dd4a4..45f6064 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-24  Marcus Bulach  <bulach at chromium.org>
+
+        Reviewed by Jeremy Orlow.
+
+        Hooks IDBKeyPath with IDBObjectStorage::put.
+        https://bugs.webkit.org/show_bug.cgi?id=44275
+
+        Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
+        during IDBObjectStorage::put.
+
+        * public/WebIDBKey.h:
+        (WebKit::WebIDBKey::WebIDBKey):
+        * public/WebKitClient.h:
+        (WebKit::WebKitClient::createIDBKeysFromSerializedValuesAndKeyPath):
+        * src/ChromiumBridge.cpp:
+        (WebCore::ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath):
+
 2010-08-24  Kent Tamura  <tkent at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebKit/chromium/public/WebIDBKey.h b/WebKit/chromium/public/WebIDBKey.h
index 32caa10..6aef332 100644
--- a/WebKit/chromium/public/WebIDBKey.h
+++ b/WebKit/chromium/public/WebIDBKey.h
@@ -39,6 +39,8 @@ class WebSerializedScriptValue;
 
 class WebIDBKey {
 public:
+    // Please use one of the factory methods. This is public only to allow WebVector.
+    WebIDBKey() { }
     ~WebIDBKey() { reset(); }
   
     WEBKIT_API static WebIDBKey createNull();
@@ -80,7 +82,6 @@ public:
 #endif
 
 private:
-    WebIDBKey() { }
 
     WebPrivatePtr<WebCore::IDBKey> m_private;
 };
diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h
index 17a39c5..9c0b4c2 100644
--- a/WebKit/chromium/public/WebKitClient.h
+++ b/WebKit/chromium/public/WebKitClient.h
@@ -35,6 +35,7 @@
 #include "WebData.h"
 #include "WebLocalizedString.h"
 #include "WebString.h"
+#include "WebVector.h"
 #include "WebURL.h"
 
 #include <time.h>
@@ -55,10 +56,12 @@ class WebFileUtilities;
 class WebGLES2Context;
 class WebGraphicsContext3D;
 class WebIDBFactory;
+class WebIDBKey;
 class WebMessagePortChannel;
 class WebMimeRegistry;
 class WebPluginListBuilder;
 class WebSandboxSupport;
+class WebSerializedScriptValue;
 class WebSharedWorkerRepository;
 class WebSocketStreamHandle;
 class WebStorageNamespace;
@@ -139,6 +142,7 @@ public:
     // Indexed Database ----------------------------------------------------
 
     virtual WebIDBFactory* idbFactory() { return 0; }
+    virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values,  const WebString& keyPath, WebVector<WebIDBKey>& keys) { }
 
 
     // Keygen --------------------------------------------------------------
diff --git a/WebKit/chromium/src/ChromiumBridge.cpp b/WebKit/chromium/src/ChromiumBridge.cpp
index 5b18e82..33f405d 100644
--- a/WebKit/chromium/src/ChromiumBridge.cpp
+++ b/WebKit/chromium/src/ChromiumBridge.cpp
@@ -44,6 +44,7 @@
 #include "WebFileUtilities.h"
 #include "WebFrameClient.h"
 #include "WebFrameImpl.h"
+#include "WebIDBKey.h"
 #include "WebImage.h"
 #include "WebKit.h"
 #include "WebKitClient.h"
@@ -51,6 +52,7 @@
 #include "WebPluginContainerImpl.h"
 #include "WebPluginListBuilderImpl.h"
 #include "WebSandboxSupport.h"
+#include "WebSerializedScriptValue.h"
 #include "WebScreenInfo.h"
 #include "WebString.h"
 #include "WebURL.h"
@@ -500,6 +502,18 @@ PassRefPtr<IDBFactoryBackendInterface> ChromiumBridge::idbFactory()
     return IDBFactoryBackendProxy::create();
 }
 
+void ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys)
+{
+    WebVector<WebSerializedScriptValue> webValues = values;
+    WebVector<WebIDBKey> webKeys;
+    webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys);
+
+    size_t webKeysSize = webKeys.size();
+    keys.reserveCapacity(webKeysSize);
+    for (size_t i = 0; i < webKeysSize; ++i)
+        keys.append(PassRefPtr<IDBKey>(webKeys[i]));
+}
+
 // Keygen ---------------------------------------------------------------------
 
 String ChromiumBridge::signedPublicKeyAndChallengeString(

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list