FileSystemQuotaClientFactory.h (1296B)
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_PARENT_FILESYSTEMQUOTACLIENTFACTORY_H_ 8 #define DOM_FS_PARENT_FILESYSTEMQUOTACLIENTFACTORY_H_ 9 10 #include "mozilla/AlreadyAddRefed.h" 11 #include "nsISupportsUtils.h" 12 13 template <class> 14 class RefPtr; 15 16 namespace mozilla::dom { 17 18 namespace quota { 19 20 class Client; 21 22 } // namespace quota 23 24 namespace fs { 25 26 class FileSystemQuotaClientFactory { 27 public: 28 NS_INLINE_DECL_THREADSAFE_REFCOUNTING( 29 mozilla::dom::fs::FileSystemQuotaClientFactory); 30 31 static void SetCustomFactory( 32 RefPtr<FileSystemQuotaClientFactory> aCustomFactory); 33 34 static already_AddRefed<quota::Client> CreateQuotaClient(); 35 36 protected: 37 virtual ~FileSystemQuotaClientFactory() = default; 38 39 virtual already_AddRefed<quota::Client> AllocQuotaClient(); 40 }; 41 42 inline already_AddRefed<quota::Client> CreateQuotaClient() { 43 return FileSystemQuotaClientFactory::CreateQuotaClient(); 44 } 45 46 } // namespace fs 47 } // namespace mozilla::dom 48 49 #endif // DOM_FS_PARENT_FILESYSTEMQUOTACLIENTFACTORY_H_