Bug 1732409 let fake:true getUserMedia() parameter override loopback prefs r=jib
[gecko.git] / dom / simpledb / SDBRequest.h
blobce203cb1ced5d321f0a8fbbe132c250ea3c95cf7
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/. */
7 #ifndef mozilla_dom_simpledb_SDBRequest_h
8 #define mozilla_dom_simpledb_SDBRequest_h
10 #include <cstdint>
11 #include "ErrorList.h"
12 #include "mozilla/Assertions.h"
13 #include "mozilla/RefPtr.h"
14 #include "nsCOMPtr.h"
15 #include "nsCycleCollectionParticipant.h"
16 #include "nsISDBRequest.h"
17 #include "nsISupports.h"
19 class nsISDBCallback;
20 class nsIVariant;
22 namespace mozilla {
23 namespace dom {
25 class SDBConnection;
27 class SDBRequest final : public nsISDBRequest {
28 RefPtr<SDBConnection> mConnection;
30 nsCOMPtr<nsIVariant> mResult;
31 nsCOMPtr<nsISDBCallback> mCallback;
33 nsresult mResultCode;
34 bool mHaveResultOrErrorCode;
36 public:
37 explicit SDBRequest(SDBConnection* aConnection);
39 void AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(SDBRequest); }
41 SDBConnection* GetConnection() const {
42 AssertIsOnOwningThread();
44 return mConnection;
47 void SetResult(nsIVariant* aResult);
49 void SetError(nsresult aRv);
51 private:
52 ~SDBRequest();
54 void FireCallback();
56 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
57 NS_DECL_NSISDBREQUEST
58 NS_DECL_CYCLE_COLLECTION_CLASS(SDBRequest)
61 } // namespace dom
62 } // namespace mozilla
64 #endif // mozilla_dom_simpledb_SDBRequest_h