Changeset 65893 in webkit


Ignore:
Timestamp:
Aug 24, 2010 6:25:39 AM (14 years ago)
Author:
bulach@chromium.org
Message:

2010-08-24 Marcus Bulach <bulach@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@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):
Location:
trunk
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65891 r65893  
     12010-08-24  Marcus Bulach  <bulach@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Hooks IDBKeyPath with IDBObjectStorage::put.
     6        https://bugs.webkit.org/show_bug.cgi?id=44275
     7
     8        Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
     9        during IDBObjectStorage::put.
     10
     11        * WebCore.gyp/WebCore.gyp:
     12        * WebCore.gypi:
     13        * platform/chromium/ChromiumBridge.h:
     14        * storage/IDBKeyPathBackendImpl.cpp: Added.
     15        (IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
     16        * storage/IDBKeyPathBackendImpl.h: Added.
     17        * storage/IDBObjectStoreBackendImpl.cpp:
     18        (WebCore::IDBObjectStoreBackendImpl::put):
     19        * storage/chromium/IDBKeyPathBackendImpl.cpp: Added.
     20        (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath):
     21
    1222010-08-24  Ilya Tikhonovsky  <loislo@chromium.org>
    223
  • trunk/WebCore/WebCore.gyp/WebCore.gyp

    r65891 r65893  
    886886        '../storage/IDBFactoryBackendInterface.cpp',
    887887
     888        # Don't build IDBKeyPathBackendImpl.  We have our own implementation.
     889        '../storage/IDBKeyPathBackendImpl.cpp',
     890
    888891        # Use history/BackForwardListChromium.cpp instead.
    889892        '../history/BackForwardListImpl.cpp',
  • trunk/WebCore/WebCore.gypi

    r65821 r65893  
    35353535            'storage/chromium/DatabaseObserver.h',
    35363536            'storage/chromium/IDBFactoryBackendInterface.cpp',
     3537            'storage/chromium/IDBKeyPathBackendImpl.cpp',
    35373538            'storage/chromium/DatabaseTrackerChromium.cpp',
    35383539            'storage/chromium/QuotaTracker.cpp',
     
    35963597            'storage/IDBFactory.cpp',
    35973598            'storage/IDBFactory.h',
     3599            'storage/IDBKeyPathBackendImpl.cpp',
     3600            'storage/IDBKeyPathBackendImpl.h',
    35983601            'storage/IDBFactoryBackendInterface.cpp',
    35993602            'storage/IDBFactoryBackendInterface.h',
  • trunk/WebCore/platform/chromium/ChromiumBridge.h

    r65021 r65893  
    7373    class Image;
    7474    class IDBFactoryBackendInterface;
     75    class IDBKey;
    7576    class IntRect;
    7677    class KURL;
     78    class SerializedScriptValue;
    7779    class Widget;
    7880
     
    168170        // IndexedDB ----------------------------------------------------------
    169171        static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
     172        // Extracts keyPath from values and returns the corresponding keys.
     173        static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys);
    170174
    171175        // JavaScript ---------------------------------------------------------
  • trunk/WebCore/storage/IDBObjectStoreBackendImpl.cpp

    r65673 r65893  
    3434#include "IDBDatabaseException.h"
    3535#include "IDBIndexBackendImpl.h"
     36#include "IDBKeyPath.h"
     37#include "IDBKeyPathBackendImpl.h"
    3638#include "IDBKeyRange.h"
    3739#include "SQLiteDatabase.h"
     
    125127}
    126128
    127 void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
    128 {
     129void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, bool addOnly, PassRefPtr<IDBCallbacks> callbacks)
     130{
     131    RefPtr<SerializedScriptValue> value = prpValue;
    129132    RefPtr<IDBKey> key = prpKey;
    130133
    131134    if (!m_keyPath.isNull()) {
    132135        if (key) {
    133             callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "A key was supplied for an objectStore that has a keyPath.")); 
     136            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "A key was supplied for an objectStore that has a keyPath."));
    134137            return;
    135138        }
    136         ASSERT_NOT_REACHED();
    137         callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "FIXME: keyPath not yet supported."));
    138         return;
     139        Vector<RefPtr<SerializedScriptValue> > values;
     140        values.append(value);
     141        Vector<RefPtr<IDBKey> > idbKeys;
     142        IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(values, m_keyPath, idbKeys);
     143        if (idbKeys.isEmpty()) {
     144            callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "An invalid keyPath was supplied for an objectStore."));
     145            return;
     146        }
     147        key = idbKeys[0];
    139148    }
    140149
  • trunk/WebKit/chromium/ChangeLog

    r65881 r65893  
     12010-08-24  Marcus Bulach  <bulach@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Hooks IDBKeyPath with IDBObjectStorage::put.
     6        https://bugs.webkit.org/show_bug.cgi?id=44275
     7
     8        Adds a mechanism to extract an IDBKey from SerializedScriptValue using IDBKeyPath
     9        during IDBObjectStorage::put.
     10
     11        * public/WebIDBKey.h:
     12        (WebKit::WebIDBKey::WebIDBKey):
     13        * public/WebKitClient.h:
     14        (WebKit::WebKitClient::createIDBKeysFromSerializedValuesAndKeyPath):
     15        * src/ChromiumBridge.cpp:
     16        (WebCore::ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath):
     17
    1182010-08-24  Kent Tamura  <tkent@chromium.org>
    219
  • trunk/WebKit/chromium/public/WebIDBKey.h

    r65439 r65893  
    4040class WebIDBKey {
    4141public:
     42    // Please use one of the factory methods. This is public only to allow WebVector.
     43    WebIDBKey() { }
    4244    ~WebIDBKey() { reset(); }
    4345 
     
    8183
    8284private:
    83     WebIDBKey() { }
    8485
    8586    WebPrivatePtr<WebCore::IDBKey> m_private;
  • trunk/WebKit/chromium/public/WebKitClient.h

    r65718 r65893  
    3636#include "WebLocalizedString.h"
    3737#include "WebString.h"
     38#include "WebVector.h"
    3839#include "WebURL.h"
    3940
     
    5657class WebGraphicsContext3D;
    5758class WebIDBFactory;
     59class WebIDBKey;
    5860class WebMessagePortChannel;
    5961class WebMimeRegistry;
    6062class WebPluginListBuilder;
    6163class WebSandboxSupport;
     64class WebSerializedScriptValue;
    6265class WebSharedWorkerRepository;
    6366class WebSocketStreamHandle;
     
    140143
    141144    virtual WebIDBFactory* idbFactory() { return 0; }
     145    virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values,  const WebString& keyPath, WebVector<WebIDBKey>& keys) { }
    142146
    143147
  • trunk/WebKit/chromium/src/ChromiumBridge.cpp

    r65482 r65893  
    4545#include "WebFrameClient.h"
    4646#include "WebFrameImpl.h"
     47#include "WebIDBKey.h"
    4748#include "WebImage.h"
    4849#include "WebKit.h"
     
    5253#include "WebPluginListBuilderImpl.h"
    5354#include "WebSandboxSupport.h"
     55#include "WebSerializedScriptValue.h"
    5456#include "WebScreenInfo.h"
    5557#include "WebString.h"
     
    501503}
    502504
     505void ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys)
     506{
     507    WebVector<WebSerializedScriptValue> webValues = values;
     508    WebVector<WebIDBKey> webKeys;
     509    webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys);
     510
     511    size_t webKeysSize = webKeys.size();
     512    keys.reserveCapacity(webKeysSize);
     513    for (size_t i = 0; i < webKeysSize; ++i)
     514        keys.append(PassRefPtr<IDBKey>(webKeys[i]));
     515}
     516
    503517// Keygen ---------------------------------------------------------------------
    504518
Note: See TracChangeset for help on using the changeset viewer.