Bug 1848468 - Mark k-rate-dynamics-compressor-connections.html subtest as failing...
[gecko.git] / dom / filesystem / OSFileSystem.h
blobcb2ade7fc569e46c46a1cb9ac34b1f16449f14dd
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/. */
7 #ifndef mozilla_dom_OSFileSystem_h
8 #define mozilla_dom_OSFileSystem_h
10 #include "mozilla/dom/FileSystemBase.h"
12 namespace mozilla::dom {
14 class OSFileSystem final : public FileSystemBase {
15 public:
16 explicit OSFileSystem(const nsAString& aRootDir);
18 void Init(nsIGlobalObject* aGlobal);
20 // Overrides FileSystemBase
22 virtual already_AddRefed<FileSystemBase> Clone() override;
24 virtual bool ShouldCreateDirectory() override {
25 MOZ_CRASH("This should not be called.");
26 // Because OSFileSystem should not be used when the creation of directories
27 // is needed. For that we have OSFileSystemParent.
28 return false;
31 virtual nsIGlobalObject* GetParentObject() const override;
33 virtual bool IsSafeFile(nsIFile* aFile) const override;
35 virtual bool IsSafeDirectory(Directory* aDir) const override;
37 virtual void SerializeDOMPath(nsAString& aOutput) const override;
39 // CC methods
40 virtual void Unlink() override;
41 virtual void Traverse(nsCycleCollectionTraversalCallback& cb) override;
43 private:
44 virtual ~OSFileSystem() = default;
46 nsCOMPtr<nsIGlobalObject> mGlobal;
49 class OSFileSystemParent final : public FileSystemBase {
50 public:
51 explicit OSFileSystemParent(const nsAString& aRootDir);
53 // Overrides FileSystemBase
55 virtual already_AddRefed<FileSystemBase> Clone() override {
56 MOZ_CRASH("This should not be called on the PBackground thread.");
57 return nullptr;
60 virtual bool ShouldCreateDirectory() override { return false; }
62 virtual nsIGlobalObject* GetParentObject() const override {
63 MOZ_CRASH("This should not be called on the PBackground thread.");
64 return nullptr;
67 virtual void GetDirectoryName(nsIFile* aFile, nsAString& aRetval,
68 ErrorResult& aRv) const override {
69 MOZ_CRASH("This should not be called on the PBackground thread.");
72 virtual bool IsSafeFile(nsIFile* aFile) const override { return true; }
74 virtual bool IsSafeDirectory(Directory* aDir) const override {
75 MOZ_CRASH("This should not be called on the PBackground thread.");
76 return true;
79 virtual void SerializeDOMPath(nsAString& aOutput) const override {
80 MOZ_CRASH("This should not be called on the PBackground thread.");
83 // CC methods
84 virtual void Unlink() override {
85 MOZ_CRASH("This should not be called on the PBackground thread.");
88 virtual void Traverse(nsCycleCollectionTraversalCallback& cb) override {
89 MOZ_CRASH("This should not be called on the PBackground thread.");
92 private:
93 virtual ~OSFileSystemParent() = default;
96 } // namespace mozilla::dom
98 #endif // mozilla_dom_OSFileSystem_h