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 https://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_WinDllServices_h 8 #define mozilla_WinDllServices_h 9 10 #include "mozilla/glue/WindowsDllServices.h" 11 #include "mozilla/Maybe.h" 12 #include "mozilla/MozPromise.h" 13 #include "mozilla/RefPtr.h" 14 15 namespace mozilla { 16 17 class UntrustedModulesData; 18 class UntrustedModulesProcessor; 19 20 using UntrustedModulesPromise = 21 MozPromise<Maybe<UntrustedModulesData>, nsresult, true>; 22 23 struct ModulePaths; 24 class ModulesMapResult; 25 26 using ModulesTrustPromise = MozPromise<ModulesMapResult, nsresult, true>; 27 28 class DllServices final : public glue::DllServices { 29 public: 30 static DllServices* Get(); 31 32 virtual void DisableFull() override; 33 34 static const char* kTopicDllLoadedMainThread; 35 static const char* kTopicDllLoadedNonMainThread; 36 37 void StartUntrustedModulesProcessor(); 38 39 RefPtr<UntrustedModulesPromise> GetUntrustedModulesData(); 40 41 RefPtr<ModulesTrustPromise> GetModulesTrust(ModulePaths&& aModPaths, 42 bool aRunAtNormalPriority); 43 44 private: 45 DllServices() = default; 46 ~DllServices(); 47 48 void NotifyDllLoad(glue::EnhancedModuleLoadInfo&& aModLoadInfo) override; 49 void NotifyModuleLoadBacklog(ModuleLoadInfoVec&& aEvents) override; 50 51 RefPtr<UntrustedModulesProcessor> mUntrustedModulesProcessor; 52 }; 53 54 } // namespace mozilla 55 56 #endif // mozilla_WinDllServices_h 57