Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_DataStoreCursor_h
6 #define mozilla_dom_DataStoreCursor_h
8 #include "nsAutoPtr.h"
9 #include "nsCOMPtr.h"
10 #include "nsCycleCollectionParticipant.h"
12 class nsPIDOMWindow;
14 namespace mozilla {
16 class ErrorResult;
18 namespace dom {
20 class Promise;
21 class DataStore;
22 class GlobalObject;
23 class DataStoreCursorImpl;
25 class DataStoreCursor MOZ_FINAL
26 {
27 public:
28 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DataStoreCursor)
29 NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(DataStoreCursor)
31 // WebIDL (internal functions)
33 static already_AddRefed<DataStoreCursor> Constructor(GlobalObject& aGlobal,
34 ErrorResult& aRv);
36 JSObject* WrapObject(JSContext *aCx);
38 // WebIDL (public APIs)
40 already_AddRefed<DataStore> GetStore(ErrorResult& aRv);
42 already_AddRefed<Promise> Next(ErrorResult& aRv);
44 void Close(ErrorResult& aRv);
46 // This internal function (ChromeOnly) is aimed to make the DataStoreCursor
47 // keep a reference to the DataStoreCursorImpl which really implements the
48 // API's logic in JS.
49 void SetDataStoreCursorImpl(DataStoreCursorImpl& aCursor);
51 protected:
52 virtual ~DataStoreCursor() {}
54 private:
55 nsRefPtr<DataStoreCursorImpl> mCursor;
56 };
58 } //namespace dom
59 } //namespace mozilla
61 #endif