LCOV - code coverage report
Current view: top level - dom/filesystem - OSFileSystem.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 1 41 2.4 %
Date: 2017-07-14 16:53:18 Functions: 2 12 16.7 %
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             : #include "mozilla/dom/OSFileSystem.h"
       8             : 
       9             : #include "mozilla/dom/Directory.h"
      10             : #include "mozilla/dom/File.h"
      11             : #include "mozilla/dom/FileSystemUtils.h"
      12             : #include "nsIGlobalObject.h"
      13             : #include "nsCOMPtr.h"
      14             : #include "nsDebug.h"
      15             : #include "nsIFile.h"
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20           0 : OSFileSystem::OSFileSystem(const nsAString& aRootDir)
      21             : {
      22           0 :   mLocalRootPath = aRootDir;
      23           0 : }
      24             : 
      25             : already_AddRefed<FileSystemBase>
      26           0 : OSFileSystem::Clone()
      27             : {
      28           0 :   AssertIsOnOwningThread();
      29             : 
      30           0 :   RefPtr<OSFileSystem> fs = new OSFileSystem(mLocalRootPath);
      31           0 :   if (mParent) {
      32           0 :     fs->Init(mParent);
      33             :   }
      34             : 
      35           0 :   return fs.forget();
      36             : }
      37             : 
      38             : void
      39           0 : OSFileSystem::Init(nsISupports* aParent)
      40             : {
      41           0 :   AssertIsOnOwningThread();
      42           0 :   MOZ_ASSERT(!mParent, "No duple Init() calls");
      43           0 :   MOZ_ASSERT(aParent);
      44             : 
      45           0 :   mParent = aParent;
      46             : 
      47             : #ifdef DEBUG
      48           0 :   nsCOMPtr<nsIGlobalObject> obj = do_QueryInterface(aParent);
      49           0 :   MOZ_ASSERT(obj);
      50             : #endif
      51           0 : }
      52             : 
      53             : nsISupports*
      54           0 : OSFileSystem::GetParentObject() const
      55             : {
      56           0 :   AssertIsOnOwningThread();
      57           0 :   return mParent;
      58             : }
      59             : 
      60             : bool
      61           0 : OSFileSystem::IsSafeFile(nsIFile* aFile) const
      62             : {
      63             :   // The concept of "safe files" is specific to the Device Storage API where
      64             :   // files are only "safe" if they're of a type that is appropriate for the
      65             :   // area of device storage that is being used.
      66           0 :   MOZ_CRASH("Don't use OSFileSystem with the Device Storage API");
      67             :   return true;
      68             : }
      69             : 
      70             : bool
      71           0 : OSFileSystem::IsSafeDirectory(Directory* aDir) const
      72             : {
      73             :   // The concept of "safe directory" is specific to the Device Storage API
      74             :   // where a directory is only "safe" if it belongs to the area of device
      75             :   // storage that it is being used with.
      76           0 :   MOZ_CRASH("Don't use OSFileSystem with the Device Storage API");
      77             :   return true;
      78             : }
      79             : 
      80             : void
      81           0 : OSFileSystem::Unlink()
      82             : {
      83           0 :   AssertIsOnOwningThread();
      84           0 :   mParent = nullptr;
      85           0 : }
      86             : 
      87             : void
      88           0 : OSFileSystem::Traverse(nsCycleCollectionTraversalCallback &cb)
      89             : {
      90           0 :   AssertIsOnOwningThread();
      91             : 
      92           0 :   OSFileSystem* tmp = this;
      93           0 :   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent);
      94           0 : }
      95             : 
      96             : void
      97           0 : OSFileSystem::SerializeDOMPath(nsAString& aOutput) const
      98             : {
      99           0 :   AssertIsOnOwningThread();
     100           0 :   aOutput = mLocalRootPath;
     101           0 : }
     102             : 
     103             : /**
     104             :  * OSFileSystemParent
     105             :  */
     106             : 
     107           0 : OSFileSystemParent::OSFileSystemParent(const nsAString& aRootDir)
     108             : {
     109           0 :   mLocalRootPath = aRootDir;
     110           0 : }
     111             : 
     112             : } // namespace dom
     113           9 : } // namespace mozilla

Generated by: LCOV version 1.13