LCOV - code coverage report
Current view: top level - dom/cache - Connection.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 90 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 40 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "mozilla/dom/cache/Connection.h"
       8             : 
       9             : #include "mozilla/dom/cache/DBSchema.h"
      10             : #include "mozStorageHelper.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : namespace cache {
      15             : 
      16             : using mozilla::dom::quota::QuotaObject;
      17             : 
      18           0 : NS_IMPL_ISUPPORTS(cache::Connection, mozIStorageAsyncConnection,
      19             :                                      mozIStorageConnection);
      20             : 
      21           0 : Connection::Connection(mozIStorageConnection* aBase)
      22             :   : mBase(aBase)
      23           0 :   , mClosed(false)
      24             : {
      25           0 :   MOZ_DIAGNOSTIC_ASSERT(mBase);
      26           0 : }
      27             : 
      28           0 : Connection::~Connection()
      29             : {
      30           0 :   NS_ASSERT_OWNINGTHREAD(Connection);
      31           0 :   MOZ_ALWAYS_SUCCEEDS(Close());
      32           0 : }
      33             : 
      34             : NS_IMETHODIMP
      35           0 : Connection::Close()
      36             : {
      37           0 :   NS_ASSERT_OWNINGTHREAD(Connection);
      38             : 
      39           0 :   if (mClosed) {
      40           0 :     return NS_OK;
      41             :   }
      42           0 :   mClosed = true;
      43             : 
      44             :   // If we are closing here, then Cache must not have a transaction
      45             :   // open anywhere else.  This should be guaranteed to succeed.
      46           0 :   MOZ_ALWAYS_SUCCEEDS(db::IncrementalVacuum(this));
      47             : 
      48           0 :   return mBase->Close();
      49             : }
      50             : 
      51             : // The following methods are all boilerplate that either forward to the
      52             : // base connection or block the method.  All the async execution methods
      53             : // are blocked because Cache does not use them and they would require more
      54             : // work to wrap properly.
      55             : 
      56             : // mozIStorageAsyncConnection methods
      57             : 
      58             : NS_IMETHODIMP
      59           0 : Connection::AsyncClose(mozIStorageCompletionCallback*)
      60             : {
      61             :   // async methods are not supported
      62           0 :   return NS_ERROR_NOT_IMPLEMENTED;
      63             : }
      64             : 
      65             : NS_IMETHODIMP
      66           0 : Connection::SpinningSynchronousClose()
      67             : {
      68             :   // not supported
      69           0 :   return NS_ERROR_NOT_IMPLEMENTED;
      70             : }
      71             : 
      72             : NS_IMETHODIMP
      73           0 : Connection::AsyncClone(bool, mozIStorageCompletionCallback*)
      74             : {
      75             :   // async methods are not supported
      76           0 :   return NS_ERROR_NOT_IMPLEMENTED;
      77             : }
      78             : 
      79             : NS_IMETHODIMP
      80           0 : Connection::GetDatabaseFile(nsIFile** aFileOut)
      81             : {
      82           0 :   return mBase->GetDatabaseFile(aFileOut);
      83             : }
      84             : 
      85             : NS_IMETHODIMP
      86           0 : Connection::CreateAsyncStatement(const nsACString&, mozIStorageAsyncStatement**)
      87             : {
      88             :   // async methods are not supported
      89           0 :   return NS_ERROR_NOT_IMPLEMENTED;
      90             : }
      91             : 
      92             : NS_IMETHODIMP
      93           0 : Connection::ExecuteAsync(mozIStorageBaseStatement**, uint32_t,
      94             :                          mozIStorageStatementCallback*,
      95             :                          mozIStoragePendingStatement**)
      96             : {
      97             :   // async methods are not supported
      98           0 :   return NS_ERROR_NOT_IMPLEMENTED;
      99             : }
     100             : 
     101             : NS_IMETHODIMP
     102           0 : Connection::ExecuteSimpleSQLAsync(const nsACString&,
     103             :                                   mozIStorageStatementCallback*,
     104             :                                   mozIStoragePendingStatement**)
     105             : {
     106             :   // async methods are not supported
     107           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     108             : }
     109             : 
     110             : NS_IMETHODIMP
     111           0 : Connection::CreateFunction(const nsACString& aFunctionName,
     112             :                            int32_t aNumArguments,
     113             :                            mozIStorageFunction* aFunction)
     114             : {
     115             :   // async methods are not supported
     116           0 :   return NS_ERROR_NOT_IMPLEMENTED;
     117             : }
     118             : 
     119             : NS_IMETHODIMP
     120           0 : Connection::CreateAggregateFunction(const nsACString& aFunctionName,
     121             :                                     int32_t aNumArguments,
     122             :                                     mozIStorageAggregateFunction* aFunction)
     123             : {
     124           0 :   return mBase->CreateAggregateFunction(aFunctionName, aNumArguments,
     125           0 :                                         aFunction);
     126             : }
     127             : 
     128             : NS_IMETHODIMP
     129           0 : Connection::RemoveFunction(const nsACString& aFunctionName)
     130             : {
     131           0 :   return mBase->RemoveFunction(aFunctionName);
     132             : }
     133             : 
     134             : NS_IMETHODIMP
     135           0 : Connection::SetProgressHandler(int32_t aGranularity,
     136             :                                mozIStorageProgressHandler* aHandler,
     137             :                                mozIStorageProgressHandler** aHandlerOut)
     138             : {
     139           0 :   return mBase->SetProgressHandler(aGranularity, aHandler, aHandlerOut);
     140             : }
     141             : 
     142             : NS_IMETHODIMP
     143           0 : Connection::RemoveProgressHandler(mozIStorageProgressHandler** aHandlerOut)
     144             : {
     145           0 :   return mBase->RemoveProgressHandler(aHandlerOut);
     146             : }
     147             : 
     148             : // mozIStorageConnection methods
     149             : 
     150             : NS_IMETHODIMP
     151           0 : Connection::Clone(bool aReadOnly, mozIStorageConnection** aConnectionOut)
     152             : {
     153           0 :   nsCOMPtr<mozIStorageConnection> conn;
     154           0 :   nsresult rv = mBase->Clone(aReadOnly, getter_AddRefs(conn));
     155           0 :   if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
     156             : 
     157           0 :   nsCOMPtr<mozIStorageConnection> wrapped = new Connection(conn);
     158           0 :   wrapped.forget(aConnectionOut);
     159             : 
     160           0 :   return rv;
     161             : }
     162             : 
     163             : NS_IMETHODIMP
     164           0 : Connection::GetDefaultPageSize(int32_t* aSizeOut)
     165             : {
     166           0 :   return mBase->GetDefaultPageSize(aSizeOut);
     167             : }
     168             : 
     169             : NS_IMETHODIMP
     170           0 : Connection::GetConnectionReady(bool* aReadyOut)
     171             : {
     172           0 :   return mBase->GetConnectionReady(aReadyOut);
     173             : }
     174             : 
     175             : NS_IMETHODIMP
     176           0 : Connection::GetLastInsertRowID(int64_t* aRowIdOut)
     177             : {
     178           0 :   return mBase->GetLastInsertRowID(aRowIdOut);
     179             : }
     180             : 
     181             : NS_IMETHODIMP
     182           0 : Connection::GetAffectedRows(int32_t* aCountOut)
     183             : {
     184           0 :   return mBase->GetAffectedRows(aCountOut);
     185             : }
     186             : 
     187             : NS_IMETHODIMP
     188           0 : Connection::GetLastError(int32_t* aErrorOut)
     189             : {
     190           0 :   return mBase->GetLastError(aErrorOut);
     191             : }
     192             : 
     193             : NS_IMETHODIMP
     194           0 : Connection::GetLastErrorString(nsACString& aErrorOut)
     195             : {
     196           0 :   return mBase->GetLastErrorString(aErrorOut);
     197             : }
     198             : 
     199             : NS_IMETHODIMP
     200           0 : Connection::GetSchemaVersion(int32_t* aVersionOut)
     201             : {
     202           0 :   return mBase->GetSchemaVersion(aVersionOut);
     203             : }
     204             : 
     205             : NS_IMETHODIMP
     206           0 : Connection::SetSchemaVersion(int32_t aVersion)
     207             : {
     208           0 :   return mBase->SetSchemaVersion(aVersion);
     209             : }
     210             : 
     211             : NS_IMETHODIMP
     212           0 : Connection::CreateStatement(const nsACString& aQuery,
     213             :                             mozIStorageStatement** aStatementOut)
     214             : {
     215           0 :   return mBase->CreateStatement(aQuery, aStatementOut);
     216             : }
     217             : 
     218             : NS_IMETHODIMP
     219           0 : Connection::ExecuteSimpleSQL(const nsACString& aQuery)
     220             : {
     221           0 :   return mBase->ExecuteSimpleSQL(aQuery);
     222             : }
     223             : 
     224             : NS_IMETHODIMP
     225           0 : Connection::TableExists(const nsACString& aTableName, bool* aExistsOut)
     226             : {
     227           0 :   return mBase->TableExists(aTableName, aExistsOut);
     228             : }
     229             : 
     230             : NS_IMETHODIMP
     231           0 : Connection::IndexExists(const nsACString& aIndexName, bool* aExistsOut)
     232             : {
     233           0 :   return mBase->IndexExists(aIndexName, aExistsOut);
     234             : }
     235             : 
     236             : NS_IMETHODIMP
     237           0 : Connection::GetTransactionInProgress(bool* aResultOut)
     238             : {
     239           0 :   return mBase->GetTransactionInProgress(aResultOut);
     240             : }
     241             : 
     242             : NS_IMETHODIMP
     243           0 : Connection::BeginTransaction()
     244             : {
     245           0 :   return mBase->BeginTransaction();
     246             : }
     247             : 
     248             : NS_IMETHODIMP
     249           0 : Connection::BeginTransactionAs(int32_t aType)
     250             : {
     251           0 :   return mBase->BeginTransactionAs(aType);
     252             : }
     253             : 
     254             : NS_IMETHODIMP
     255           0 : Connection::CommitTransaction()
     256             : {
     257           0 :   return mBase->CommitTransaction();
     258             : }
     259             : 
     260             : NS_IMETHODIMP
     261           0 : Connection::RollbackTransaction()
     262             : {
     263           0 :   return mBase->RollbackTransaction();
     264             : }
     265             : 
     266             : NS_IMETHODIMP
     267           0 : Connection::CreateTable(const char* aTable, const char* aSchema)
     268             : {
     269           0 :   return mBase->CreateTable(aTable, aSchema);
     270             : }
     271             : 
     272             : NS_IMETHODIMP
     273           0 : Connection::SetGrowthIncrement(int32_t aIncrement, const nsACString& aDatabase)
     274             : {
     275           0 :   return mBase->SetGrowthIncrement(aIncrement, aDatabase);
     276             : }
     277             : 
     278             : NS_IMETHODIMP
     279           0 : Connection::EnableModule(const nsACString& aModule)
     280             : {
     281           0 :   return mBase->EnableModule(aModule);
     282             : }
     283             : 
     284             : NS_IMETHODIMP
     285           0 : Connection::GetQuotaObjects(QuotaObject** aDatabaseQuotaObject,
     286             :                             QuotaObject** aJournalQuotaObject)
     287             : {
     288           0 :   return mBase->GetQuotaObjects(aDatabaseQuotaObject, aJournalQuotaObject);
     289             : }
     290             : 
     291             : } // namespace cache
     292             : } // namespace dom
     293             : } // namespace mozilla

Generated by: LCOV version 1.13