Bug 1667008 [wpt PR 25754] - [css-flex] Change some test expectations for image flex...
[gecko.git] / xpcom / threads / nsProcess.h
blobbf1e8ca0f1c46ff3a191330ebf4d5654bb236c8b
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/. */
7 #ifndef _nsPROCESSWIN_H_
8 #define _nsPROCESSWIN_H_
10 #if defined(XP_WIN)
11 # define PROCESSMODEL_WINAPI
12 #endif
14 #include "mozilla/Attributes.h"
15 #include "mozilla/Mutex.h"
16 #include "nsIProcess.h"
17 #include "nsIFile.h"
18 #include "nsIObserver.h"
19 #include "nsIObserver.h"
20 #include "nsMaybeWeakPtr.h"
21 #include "nsString.h"
22 #ifndef XP_UNIX
23 # include "prproces.h"
24 #endif
25 #if defined(PROCESSMODEL_WINAPI)
26 # include <windows.h>
27 # include <shellapi.h>
28 #endif
30 #define NS_PROCESS_CID \
31 { \
32 0x7b4eeb20, 0xd781, 0x11d4, { \
33 0x8A, 0x83, 0x00, 0x10, 0xa4, 0xe0, 0xc9, 0xca \
34 } \
37 class nsProcess final : public nsIProcess, public nsIObserver {
38 public:
39 NS_DECL_THREADSAFE_ISUPPORTS
40 NS_DECL_NSIPROCESS
41 NS_DECL_NSIOBSERVER
43 nsProcess();
45 private:
46 ~nsProcess();
47 static void Monitor(void* aArg);
48 void ProcessComplete();
49 nsresult CopyArgsAndRunProcess(bool aBlocking, const char** aArgs,
50 uint32_t aCount, nsIObserver* aObserver,
51 bool aHoldWeak);
52 nsresult CopyArgsAndRunProcessw(bool aBlocking, const char16_t** aArgs,
53 uint32_t aCount, nsIObserver* aObserver,
54 bool aHoldWeak);
55 // The 'args' array is null-terminated.
56 nsresult RunProcess(bool aBlocking, char** aArgs, nsIObserver* aObserver,
57 bool aHoldWeak, bool aArgsUTF8);
59 PRThread* mThread;
60 mozilla::Mutex mLock;
61 bool mShutdown;
62 bool mBlocking;
63 bool mStartHidden;
64 bool mNoShell;
66 nsCOMPtr<nsIFile> mExecutable;
67 nsString mTargetPath;
68 int32_t mPid;
69 nsMaybeWeakPtr<nsIObserver> mObserver;
71 // These members are modified by multiple threads, any accesses should be
72 // protected with mLock.
73 int32_t mExitValue;
74 #if defined(PROCESSMODEL_WINAPI)
75 HANDLE mProcess;
76 #elif !defined(XP_UNIX)
77 PRProcess* mProcess;
78 #endif
81 #endif