michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/dom/DataStore.h" michael@0: #include "mozilla/dom/DataStoreCursor.h" michael@0: #include "mozilla/dom/DataStoreBinding.h" michael@0: #include "mozilla/dom/DataStoreImplBinding.h" michael@0: #include "mozilla/dom/Promise.h" michael@0: #include "mozilla/ErrorResult.h" michael@0: #include "nsPIDOMWindow.h" michael@0: michael@0: namespace mozilla { michael@0: namespace dom { michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DataStoreCursor, AddRef) michael@0: NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DataStoreCursor, Release) michael@0: michael@0: NS_IMPL_CYCLE_COLLECTION(DataStoreCursor, mCursor) michael@0: michael@0: already_AddRefed michael@0: DataStoreCursor::Constructor(GlobalObject& aGlobal, ErrorResult& aRv) michael@0: { michael@0: nsRefPtr cursor = new DataStoreCursor(); michael@0: return cursor.forget(); michael@0: } michael@0: michael@0: JSObject* michael@0: DataStoreCursor::WrapObject(JSContext* aCx) michael@0: { michael@0: return DataStoreCursorBinding::Wrap(aCx, this); michael@0: } michael@0: michael@0: already_AddRefed michael@0: DataStoreCursor::GetStore(ErrorResult& aRv) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: MOZ_ASSERT(mCursor); michael@0: michael@0: return mCursor->GetStore(aRv); michael@0: } michael@0: michael@0: already_AddRefed michael@0: DataStoreCursor::Next(ErrorResult& aRv) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: MOZ_ASSERT(mCursor); michael@0: michael@0: return mCursor->Next(aRv); michael@0: } michael@0: michael@0: void michael@0: DataStoreCursor::Close(ErrorResult& aRv) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: MOZ_ASSERT(mCursor); michael@0: michael@0: mCursor->Close(aRv); michael@0: } michael@0: michael@0: void michael@0: DataStoreCursor::SetDataStoreCursorImpl(DataStoreCursorImpl& aCursor) michael@0: { michael@0: MOZ_ASSERT(NS_IsMainThread()); michael@0: MOZ_ASSERT(!mCursor); michael@0: michael@0: mCursor = &aCursor; michael@0: } michael@0: michael@0: } //namespace dom michael@0: } //namespace mozilla