Bug 574811 - Rename IDBObjectStoreRequest to IDBObjectStore

Updating interface names per recent specification changes.
r=bent

--HG--
rename : dom/indexedDB/IDBObjectStoreRequest.cpp => dom/indexedDB/IDBObjectStore.cpp
rename : dom/indexedDB/IDBObjectStoreRequest.h => dom/indexedDB/IDBObjectStore.h
This commit is contained in:
Shawn Wilsher 2010-06-28 11:51:06 -07:00
Родитель 0c837d8334
Коммит c4b3932911
18 изменённых файлов: 199 добавлений и 255 удалений

Просмотреть файл

@ -483,7 +483,7 @@ using namespace mozilla::dom;
#include "mozilla/dom/indexedDB/IDBRequest.h"
#include "mozilla/dom/indexedDB/IDBDatabase.h"
#include "mozilla/dom/indexedDB/IDBEvents.h"
#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
#include "mozilla/dom/indexedDB/IDBTransaction.h"
#include "mozilla/dom/indexedDB/IDBCursorRequest.h"
#include "mozilla/dom/indexedDB/IDBKeyRange.h"
@ -1430,7 +1430,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBTransactionEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBObjectStoreRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBObjectStore, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBTransaction, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -3956,8 +3956,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBObjectStoreRequest, nsIIDBObjectStoreRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStoreRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBObjectStore, nsIIDBObjectStore)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStore)
DOM_CLASSINFO_MAP_END

Просмотреть файл

@ -486,7 +486,7 @@ DOMCI_CLASS(IDBDatabase)
DOMCI_CLASS(IDBErrorEvent)
DOMCI_CLASS(IDBSuccessEvent)
DOMCI_CLASS(IDBTransactionEvent)
DOMCI_CLASS(IDBObjectStoreRequest)
DOMCI_CLASS(IDBObjectStore)
DOMCI_CLASS(IDBTransaction)
DOMCI_CLASS(IDBCursorRequest)
DOMCI_CLASS(IDBKeyRange)

Просмотреть файл

@ -43,7 +43,7 @@
// Only meant to be included in IndexedDB source files, not exported.
#include "IndexedDatabase.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
BEGIN_INDEXEDDB_NAMESPACE

Просмотреть файл

@ -58,7 +58,7 @@
#include "DatabaseInfo.h"
#include "IDBEvents.h"
#include "IDBIndexRequest.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
#include "IDBTransaction.h"
#include "Savepoint.h"
#include "TransactionThreadPool.h"
@ -143,7 +143,7 @@ END_INDEXEDDB_NAMESPACE
already_AddRefed<IDBCursorRequest>
IDBCursorRequest::Create(IDBRequest* aRequest,
IDBTransaction* aTransaction,
IDBObjectStoreRequest* aObjectStore,
IDBObjectStore* aObjectStore,
PRUint16 aDirection,
nsTArray<KeyValuePair>& aData)
{
@ -420,7 +420,7 @@ IDBCursorRequest::Continue(nsIVariant* aKey,
}
Key key;
nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
nsresult rv = IDBObjectStore::GetKeyFromVariant(aKey, key);
NS_ENSURE_SUCCESS(rv, rv);
if (key.IsNull()) {
@ -571,9 +571,9 @@ IDBCursorRequest::Update(nsIVariant* aValue,
}
nsTArray<IndexUpdateInfo> indexUpdateInfo;
rv = IDBObjectStoreRequest::GetIndexUpdateInfo(mObjectStore->GetObjectStoreInfo(),
cx, clone.value(),
indexUpdateInfo);
rv = IDBObjectStore::GetIndexUpdateInfo(mObjectStore->GetObjectStoreInfo(),
cx, clone.value(),
indexUpdateInfo);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIJSON> json(new nsJSON());
@ -671,9 +671,9 @@ UpdateHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
// Update our indexes if needed.
if (!mIndexUpdateInfo.IsEmpty()) {
PRInt64 objectDataId = mAutoIncrement ? mKey.IntValue() : LL_MININT;
rv = IDBObjectStoreRequest::UpdateIndexes(mTransaction, mOSID, mKey,
mAutoIncrement, true,
objectDataId, mIndexUpdateInfo);
rv = IDBObjectStore::UpdateIndexes(mTransaction, mOSID, mKey,
mAutoIncrement, true,
objectDataId, mIndexUpdateInfo);
if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
return nsIIDBDatabaseException::CONSTRAINT_ERR;
}

Просмотреть файл

@ -40,7 +40,7 @@
#ifndef mozilla_dom_indexeddb_idbcursorrequest_h__
#define mozilla_dom_indexeddb_idbcursorrequest_h__
#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
#include "nsIIDBCursorRequest.h"
#include "jsapi.h"
@ -51,7 +51,7 @@ BEGIN_INDEXEDDB_NAMESPACE
class IDBIndexRequest;
class IDBRequest;
class IDBObjectStoreRequest;
class IDBObjectStore;
class IDBTransaction;
struct KeyValuePair
@ -82,7 +82,7 @@ public:
already_AddRefed<IDBCursorRequest>
Create(IDBRequest* aRequest,
IDBTransaction* aTransaction,
IDBObjectStoreRequest* aObjectStore,
IDBObjectStore* aObjectStore,
PRUint16 aDirection,
nsTArray<KeyValuePair>& aData);
@ -121,7 +121,7 @@ protected:
nsRefPtr<IDBRequest> mRequest;
nsRefPtr<IDBTransaction> mTransaction;
nsRefPtr<IDBObjectStoreRequest> mObjectStore;
nsRefPtr<IDBObjectStore> mObjectStore;
nsRefPtr<IDBIndexRequest> mIndex;
PRUint16 mDirection;

Просмотреть файл

@ -49,7 +49,7 @@
#include "AsyncConnectionHelper.h"
#include "DatabaseInfo.h"
#include "IDBEvents.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
#include "IDBTransaction.h"
#include "IDBFactory.h"
#include "LazyIdleThread.h"
@ -625,7 +625,7 @@ NS_IMETHODIMP
IDBDatabase::ObjectStore(const nsAString& aName,
PRUint16 aMode,
PRUint8 aOptionalArgCount,
nsIIDBObjectStoreRequest** _retval)
nsIIDBObjectStore** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -767,7 +767,7 @@ CreateObjectStoreHelper::GetSuccessResult(nsIWritableVariant* aResult)
}
info.forget();
nsCOMPtr<nsIIDBObjectStoreRequest> result;
nsCOMPtr<nsIIDBObjectStore> result;
nsresult rv = mTransaction->ObjectStore(mName, getter_AddRefs(result));
NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);

