/src/mozilla-central/dom/simpledb/SDBRequest.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef mozilla_dom_simpledb_SDBRequest_h |
8 | | #define mozilla_dom_simpledb_SDBRequest_h |
9 | | |
10 | | #include "nsCOMPtr.h" |
11 | | #include "nsCycleCollectionParticipant.h" |
12 | | #include "nsISDBRequest.h" |
13 | | #include "nsIVariant.h" |
14 | | |
15 | | class nsISDBCallback; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace dom { |
19 | | |
20 | | class SDBConnection; |
21 | | |
22 | | class SDBRequest final |
23 | | : public nsISDBRequest |
24 | | { |
25 | | RefPtr<SDBConnection> mConnection; |
26 | | |
27 | | nsCOMPtr<nsIVariant> mResult; |
28 | | nsCOMPtr<nsISDBCallback> mCallback; |
29 | | |
30 | | nsresult mResultCode; |
31 | | bool mHaveResultOrErrorCode; |
32 | | |
33 | | public: |
34 | | explicit SDBRequest(SDBConnection* aConnection); |
35 | | |
36 | | void |
37 | | AssertIsOnOwningThread() const |
38 | 0 | { |
39 | 0 | NS_ASSERT_OWNINGTHREAD(SDBRequest); |
40 | 0 | } |
41 | | |
42 | | SDBConnection* |
43 | | GetConnection() const |
44 | 0 | { |
45 | 0 | AssertIsOnOwningThread(); |
46 | 0 |
|
47 | 0 | return mConnection; |
48 | 0 | } |
49 | | |
50 | | void |
51 | | SetResult(nsIVariant* aResult); |
52 | | |
53 | | void |
54 | | SetError(nsresult aRv); |
55 | | |
56 | | private: |
57 | | ~SDBRequest(); |
58 | | |
59 | | void |
60 | | FireCallback(); |
61 | | |
62 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
63 | | NS_DECL_NSISDBREQUEST |
64 | | NS_DECL_CYCLE_COLLECTION_CLASS(SDBRequest) |
65 | | }; |
66 | | |
67 | | } // namespace dom |
68 | | } // namespace mozilla |
69 | | |
70 | | #endif // mozilla_dom_simpledb_SDBRequest_h |