xpcom/threads/nsProcess.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef _nsPROCESSWIN_H_
michael@0 7 #define _nsPROCESSWIN_H_
michael@0 8
michael@0 9 #if defined(XP_WIN)
michael@0 10 #define PROCESSMODEL_WINAPI
michael@0 11 #endif
michael@0 12
michael@0 13 #include "mozilla/Attributes.h"
michael@0 14 #include "mozilla/Mutex.h"
michael@0 15 #include "nsIProcess.h"
michael@0 16 #include "nsIFile.h"
michael@0 17 #include "nsIThread.h"
michael@0 18 #include "nsIObserver.h"
michael@0 19 #include "nsIWeakReferenceUtils.h"
michael@0 20 #include "nsIObserver.h"
michael@0 21 #include "nsString.h"
michael@0 22 #ifndef XP_MACOSX
michael@0 23 #include "prproces.h"
michael@0 24 #endif
michael@0 25 #if defined(PROCESSMODEL_WINAPI)
michael@0 26 #include <windows.h>
michael@0 27 #include <shellapi.h>
michael@0 28 #endif
michael@0 29
michael@0 30 #define NS_PROCESS_CID \
michael@0 31 {0x7b4eeb20, 0xd781, 0x11d4, \
michael@0 32 {0x8A, 0x83, 0x00, 0x10, 0xa4, 0xe0, 0xc9, 0xca}}
michael@0 33
michael@0 34 class nsProcess MOZ_FINAL : public nsIProcess,
michael@0 35 public nsIObserver
michael@0 36 {
michael@0 37 public:
michael@0 38
michael@0 39 NS_DECL_THREADSAFE_ISUPPORTS
michael@0 40 NS_DECL_NSIPROCESS
michael@0 41 NS_DECL_NSIOBSERVER
michael@0 42
michael@0 43 nsProcess();
michael@0 44
michael@0 45 private:
michael@0 46 ~nsProcess();
michael@0 47 static void Monitor(void *arg);
michael@0 48 void ProcessComplete();
michael@0 49 nsresult CopyArgsAndRunProcess(bool blocking, const char** args,
michael@0 50 uint32_t count, nsIObserver* observer,
michael@0 51 bool holdWeak);
michael@0 52 nsresult CopyArgsAndRunProcessw(bool blocking, const char16_t** args,
michael@0 53 uint32_t count, nsIObserver* observer,
michael@0 54 bool holdWeak);
michael@0 55 // The 'args' array is null-terminated.
michael@0 56 nsresult RunProcess(bool blocking, char **args, nsIObserver* observer,
michael@0 57 bool holdWeak, bool argsUTF8);
michael@0 58
michael@0 59 PRThread* mThread;
michael@0 60 mozilla::Mutex mLock;
michael@0 61 bool mShutdown;
michael@0 62 bool mBlocking;
michael@0 63
michael@0 64 nsCOMPtr<nsIFile> mExecutable;
michael@0 65 nsString mTargetPath;
michael@0 66 int32_t mPid;
michael@0 67 nsCOMPtr<nsIObserver> mObserver;
michael@0 68 nsWeakPtr mWeakObserver;
michael@0 69
michael@0 70 // These members are modified by multiple threads, any accesses should be
michael@0 71 // protected with mLock.
michael@0 72 int32_t mExitValue;
michael@0 73 #if defined(PROCESSMODEL_WINAPI)
michael@0 74 HANDLE mProcess;
michael@0 75 #elif !defined(XP_MACOSX)
michael@0 76 PRProcess *mProcess;
michael@0 77 #endif
michael@0 78 };
michael@0 79
michael@0 80 #endif

mercurial