Просмотреть файл

@ -53,7 +53,7 @@
#include "jsapi.h"
#include "nsDOMEvent.h"
#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
#define SUCCESS_EVT_STR "success"
#define ERROR_EVT_STR "error"

Просмотреть файл

@ -50,7 +50,7 @@
#include "AsyncConnectionHelper.h"
#include "IDBCursorRequest.h"
#include "IDBEvents.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
#include "IDBTransaction.h"
#include "DatabaseInfo.h"
@ -227,7 +227,7 @@ private:
// static
already_AddRefed<IDBIndexRequest>
IDBIndexRequest::Create(IDBObjectStoreRequest* aObjectStore,
IDBIndexRequest::Create(IDBObjectStore* aObjectStore,
const IndexInfo* aIndexInfo)
{
NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
@ -315,7 +315,7 @@ IDBIndexRequest::Get(nsIVariant* aKey,
NS_WARNING("Using a slow path for Get! Fix this now!");
Key key;
nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
nsresult rv = IDBObjectStore::GetKeyFromVariant(aKey, key);
NS_ENSURE_SUCCESS(rv, rv);
if (key.IsUnset() || key.IsNull()) {
@ -344,7 +344,7 @@ IDBIndexRequest::GetObject(nsIVariant* aKey,
NS_WARNING("Using a slow path for Get! Fix this now!");
Key key;
nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
nsresult rv = IDBObjectStore::GetKeyFromVariant(aKey, key);
NS_ENSURE_SUCCESS(rv, rv);
if (key.IsUnset() || key.IsNull()) {
@ -373,7 +373,7 @@ IDBIndexRequest::GetAll(nsIVariant* aKey,
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Key key;
nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
nsresult rv = IDBObjectStore::GetKeyFromVariant(aKey, key);
NS_ENSURE_SUCCESS(rv, rv);
if (key.IsNull()) {
@ -406,7 +406,7 @@ IDBIndexRequest::GetAllObjects(nsIVariant* aKey,
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
Key key;
nsresult rv = IDBObjectStoreRequest::GetKeyFromVariant(aKey, key);
nsresult rv = IDBObjectStore::GetKeyFromVariant(aKey, key);
NS_ENSURE_SUCCESS(rv, rv);
if (key.IsNull()) {
@ -455,13 +455,13 @@ IDBIndexRequest::OpenCursor(nsIIDBKeyRange* aKeyRange,
rv = aKeyRange->GetLeft(getter_AddRefs(variant));
NS_ENSURE_SUCCESS(rv, rv);
rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, leftKey);
rv = IDBObjectStore::GetKeyFromVariant(variant, leftKey);
NS_ENSURE_SUCCESS(rv, rv);
rv = aKeyRange->GetRight(getter_AddRefs(variant));
NS_ENSURE_SUCCESS(rv, rv);
rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, rightKey);
rv = IDBObjectStore::GetKeyFromVariant(variant, rightKey);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -522,13 +522,13 @@ IDBIndexRequest::OpenObjectCursor(nsIIDBKeyRange* aKeyRange,
rv = aKeyRange->GetLeft(getter_AddRefs(variant));
NS_ENSURE_SUCCESS(rv, rv);
rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, leftKey);
rv = IDBObjectStore::GetKeyFromVariant(variant, leftKey);
NS_ENSURE_SUCCESS(rv, rv);
rv = aKeyRange->GetRight(getter_AddRefs(variant));
NS_ENSURE_SUCCESS(rv, rv);
rv = IDBObjectStoreRequest::GetKeyFromVariant(variant, rightKey);
rv = IDBObjectStore::GetKeyFromVariant(variant, rightKey);
NS_ENSURE_SUCCESS(rv, rv);
}

Просмотреть файл

@ -46,7 +46,7 @@
BEGIN_INDEXEDDB_NAMESPACE
class IDBObjectStoreRequest;
class IDBObjectStore;
struct IndexInfo;
class IDBIndexRequest : public IDBRequest::Generator,
@ -58,10 +58,10 @@ public:
NS_DECL_NSIIDBINDEXREQUEST
static already_AddRefed<IDBIndexRequest>
Create(IDBObjectStoreRequest* aObjectStore,
Create(IDBObjectStore* aObjectStore,
const IndexInfo* aIndexInfo);
IDBObjectStoreRequest* ObjectStore()
IDBObjectStore* ObjectStore()
{
return mObjectStore;
}
@ -71,7 +71,7 @@ protected:
~IDBIndexRequest();
private:
nsRefPtr<IDBObjectStoreRequest> mObjectStore;
nsRefPtr<IDBObjectStore> mObjectStore;
PRInt64 mId;
nsString mName;

Просмотреть файл

@ -44,7 +44,7 @@
#include "nsJSON.h"
#include "IDBEvents.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
#include "IDBIndexRequest.h"
#include "nsIIDBDatabaseException.h"
@ -160,7 +160,7 @@ class OpenCursorHelper : public AsyncConnectionHelper
public:
OpenCursorHelper(IDBTransaction* aTransaction,
IDBRequest* aRequest,
IDBObjectStoreRequest* aObjectStore,
IDBObjectStore* aObjectStore,
const Key& aLeftKey,
const Key& aRightKey,
PRUint16 aKeyRangeFlags,
@ -176,7 +176,7 @@ public:
private:
// In-params.
nsRefPtr<IDBObjectStoreRequest> mObjectStore;
nsRefPtr<IDBObjectStore> mObjectStore;
const Key mLeftKey;
const Key mRightKey;
const PRUint16 mKeyRangeFlags;
@ -196,7 +196,7 @@ public:
const nsAString& aKeyPath,
bool aUnique,
bool aAutoIncrement,
IDBObjectStoreRequest* aObjectStore)
IDBObjectStore* aObjectStore)
: AsyncConnectionHelper(aTransaction, aRequest), mName(aName),
mKeyPath(aKeyPath), mUnique(aUnique), mAutoIncrement(aAutoIncrement),
mObjectStore(aObjectStore), mId(LL_MININT)
@ -213,7 +213,7 @@ private:
nsString mKeyPath;
const bool mUnique;
const bool mAutoIncrement;
nsRefPtr<IDBObjectStoreRequest> mObjectStore;
nsRefPtr<IDBObjectStore> mObjectStore;
// Out-params.
PRInt64 mId;
@ -225,7 +225,7 @@ public:
RemoveIndexHelper(IDBTransaction* aDatabase,
IDBRequest* aRequest,
const nsAString& aName,
IDBObjectStoreRequest* aObjectStore)
IDBObjectStore* aObjectStore)
: AsyncConnectionHelper(aDatabase, aRequest), mName(aName),
mObjectStore(aObjectStore)
{ }
@ -236,7 +236,7 @@ public:
private:
// In-params
nsString mName;
nsRefPtr<IDBObjectStoreRequest> mObjectStore;
nsRefPtr<IDBObjectStore> mObjectStore;
};
class GetAllHelper : public AsyncConnectionHelper
@ -321,15 +321,15 @@ GetKeyFromObject(JSContext* aCx,
} // anonymous namespace
// static
already_AddRefed<IDBObjectStoreRequest>
IDBObjectStoreRequest::Create(IDBDatabase* aDatabase,
IDBTransaction* aTransaction,
const ObjectStoreInfo* aStoreInfo,
PRUint16 aMode)
already_AddRefed<IDBObjectStore>
IDBObjectStore::Create(IDBDatabase* aDatabase,
IDBTransaction* aTransaction,
const ObjectStoreInfo* aStoreInfo,
PRUint16 aMode)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsRefPtr<IDBObjectStoreRequest> objectStore = new IDBObjectStoreRequest();
nsRefPtr<IDBObjectStore> objectStore = new IDBObjectStore();
objectStore->mDatabase = aDatabase;
objectStore->mTransaction = aTransaction;
@ -345,8 +345,8 @@ IDBObjectStoreRequest::Create(IDBDatabase* aDatabase,
// static
nsresult
IDBObjectStoreRequest::GetKeyFromVariant(nsIVariant* aKeyVariant,
Key& aKey)
IDBObjectStore::GetKeyFromVariant(nsIVariant* aKeyVariant,
Key& aKey)
{
if (!aKeyVariant) {
aKey = Key::UNSETKEY;
@ -387,8 +387,8 @@ IDBObjectStoreRequest::GetKeyFromVariant(nsIVariant* aKeyVariant,
// static
nsresult
IDBObjectStoreRequest::GetJSONFromArg0(/* jsval arg0, */
nsAString& aJSON)
IDBObjectStore::GetJSONFromArg0(/* jsval arg0, */
nsAString& aJSON)
{
nsIXPConnect* xpc = nsContentUtils::XPConnect();
NS_ENSURE_TRUE(xpc, NS_ERROR_UNEXPECTED);
@ -432,10 +432,10 @@ IDBObjectStoreRequest::GetJSONFromArg0(/* jsval arg0, */
// static
nsresult
IDBObjectStoreRequest::GetKeyPathValueFromJSON(const nsAString& aJSON,
const nsAString& aKeyPath,
JSContext** aCx,
Key& aValue)
IDBObjectStore::GetKeyPathValueFromJSON(const nsAString& aJSON,
const nsAString& aKeyPath,
JSContext** aCx,
Key& aValue)
{
NS_ASSERTION(!aJSON.IsEmpty(), "Empty JSON!");
NS_ASSERTION(!aKeyPath.IsEmpty(), "Empty keyPath!");
@ -492,10 +492,10 @@ IDBObjectStoreRequest::GetKeyPathValueFromJSON(const nsAString& aJSON,
/* static */
nsresult
IDBObjectStoreRequest::GetIndexUpdateInfo(ObjectStoreInfo* aObjectStoreInfo,
JSContext* aCx,
jsval aObject,
nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
IDBObjectStore::GetIndexUpdateInfo(ObjectStoreInfo* aObjectStoreInfo,
JSContext* aCx,
jsval aObject,
nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
{
JSObject* cloneObj = nsnull;
@ -559,13 +559,13 @@ IDBObjectStoreRequest::GetIndexUpdateInfo(ObjectStoreInfo* aObjectStoreInfo,
/* static */
nsresult
IDBObjectStoreRequest::UpdateIndexes(IDBTransaction* aTransaction,
PRInt64 aObjectStoreId,
const Key& aObjectStoreKey,
bool aAutoIncrement,
bool aOverwrite,
PRInt64 aObjectDataId,
const nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
IDBObjectStore::UpdateIndexes(IDBTransaction* aTransaction,
PRInt64 aObjectStoreId,
const Key& aObjectStoreKey,
bool aAutoIncrement,
bool aOverwrite,
PRInt64 aObjectDataId,
const nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
{
#ifdef DEBUG
if (aAutoIncrement) {
@ -682,7 +682,7 @@ IDBObjectStoreRequest::UpdateIndexes(IDBTransaction* aTransaction,
}
ObjectStoreInfo*
IDBObjectStoreRequest::GetObjectStoreInfo()
IDBObjectStore::GetObjectStoreInfo()
{
NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
@ -694,7 +694,7 @@ IDBObjectStoreRequest::GetObjectStoreInfo()
return info;
}
IDBObjectStoreRequest::IDBObjectStoreRequest()
IDBObjectStore::IDBObjectStore()
: mId(LL_MININT),
mAutoIncrement(PR_FALSE),
mMode(nsIIDBTransaction::READ_WRITE)
@ -702,17 +702,17 @@ IDBObjectStoreRequest::IDBObjectStoreRequest()
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
}
IDBObjectStoreRequest::~IDBObjectStoreRequest()
IDBObjectStore::~IDBObjectStore()
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
}
nsresult
IDBObjectStoreRequest::GetAddInfo(/* jsval aValue, */
nsIVariant* aKeyVariant,
nsString& aJSON,
Key& aKey,
nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
IDBObjectStore::GetAddInfo(/* jsval aValue, */
nsIVariant* aKeyVariant,
nsString& aJSON,
Key& aKey,
nsTArray<IndexUpdateInfo>& aUpdateInfoArray)
{
// This is the slow path, need to do this better once XPIDL can have raw
// jsvals as arguments.
@ -795,20 +795,19 @@ IDBObjectStoreRequest::GetAddInfo(/* jsval aValue, */
return NS_OK;
}
NS_IMPL_ADDREF(IDBObjectStoreRequest)
NS_IMPL_RELEASE(IDBObjectStoreRequest)
NS_IMPL_ADDREF(IDBObjectStore)
NS_IMPL_RELEASE(IDBObjectStore)
NS_INTERFACE_MAP_BEGIN(IDBObjectStoreRequest)
NS_INTERFACE_MAP_BEGIN(IDBObjectStore)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, IDBRequest::Generator)
NS_INTERFACE_MAP_ENTRY(nsIIDBObjectStoreRequest)
NS_INTERFACE_MAP_ENTRY(nsIIDBObjectStore)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBObjectStoreRequest)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(IDBObjectStore)
NS_INTERFACE_MAP_END
DOMCI_DATA(IDBObjectStoreRequest, IDBObjectStoreRequest)
DOMCI_DATA(IDBObjectStore, IDBObjectStore)
NS_IMETHODIMP
IDBObjectStoreRequest::GetName(nsAString& aName)
IDBObjectStore::GetName(nsAString& aName)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -817,7 +816,7 @@ IDBObjectStoreRequest::GetName(nsAString& aName)
}
NS_IMETHODIMP
IDBObjectStoreRequest::GetKeyPath(nsAString& aKeyPath)
IDBObjectStore::GetKeyPath(nsAString& aKeyPath)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -826,7 +825,7 @@ IDBObjectStoreRequest::GetKeyPath(nsAString& aKeyPath)
}
NS_IMETHODIMP
IDBObjectStoreRequest::GetIndexNames(nsIDOMDOMStringList** aIndexNames)
IDBObjectStore::GetIndexNames(nsIDOMDOMStringList** aIndexNames)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -846,8 +845,8 @@ IDBObjectStoreRequest::GetIndexNames(nsIDOMDOMStringList** aIndexNames)
}
NS_IMETHODIMP
IDBObjectStoreRequest::Get(nsIVariant* aKey,
nsIIDBRequest** _retval)
IDBObjectStore::Get(nsIVariant* aKey,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -876,10 +875,10 @@ IDBObjectStoreRequest::Get(nsIVariant* aKey,
}
NS_IMETHODIMP
IDBObjectStoreRequest::GetAll(nsIIDBKeyRange* aKeyRange,
PRUint32 aLimit,
PRUint8 aOptionalArgCount,
nsIIDBRequest** _retval)
IDBObjectStore::GetAll(nsIIDBKeyRange* aKeyRange,
PRUint32 aLimit,
PRUint8 aOptionalArgCount,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -928,9 +927,9 @@ IDBObjectStoreRequest::GetAll(nsIIDBKeyRange* aKeyRange,
}
NS_IMETHODIMP
IDBObjectStoreRequest::Add(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
IDBObjectStore::Add(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -969,9 +968,9 @@ IDBObjectStoreRequest::Add(nsIVariant* /* aValue */,
}
NS_IMETHODIMP
IDBObjectStoreRequest::Modify(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
IDBObjectStore::Modify(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -1010,9 +1009,9 @@ IDBObjectStoreRequest::Modify(nsIVariant* /* aValue */,
}
NS_IMETHODIMP
IDBObjectStoreRequest::AddOrModify(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
IDBObjectStore::AddOrModify(nsIVariant* /* aValue */,
nsIVariant* aKey,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -1051,8 +1050,8 @@ IDBObjectStoreRequest::AddOrModify(nsIVariant* /* aValue */,
}
NS_IMETHODIMP
IDBObjectStoreRequest::Remove(nsIVariant* aKey,
nsIIDBRequest** _retval)
IDBObjectStore::Remove(nsIVariant* aKey,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -1087,11 +1086,11 @@ IDBObjectStoreRequest::Remove(nsIVariant* aKey,
}
NS_IMETHODIMP
IDBObjectStoreRequest::OpenCursor(nsIIDBKeyRange* aKeyRange,
PRUint16 aDirection,
PRBool aPreload,
PRUint8 aOptionalArgCount,
nsIIDBRequest** _retval)
IDBObjectStore::OpenCursor(nsIIDBKeyRange* aKeyRange,
PRUint16 aDirection,
PRBool aPreload,
PRUint8 aOptionalArgCount,
nsIIDBRequest** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -1154,10 +1153,10 @@ IDBObjectStoreRequest::OpenCursor(nsIIDBKeyRange* aKeyRange,
}
NS_IMETHODIMP
IDBObjectStoreRequest::CreateIndex(const nsAString& aName,
const nsAString& aKeyPath,
PRBool aUnique,
nsIIDBRequest** _retval)
IDBObjectStore::CreateIndex(const nsAString& aName,
const nsAString& aKeyPath,
PRBool aUnique,
nsIIDBRequest** _retval)
{
NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
@ -1204,8 +1203,8 @@ IDBObjectStoreRequest::CreateIndex(const nsAString& aName,
}
NS_IMETHODIMP
IDBObjectStoreRequest::Index(const nsAString& aName,
nsIIDBIndexRequest** _retval)
IDBObjectStore::Index(const nsAString& aName,
nsIIDBIndexRequest** _retval)
{
NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
@ -1241,8 +1240,8 @@ IDBObjectStoreRequest::Index(const nsAString& aName,
}
NS_IMETHODIMP
IDBObjectStoreRequest::RemoveIndex(const nsAString& aName,
nsIIDBRequest** _retval)
IDBObjectStore::RemoveIndex(const nsAString& aName,
nsIIDBRequest** _retval)
{
NS_PRECONDITION(NS_IsMainThread(), "Wrong thread!");
@ -1435,9 +1434,9 @@ AddHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
// Update our indexes if needed.
if (!mIndexUpdateInfo.IsEmpty()) {
PRInt64 objectDataId = mAutoIncrement ? mKey.IntValue() : LL_MININT;
rv = IDBObjectStoreRequest::UpdateIndexes(mTransaction, mOSID, mKey,
mAutoIncrement, mOverwrite,
objectDataId, mIndexUpdateInfo);
rv = IDBObjectStore::UpdateIndexes(mTransaction, mOSID, mKey,
mAutoIncrement, mOverwrite,
objectDataId, mIndexUpdateInfo);
if (rv == NS_ERROR_STORAGE_CONSTRAINT) {
return nsIIDBDatabaseException::CONSTRAINT_ERR;
}
@ -1906,8 +1905,7 @@ CreateIndexHelper::InsertDataFromObjectStore(mozIStorageConnection* aConnection)
Key key;
JSContext* cx = nsnull;
rv = IDBObjectStoreRequest::GetKeyPathValueFromJSON(json, mKeyPath, &cx,
key);
rv = IDBObjectStore::GetKeyPathValueFromJSON(json, mKeyPath, &cx, key);
// XXX this should be a constraint error maybe?
NS_ENSURE_SUCCESS(rv, nsIIDBDatabaseException::UNKNOWN_ERR);

Просмотреть файл

@ -37,14 +37,14 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_dom_indexeddb_idbobjectstorerequest_h__
#define mozilla_dom_indexeddb_idbobjectstorerequest_h__
#ifndef mozilla_dom_indexeddb_idbobjectstore_h__
#define mozilla_dom_indexeddb_idbobjectstore_h__
#include "mozilla/dom/indexedDB/IDBRequest.h"
#include "mozilla/dom/indexedDB/IDBDatabase.h"
#include "mozilla/dom/indexedDB/IDBTransaction.h"
#include "nsIIDBObjectStoreRequest.h"
#include "nsIIDBObjectStore.h"
struct JSContext;
@ -205,15 +205,14 @@ private:
PRInt64 mInt;
};
class IDBObjectStoreRequest : public IDBRequest::Generator,
public nsIIDBObjectStoreRequest
class IDBObjectStore : public IDBRequest::Generator,
public nsIIDBObjectStore
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIIDBOBJECTSTORE
NS_DECL_NSIIDBOBJECTSTOREREQUEST
static already_AddRefed<IDBObjectStoreRequest>
static already_AddRefed<IDBObjectStore>
Create(IDBDatabase* aDatabase,
IDBTransaction* aTransaction,
const ObjectStoreInfo* aInfo,
@ -282,8 +281,8 @@ public:
ObjectStoreInfo* GetObjectStoreInfo();
protected:
IDBObjectStoreRequest();
~IDBObjectStoreRequest();
IDBObjectStore();
~IDBObjectStore();
nsresult GetAddInfo(/* jsval aValue, */
nsIVariant* aKeyVariant,
@ -305,4 +304,4 @@ private:
END_INDEXEDDB_NAMESPACE
#endif // mozilla_dom_indexeddb_idbobjectstorerequest_h__
#endif // mozilla_dom_indexeddb_idbobjectstore_h__

Просмотреть файл

@ -46,7 +46,7 @@
#include "IDBEvents.h"
#include "IDBCursorRequest.h"
#include "IDBObjectStoreRequest.h"
#include "IDBObjectStore.h"
#include "IDBFactory.h"
#include "DatabaseInfo.h"
#include "TransactionThreadPool.h"
@ -621,7 +621,7 @@ IDBTransaction::GetObjectStoreNames(nsIDOMDOMStringList** aObjectStores)
NS_IMETHODIMP
IDBTransaction::ObjectStore(const nsAString& aName,
nsIIDBObjectStoreRequest** _retval)
nsIIDBObjectStore** _retval)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
@ -646,8 +646,8 @@ IDBTransaction::ObjectStore(const nsAString& aName,
return NS_ERROR_NOT_AVAILABLE;
}
nsRefPtr<IDBObjectStoreRequest> objectStore =
IDBObjectStoreRequest::Create(mDatabase, this, info, mMode);
nsRefPtr<IDBObjectStore> objectStore =
IDBObjectStore::Create(mDatabase, this, info, mMode);
NS_ENSURE_TRUE(objectStore, NS_ERROR_FAILURE);
objectStore.forget(_retval);

Просмотреть файл

@ -59,7 +59,7 @@ CPPSRCS = \
IDBEvents.cpp \
IDBIndexRequest.cpp \
IDBKeyRange.cpp \
IDBObjectStoreRequest.cpp \
IDBObjectStore.cpp \
IDBRequest.cpp \
IDBTransaction.cpp \
IDBFactory.cpp \
@ -73,7 +73,7 @@ EXPORTS_mozilla/dom/indexedDB = \
IDBEvents.h \
IDBIndexRequest.h \
IDBKeyRange.h \
IDBObjectStoreRequest.h \
IDBObjectStore.h \
IDBRequest.h \
IDBTransaction.h \
IndexedDatabase.h \
@ -102,7 +102,6 @@ XPIDLSRCS = \
nsIIDBIndexRequest.idl \
nsIIDBKeyRange.idl \
nsIIDBObjectStore.idl \
nsIIDBObjectStoreRequest.idl \
nsIIDBRequest.idl \
nsIIDBSuccessEvent.idl \
nsIIDBTransaction.idl \

Просмотреть файл

@ -40,7 +40,7 @@
#include "nsISupports.idl"
interface nsIVariant;
interface nsIIDBObjectStoreRequest;
interface nsIIDBObjectStore;
interface nsIIDBRequest;
interface nsIIDBTransaction;
interface nsIDOMDOMStringList;
@ -79,7 +79,7 @@ interface nsIIDBDatabase : nsISupports
[optional /* 5000ms */] in unsigned long timeout);
[optional_argc]
nsIIDBObjectStoreRequest
nsIIDBObjectStore
objectStore(in AString name,
[optional /* READ_ONLY */] in unsigned short mode);
};

Просмотреть файл

@ -39,14 +39,18 @@
#include "nsISupports.idl"
interface nsIIDBIndexRequest;
interface nsIIDBKeyRange;
interface nsIIDBRequest;
interface nsIVariant;
interface nsIDOMDOMStringList;
/**
* IDBObjectStore interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IDBObjectStore for more
* information.
* nsIIDBObjectStore interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-nsIIDBObjectStore
* for more information.
*/
[scriptable, uuid(783a49b0-c5f0-4d97-9349-532f4ec1f7ce)]
[scriptable, uuid(1168fc42-ac08-4720-822c-da820f00e15e)]
interface nsIIDBObjectStore : nsISupports
{
readonly attribute DOMString name;
@ -54,4 +58,55 @@ interface nsIIDBObjectStore : nsISupports
readonly attribute DOMString keyPath;
readonly attribute nsIDOMDOMStringList indexNames;
// Success fires IDBTransactionEvent, result == value for key
nsIIDBRequest
get(in nsIVariant key);
// Success fires IDBTransactionEvent, result == array of values for given keys
[optional_argc]
nsIIDBRequest
getAll([optional /* null */] in nsIIDBKeyRange key,
[optional /* unlimited */] in unsigned long limit);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
add(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
modify(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
addOrModify(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == null
nsIIDBRequest
remove(in nsIVariant key);
// Success fires IDBTransactionEvent, result == IDBCursorRequest or
// IDBCursorPreloadedRequest if preload == true. result == null if no match.
[optional_argc]
nsIIDBRequest
openCursor([optional /* null */] in nsIIDBKeyRange range,
[optional /* NEXT */] in unsigned short direction,
[optional /* false */] in boolean preload);
// Success fires IDBTransactionEvent, result == IDBIndexRequest
nsIIDBRequest
createIndex(in AString name,
in AString keyPath,
[optional /* false */] in boolean unique);
// Returns object immediately
nsIIDBIndexRequest
index(in AString name);
// Success fires IDBTransactionEvent, result == null
nsIIDBRequest
removeIndex(in AString name);
};

Просмотреть файл

@ -1,105 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIIDBObjectStore.idl"
interface nsIIDBIndexRequest;
interface nsIIDBKeyRange;
interface nsIIDBRequest;
interface nsIVariant;
/**
* nsIIDBObjectStoreRequest interface. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-nsIIDBObjectStoreRequest
* for more information.
*/
[scriptable, uuid(ce65fbc2-06a0-4f1c-89e4-0d9a636179c7)]
interface nsIIDBObjectStoreRequest : nsIIDBObjectStore
{
// Success fires IDBTransactionEvent, result == value for key
nsIIDBRequest
get(in nsIVariant key);
// Success fires IDBTransactionEvent, result == array of values for given keys
[optional_argc]
nsIIDBRequest
getAll([optional /* null */] in nsIIDBKeyRange key,
[optional /* unlimited */] in unsigned long limit);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
add(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
modify(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == key
nsIIDBRequest
addOrModify(in nsIVariant value,
[optional /* null */] in nsIVariant key);
// Success fires IDBTransactionEvent, result == null
nsIIDBRequest
remove(in nsIVariant key);
// Success fires IDBTransactionEvent, result == IDBCursorRequest or
// IDBCursorPreloadedRequest if preload == true. result == null if no match.
[optional_argc]
nsIIDBRequest
openCursor([optional /* null */] in nsIIDBKeyRange range,
[optional /* NEXT */] in unsigned short direction,
[optional /* false */] in boolean preload);
// Success fires IDBTransactionEvent, result == IDBIndexRequest
nsIIDBRequest
createIndex(in AString name,
in AString keyPath,
[optional /* false */] in boolean unique);
// Returns object immediately
nsIIDBIndexRequest
index(in AString name);
// Success fires IDBTransactionEvent, result == null
nsIIDBRequest
removeIndex(in AString name);
};

Просмотреть файл

@ -40,7 +40,7 @@
#include "nsISupports.idl"
interface nsIDOMEventListener;
interface nsIIDBObjectStoreRequest;
interface nsIIDBObjectStore;
interface nsIIDBRequest;
interface nsIIDBDatabase;
interface nsIDOMDOMStringList;
@ -67,7 +67,7 @@ interface nsIIDBTransaction : nsISupports
readonly attribute nsIDOMDOMStringList objectStoreNames;
nsIIDBObjectStoreRequest
nsIIDBObjectStore
objectStore(in AString name);
// Don't commit the transaction.

Просмотреть файл

@ -470,7 +470,6 @@ members = [
'nsIIDBIndexRequest.*',
'nsIIDBKeyRange.*',
'nsIIDBObjectStore.*',
'nsIIDBObjectStoreRequest.*',
'nsIIDBRequest.*',
# Remove once XPIDL can handle jsvals
# 'nsIIDBSuccessEvent.*',
@ -478,9 +477,9 @@ members = [
'nsIIDBTransactionEvent.*',
'nsIIDBFactory.*',
# Remove once XPIDL can handle jsvals
'-nsIIDBObjectStoreRequest.add',
'-nsIIDBObjectStoreRequest.modify',
'-nsIIDBObjectStoreRequest.addOrModify',
'-nsIIDBObjectStore.add',
'-nsIIDBObjectStore.modify',
'-nsIIDBObjectStore.addOrModify',
'-nsIIDBCursorRequest.continue',
'-nsIIDBCursorRequest.value',
'-nsIIDBCursorRequest.update',