LCOV - code coverage report
Current view: top level - dom/indexedDB - IDBMutableFile.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 31 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 17 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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_idbmutablefile_h__
       8             : #define mozilla_dom_idbmutablefile_h__
       9             : 
      10             : #include "js/TypeDecls.h"
      11             : #include "mozilla/Atomics.h"
      12             : #include "mozilla/Attributes.h"
      13             : #include "mozilla/DOMEventTargetHelper.h"
      14             : #include "mozilla/dom/FileModeBinding.h"
      15             : #include "nsCycleCollectionParticipant.h"
      16             : #include "nsHashKeys.h"
      17             : #include "nsString.h"
      18             : #include "nsTHashtable.h"
      19             : 
      20             : class nsPIDOMWindowInner;
      21             : 
      22             : namespace mozilla {
      23             : 
      24             : class ErrorResult;
      25             : 
      26             : namespace dom {
      27             : 
      28             : class DOMRequest;
      29             : class File;
      30             : class IDBDatabase;
      31             : class IDBFileHandle;
      32             : 
      33             : namespace indexedDB {
      34             : class BackgroundMutableFileChild;
      35             : }
      36             : 
      37             : class IDBMutableFile final
      38             :   : public DOMEventTargetHelper
      39             : {
      40             :   RefPtr<IDBDatabase> mDatabase;
      41             : 
      42             :   indexedDB::BackgroundMutableFileChild* mBackgroundActor;
      43             : 
      44             :   nsTHashtable<nsPtrHashKey<IDBFileHandle>> mFileHandles;
      45             : 
      46             :   nsString mName;
      47             :   nsString mType;
      48             : 
      49             :   Atomic<bool> mInvalidated;
      50             : 
      51             : public:
      52             :   IDBMutableFile(IDBDatabase* aDatabase,
      53             :                  indexedDB::BackgroundMutableFileChild* aActor,
      54             :                  const nsAString& aName,
      55             :                  const nsAString& aType);
      56             : 
      57             :   void
      58             :   AssertIsOnOwningThread() const
      59             : #ifdef DEBUG
      60             :   ;
      61             : #else
      62             :   { }
      63             : #endif
      64             : 
      65             :   indexedDB::BackgroundMutableFileChild*
      66           0 :   GetBackgroundActor() const
      67             :   {
      68           0 :     AssertIsOnOwningThread();
      69             : 
      70           0 :     return mBackgroundActor;
      71             :   }
      72             : 
      73             :   void
      74           0 :   ClearBackgroundActor()
      75             :   {
      76           0 :     AssertIsOnOwningThread();
      77             : 
      78           0 :     mBackgroundActor = nullptr;
      79           0 :   }
      80             : 
      81             :   const nsString&
      82           0 :   Name() const
      83             :   {
      84           0 :     AssertIsOnOwningThread();
      85             : 
      86           0 :     return mName;
      87             :   }
      88             : 
      89             :   const nsString&
      90           0 :   Type() const
      91             :   {
      92           0 :     AssertIsOnOwningThread();
      93             : 
      94           0 :     return mType;
      95             :   }
      96             : 
      97             :   void
      98           0 :   SetLazyData(const nsAString& aName,
      99             :               const nsAString& aType)
     100             :   {
     101           0 :     mName = aName;
     102           0 :     mType = aType;
     103           0 :   }
     104             : 
     105             :   int64_t
     106             :   GetFileId() const;
     107             : 
     108             :   void
     109             :   Invalidate();
     110             : 
     111             :   bool
     112           0 :   IsInvalidated() const
     113             :   {
     114           0 :     AssertIsOnOwningThread();
     115             : 
     116           0 :     return mInvalidated;
     117             :   }
     118             : 
     119             :   void
     120             :   RegisterFileHandle(IDBFileHandle* aFileHandle);
     121             : 
     122             :   void
     123             :   UnregisterFileHandle(IDBFileHandle* aFileHandle);
     124             : 
     125             :   void
     126             :   AbortFileHandles();
     127             : 
     128             :   // WebIDL
     129             :   nsPIDOMWindowInner*
     130           0 :   GetParentObject() const
     131             :   {
     132           0 :     return GetOwner();
     133             :   }
     134             : 
     135             :   void
     136           0 :   GetName(nsString& aName) const
     137             :   {
     138           0 :     aName = mName;
     139           0 :   }
     140             : 
     141             :   void
     142           0 :   GetType(nsString& aType) const
     143             :   {
     144           0 :     aType = mType;
     145           0 :   }
     146             : 
     147             :   IDBDatabase*
     148             :   Database() const;
     149             : 
     150             :   already_AddRefed<IDBFileHandle>
     151             :   Open(FileMode aMode, ErrorResult& aError);
     152             : 
     153             :   already_AddRefed<DOMRequest>
     154             :   GetFile(ErrorResult& aError);
     155             : 
     156           0 :   IMPL_EVENT_HANDLER(abort)
     157           0 :   IMPL_EVENT_HANDLER(error)
     158             : 
     159             :   NS_DECL_ISUPPORTS_INHERITED
     160           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IDBMutableFile, DOMEventTargetHelper)
     161             : 
     162             :   // nsWrapperCache
     163             :   virtual JSObject*
     164             :   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
     165             : 
     166             : private:
     167             :   ~IDBMutableFile();
     168             : };
     169             : 
     170             : } // namespace dom
     171             : } // namespace mozilla
     172             : 
     173             : #endif // mozilla_dom_idbmutablefile_h__

Generated by: LCOV version 1.13