Bug 1769952 - Fix running raptor on a Win10-64 VM r=sparky
[gecko.git] / dom / system / OSFileConstants.h
blob73b591157920ed13e287c859861e3cd7ab1dc39c
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_osfileconstants_h__
8 #define mozilla_osfileconstants_h__
10 #include "nsIObserver.h"
11 #include "nsIOSFileConstantsService.h"
12 #include "mozilla/Attributes.h"
14 namespace mozilla {
16 /**
17 * XPConnect initializer, for use in the main thread.
18 * This class is thread-safe but it must be first be initialized on the
19 * main-thread.
21 class OSFileConstantsService final : public nsIOSFileConstantsService,
22 public nsIObserver {
23 public:
24 NS_DECL_THREADSAFE_ISUPPORTS
25 NS_DECL_NSIOSFILECONSTANTSSERVICE
26 NS_DECL_NSIOBSERVER
28 static already_AddRefed<OSFileConstantsService> GetOrCreate();
30 bool DefineOSFileConstants(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
32 private:
33 nsresult InitOSFileConstants();
35 OSFileConstantsService();
36 ~OSFileConstantsService();
38 bool mInitialized;
40 struct Paths;
41 UniquePtr<Paths> mPaths;
43 /**
44 * (Unix) the umask, which goes in OS.Constants.Sys but
45 * can only be looked up (via the system-info service)
46 * on the main thread.
48 uint32_t mUserUmask;
51 } // namespace mozilla
53 #endif // mozilla_osfileconstants_h__