tor-browser

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

StartedTransaction.cpp (1216B)


      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 #include "StartedTransaction.h"
      8 
      9 #include "ResultConnection.h"
     10 #include "mozilla/dom/quota/QuotaCommon.h"
     11 #include "mozilla/dom/quota/ResultExtensions.h"
     12 
     13 namespace mozilla::dom::fs {
     14 
     15 /* static */
     16 Result<StartedTransaction, QMResult> StartedTransaction::Create(
     17    const ResultConnection& aConn) {
     18  auto transaction = MakeUnique<mozStorageTransaction>(
     19      aConn.get(), /* aCommitOnComplete */ false,
     20      mozIStorageConnection::TRANSACTION_IMMEDIATE);
     21 
     22  QM_TRY(QM_TO_RESULT(transaction->Start()));
     23 
     24  return StartedTransaction(std::move(transaction));
     25 }
     26 
     27 nsresult StartedTransaction::Commit() { return mTransaction->Commit(); }
     28 
     29 nsresult StartedTransaction::Rollback() { return mTransaction->Rollback(); }
     30 
     31 StartedTransaction::StartedTransaction(
     32    UniquePtr<mozStorageTransaction>&& aTransaction)
     33    : mTransaction(std::move(aTransaction)) {}
     34 
     35 }  // namespace mozilla::dom::fs