tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FileSystemDirectoryIterator.h (2120B)


      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 #ifndef DOM_FS_FILESYSTEMDIRECTORYITERATOR_H_
      8 #define DOM_FS_FILESYSTEMDIRECTORYITERATOR_H_
      9 
     10 #include "mozilla/dom/IterableIterator.h"
     11 #include "nsCOMPtr.h"
     12 #include "nsISupports.h"
     13 #include "nsWrapperCache.h"
     14 
     15 class nsIGlobalObject;
     16 
     17 namespace mozilla {
     18 
     19 class ErrorResult;
     20 
     21 namespace dom {
     22 
     23 class FileSystemManager;
     24 class IterableIteratorBase;
     25 class Promise;
     26 
     27 // XXX This class isn't used to support iteration anymore. `Impl` should be
     28 // extracted elsewhere and `FileSystemDirectoryIterator` should be removed
     29 // completely
     30 class FileSystemDirectoryIterator : public nsISupports, public nsWrapperCache {
     31 public:
     32  class Impl {
     33   public:
     34    NS_INLINE_DECL_REFCOUNTING(Impl)
     35 
     36    virtual already_AddRefed<Promise> Next(nsIGlobalObject* aGlobal,
     37                                           RefPtr<FileSystemManager>& aManager,
     38                                           ErrorResult& aError) = 0;
     39 
     40   protected:
     41    virtual ~Impl() = default;
     42  };
     43 
     44  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     45  NS_DECL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(FileSystemDirectoryIterator)
     46 
     47  explicit FileSystemDirectoryIterator(nsIGlobalObject* aGlobal,
     48                                       RefPtr<FileSystemManager>& aManager,
     49                                       RefPtr<Impl>& aImpl);
     50 
     51  // WebIDL Boilerplate
     52  nsIGlobalObject* GetParentObject() const;
     53 
     54  JSObject* WrapObject(JSContext* aCx,
     55                       JS::Handle<JSObject*> aGivenProto) override;
     56 
     57  // WebIDL Interface
     58  already_AddRefed<Promise> Next(ErrorResult& aError);
     59 
     60 protected:
     61  virtual ~FileSystemDirectoryIterator() = default;
     62 
     63  nsCOMPtr<nsIGlobalObject> mGlobal;
     64 
     65  RefPtr<FileSystemManager> mManager;
     66 
     67 private:
     68  RefPtr<Impl> mImpl;
     69 };
     70 
     71 }  // namespace dom
     72 }  // namespace mozilla
     73 
     74 #endif  // DOM_FS_FILESYSTEMDIRECTORYITERATOR_H_