tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SDBRequest.h (1432B)


      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 "ErrorList.h"
     11 #include "mozilla/RefPtr.h"
     12 #include "nsCOMPtr.h"
     13 #include "nsCycleCollectionParticipant.h"
     14 #include "nsISDBRequest.h"
     15 #include "nsISupports.h"
     16 
     17 class nsISDBCallback;
     18 class nsIVariant;
     19 
     20 namespace mozilla::dom {
     21 
     22 class SDBConnection;
     23 
     24 class SDBRequest final : public nsISDBRequest {
     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 AssertIsOnOwningThread() const { NS_ASSERT_OWNINGTHREAD(SDBRequest); }
     37 
     38  SDBConnection* GetConnection() const {
     39    AssertIsOnOwningThread();
     40 
     41    return mConnection;
     42  }
     43 
     44  void SetResult(nsIVariant* aResult);
     45 
     46  void SetError(nsresult aRv);
     47 
     48 private:
     49  ~SDBRequest();
     50 
     51  void FireCallback();
     52 
     53  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     54  NS_DECL_NSISDBREQUEST
     55  NS_DECL_CYCLE_COLLECTION_CLASS(SDBRequest)
     56 };
     57 
     58 }  // namespace mozilla::dom
     59 
     60 #endif  // mozilla_dom_simpledb_SDBRequest_h