FileUtils.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_cache_FileUtils_h
  6. #define mozilla_dom_cache_FileUtils_h
  7. #include "mozilla/Attributes.h"
  8. #include "mozilla/dom/cache/Types.h"
  9. #include "nsStreamUtils.h"
  10. #include "nsTArrayForwardDeclare.h"
  11. struct nsID;
  12. class nsIFile;
  13. namespace mozilla {
  14. namespace dom {
  15. namespace cache {
  16. nsresult
  17. BodyCreateDir(nsIFile* aBaseDir);
  18. // Note that this function can only be used during the initialization of the
  19. // database. We're unlikely to be able to delete the DB successfully past
  20. // that point due to the file being in use.
  21. nsresult
  22. BodyDeleteDir(nsIFile* aBaseDir);
  23. nsresult
  24. BodyGetCacheDir(nsIFile* aBaseDir, const nsID& aId, nsIFile** aCacheDirOut);
  25. nsresult
  26. BodyStartWriteStream(const QuotaInfo& aQuotaInfo, nsIFile* aBaseDir,
  27. nsIInputStream* aSource, void* aClosure,
  28. nsAsyncCopyCallbackFun aCallback, nsID* aIdOut,
  29. nsISupports** aCopyContextOut);
  30. void
  31. BodyCancelWrite(nsIFile* aBaseDir, nsISupports* aCopyContext);
  32. nsresult
  33. BodyFinalizeWrite(nsIFile* aBaseDir, const nsID& aId);
  34. nsresult
  35. BodyOpen(const QuotaInfo& aQuotaInfo, nsIFile* aBaseDir, const nsID& aId,
  36. nsIInputStream** aStreamOut);
  37. nsresult
  38. BodyDeleteFiles(nsIFile* aBaseDir, const nsTArray<nsID>& aIdList);
  39. nsresult
  40. BodyDeleteOrphanedFiles(nsIFile* aBaseDir, nsTArray<nsID>& aKnownBodyIdList);
  41. nsresult
  42. CreateMarkerFile(const QuotaInfo& aQuotaInfo);
  43. nsresult
  44. DeleteMarkerFile(const QuotaInfo& aQuotaInfo);
  45. bool
  46. MarkerFileExists(const QuotaInfo& aQuotaInfo);
  47. } // namespace cache
  48. } // namespace dom
  49. } // namespace mozilla
  50. #endif // mozilla_dom_cache_FileUtils_h