2010-08-03  Andrei Popescu  <andreip@google.com>

        Reviewed by Jeremy Orlow.

        [IndexedDB] IDBObjectStoreRequest should be called IDBObjectStore
        https://bugs.webkit.org/show_bug.cgi?id=43420

        Renaming IDBObjectStoreRequest to IDBObjectStore.

        No new tests needed, just refactoring.

        * Android.derived.jscbindings.mk:
        * Android.derived.v8bindings.mk:
        * Android.mk:
        * CMakeLists.txt:
        * DerivedSources.cpp:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSIDBAnyCustom.cpp:
        (WebCore::toJS):
        * bindings/v8/custom/V8IDBAnyCustom.cpp:
        (WebCore::toV8):
        * storage/IDBAny.cpp:
        (WebCore::IDBAny::idbObjectStore):
        (WebCore::IDBAny::set):
        * storage/IDBAny.h:
        (WebCore::IDBAny::):
        * storage/IDBCallbacks.h:
        * storage/IDBDatabase.cpp:
        (WebCore::IDBDatabase::objectStore):
        * storage/IDBDatabase.h:
        * storage/IDBDatabaseBackendImpl.cpp:
        (WebCore::IDBDatabaseBackendImpl::createObjectStore):
        (WebCore::IDBDatabaseBackendImpl::objectStore):
        * storage/IDBDatabaseBackendImpl.h:
        * storage/IDBDatabaseBackendInterface.h:
        * storage/IDBObjectStore.cpp: Added.
        (WebCore::IDBObjectStore::IDBObjectStore):
        (WebCore::IDBObjectStore::name):
        (WebCore::IDBObjectStore::keyPath):
        (WebCore::IDBObjectStore::indexNames):
        (WebCore::IDBObjectStore::get):
        (WebCore::IDBObjectStore::add):
        (WebCore::IDBObjectStore::put):
        (WebCore::IDBObjectStore::remove):
        (WebCore::IDBObjectStore::createIndex):
        (WebCore::IDBObjectStore::index):
        (WebCore::IDBObjectStore::removeIndex):
        * storage/IDBObjectStore.h:
        (WebCore::IDBObjectStore::create):
        (WebCore::IDBObjectStore::~IDBObjectStore):
        * storage/IDBObjectStore.idl: Added.
        * storage/IDBObjectStoreBackendImpl.cpp: Added.
        (WebCore::IDBObjectStoreBackendImpl::~IDBObjectStoreBackendImpl):
        (WebCore::IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl):
        (WebCore::IDBObjectStoreBackendImpl::indexNames):
        (WebCore::IDBObjectStoreBackendImpl::get):
        (WebCore::IDBObjectStoreBackendImpl::put):
        (WebCore::IDBObjectStoreBackendImpl::remove):
        (WebCore::IDBObjectStoreBackendImpl::createIndex):
        (WebCore::IDBObjectStoreBackendImpl::index):
        (WebCore::IDBObjectStoreBackendImpl::removeIndex):
        * storage/IDBObjectStoreBackendImpl.h: Added.
        (WebCore::IDBObjectStoreBackendImpl::create):
        (WebCore::IDBObjectStoreBackendImpl::name):
        (WebCore::IDBObjectStoreBackendImpl::keyPath):
        * storage/IDBObjectStoreBackendInterface.h: Added.
        (WebCore::IDBObjectStoreBackendInterface::~IDBObjectStoreBackendInterface):
        * storage/IDBObjectStoreImpl.cpp: Removed.
        * storage/IDBObjectStoreImpl.h: Removed.
        * storage/IDBObjectStoreRequest.cpp: Removed.
        * storage/IDBObjectStoreRequest.h: Removed.
        * storage/IDBObjectStoreRequest.idl: Removed.
        * storage/IDBRequest.cpp:
        (WebCore::IDBRequest::onSuccess):
        * storage/IDBRequest.h:
2010-08-03  Andrei Popescu  <andreip@google.com>

        Reviewed by Jeremy Orlow.

        [IndexedDB] IDBObjectStoreRequest should be called IDBObjectStore
        https://bugs.webkit.org/show_bug.cgi?id=43420

        * src/IDBCallbacksProxy.cpp:
        (WebCore::IDBCallbacksProxy::onSuccess):
        * src/IDBCallbacksProxy.h:
        * src/IDBDatabaseProxy.cpp:
        (WebCore::IDBDatabaseProxy::objectStore):
        * src/IDBDatabaseProxy.h:
        * src/IDBObjectStoreProxy.cpp:
        (WebCore::IDBObjectStoreProxy::create):
        * src/IDBObjectStoreProxy.h:
        * src/WebIDBObjectStoreImpl.cpp:
        (WebKit::WebIDBObjectStoreImpl::WebIDBObjectStoreImpl):
        * src/WebIDBObjectStoreImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/storage/IDBObjectStore.cpp b/WebCore/storage/IDBObjectStore.cpp
new file mode 100644
index 0000000..4b1de0a
--- /dev/null
+++ b/WebCore/storage/IDBObjectStore.cpp
@@ -0,0 +1,113 @@
+/*
+ * 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 "IDBObjectStore.h"
+
+#include "DOMStringList.h"
+#include "IDBAny.h"
+#include "IDBIndex.h"
+#include "IDBKey.h"
+#include "SerializedScriptValue.h"
+#include <wtf/UnusedParam.h>
+
+#if ENABLE(INDEXED_DATABASE)
+
+namespace WebCore {
+
+IDBObjectStore::IDBObjectStore(PassRefPtr<IDBObjectStoreBackendInterface> idbObjectStore)
+    : m_objectStore(idbObjectStore)
+{
+    // We pass a reference to this object before it can be adopted.
+    relaxAdoptionRequirement();
+}
+
+String IDBObjectStore::name() const
+{
+    return m_objectStore->name();
+}
+
+String IDBObjectStore::keyPath() const
+{
+    return m_objectStore->keyPath();
+}
+
+PassRefPtr<DOMStringList> IDBObjectStore::indexNames() const
+{
+    return m_objectStore->indexNames();
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->get(key, request);
+    return request;
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::add(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->put(value, key, true, request);
+    return request;
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::put(ScriptExecutionContext* context, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->put(value, key, false, request);
+    return request;
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::remove(ScriptExecutionContext* context, PassRefPtr<IDBKey> key)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->remove(key, request);
+    return request;
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::createIndex(ScriptExecutionContext* context, const String& name, const String& keyPath, bool unique)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->createIndex(name, keyPath, unique, request);
+    return request;
+}
+
+PassRefPtr<IDBIndex> IDBObjectStore::index(const String& name)
+{
+    RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name);
+    ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR.
+    return IDBIndex::create(index.release());
+}
+
+PassRefPtr<IDBRequest> IDBObjectStore::removeIndex(ScriptExecutionContext* context, const String& name)
+{
+    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this));
+    m_objectStore->removeIndex(name, request);
+    return request;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)