dom/datastore/DataStoreCursor.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:0e5a9933c224
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/. */
4
5 #ifndef mozilla_dom_DataStoreCursor_h
6 #define mozilla_dom_DataStoreCursor_h
7
8 #include "nsAutoPtr.h"
9 #include "nsCOMPtr.h"
10 #include "nsCycleCollectionParticipant.h"
11
12 class nsPIDOMWindow;
13
14 namespace mozilla {
15
16 class ErrorResult;
17
18 namespace dom {
19
20 class Promise;
21 class DataStore;
22 class GlobalObject;
23 class DataStoreCursorImpl;
24
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)
30
31 // WebIDL (internal functions)
32
33 static already_AddRefed<DataStoreCursor> Constructor(GlobalObject& aGlobal,
34 ErrorResult& aRv);
35
36 JSObject* WrapObject(JSContext *aCx);
37
38 // WebIDL (public APIs)
39
40 already_AddRefed<DataStore> GetStore(ErrorResult& aRv);
41
42 already_AddRefed<Promise> Next(ErrorResult& aRv);
43
44 void Close(ErrorResult& aRv);
45
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);
50
51 protected:
52 virtual ~DataStoreCursor() {}
53
54 private:
55 nsRefPtr<DataStoreCursorImpl> mCursor;
56 };
57
58 } //namespace dom
59 } //namespace mozilla
60
61 #endif

mercurial