SandboxTestingParent.h (1842B)
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_SandboxTestingParent_h 8 #define mozilla_SandboxTestingParent_h 9 10 #include "mozilla/PSandboxTestingParent.h" 11 #include "mozilla/Monitor.h" 12 #include "mozilla/UniquePtr.h" 13 14 #if !defined(MOZ_SANDBOX) || !defined(MOZ_DEBUG) || !defined(ENABLE_TESTS) 15 # error "This file should not be used outside of debug with tests" 16 #endif 17 18 namespace mozilla { 19 20 class SandboxTestingThread; 21 22 class SandboxTestingParent : public PSandboxTestingParent { 23 public: 24 static already_AddRefed<SandboxTestingParent> Create( 25 Endpoint<PSandboxTestingParent>&& aParentEnd); 26 static void Destroy(already_AddRefed<SandboxTestingParent> aInstance); 27 28 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SandboxTestingParent, override) 29 30 void ActorDestroy(ActorDestroyReason aWhy) override; 31 32 mozilla::ipc::IPCResult RecvReportTestResults(const nsCString& testName, 33 bool passed, 34 const nsCString& resultMessage); 35 mozilla::ipc::IPCResult RecvTestCompleted(); 36 37 mozilla::ipc::IPCResult RecvGetSpecialDirectory( 38 const nsCString& aSpecialDirName, nsString* aDirPath); 39 40 private: 41 explicit SandboxTestingParent(SandboxTestingThread* aThread); 42 virtual ~SandboxTestingParent(); 43 void ShutdownSandboxTestThread(); 44 void Bind(Endpoint<PSandboxTestingParent>&& aEnd); 45 46 UniquePtr<SandboxTestingThread> mThread; 47 Monitor mMonitor MOZ_UNANNOTATED; 48 bool mShutdownDone; 49 }; 50 51 } // namespace mozilla 52 53 #endif // mozilla_SandboxTestingParent_h