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_
11 # define PROCESSMODEL_WINAPI
14 #include "mozilla/Attributes.h"
15 #include "mozilla/Mutex.h"
16 #include "nsIProcess.h"
17 #include "nsIObserver.h"
18 #include "nsMaybeWeakPtr.h"
21 # include "prproces.h"
23 #if defined(PROCESSMODEL_WINAPI)
25 # include <shellapi.h>
28 #define NS_PROCESS_CID \
30 0x7b4eeb20, 0xd781, 0x11d4, { \
31 0x8A, 0x83, 0x00, 0x10, 0xa4, 0xe0, 0xc9, 0xca \
37 class nsProcess final
: public nsIProcess
, public nsIObserver
{
39 NS_DECL_THREADSAFE_ISUPPORTS
47 static void Monitor(void* aArg
);
48 void ProcessComplete();
49 nsresult
CopyArgsAndRunProcess(bool aBlocking
, const char** aArgs
,
50 uint32_t aCount
, nsIObserver
* aObserver
,
52 nsresult
CopyArgsAndRunProcessw(bool aBlocking
, const char16_t
** aArgs
,
53 uint32_t aCount
, nsIObserver
* aObserver
,
55 // The 'args' array is null-terminated.
56 nsresult
RunProcess(bool aBlocking
, char** aArgs
, nsIObserver
* aObserver
,
57 bool aHoldWeak
, bool aArgsUTF8
);
66 nsCOMPtr
<nsIFile
> mExecutable
;
69 nsMaybeWeakPtr
<nsIObserver
> mObserver
;
71 // These members are modified by multiple threads, any accesses should be
72 // protected with mLock.
74 #if defined(PROCESSMODEL_WINAPI)
76 #elif !defined(XP_UNIX)