Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef _NSKEYGENTHREAD_H_ |
michael@0 | 8 | #define _NSKEYGENTHREAD_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include "keyhi.h" |
michael@0 | 11 | #include "nspr.h" |
michael@0 | 12 | |
michael@0 | 13 | #include "mozilla/Mutex.h" |
michael@0 | 14 | #include "nsIKeygenThread.h" |
michael@0 | 15 | #include "nsCOMPtr.h" |
michael@0 | 16 | |
michael@0 | 17 | class nsIRunnable; |
michael@0 | 18 | |
michael@0 | 19 | class nsKeygenThread : public nsIKeygenThread |
michael@0 | 20 | { |
michael@0 | 21 | private: |
michael@0 | 22 | mozilla::Mutex mutex; |
michael@0 | 23 | |
michael@0 | 24 | nsCOMPtr<nsIRunnable> mNotifyObserver; |
michael@0 | 25 | |
michael@0 | 26 | bool iAmRunning; |
michael@0 | 27 | bool keygenReady; |
michael@0 | 28 | bool statusDialogClosed; |
michael@0 | 29 | bool alreadyReceivedParams; |
michael@0 | 30 | |
michael@0 | 31 | SECKEYPrivateKey *privateKey; |
michael@0 | 32 | SECKEYPublicKey *publicKey; |
michael@0 | 33 | PK11SlotInfo *slot; |
michael@0 | 34 | PK11AttrFlags flags; |
michael@0 | 35 | PK11SlotInfo *altSlot; |
michael@0 | 36 | PK11AttrFlags altFlags; |
michael@0 | 37 | PK11SlotInfo *usedSlot; |
michael@0 | 38 | uint32_t keyGenMechanism; |
michael@0 | 39 | void *params; |
michael@0 | 40 | void *wincx; |
michael@0 | 41 | |
michael@0 | 42 | PRThread *threadHandle; |
michael@0 | 43 | |
michael@0 | 44 | public: |
michael@0 | 45 | nsKeygenThread(); |
michael@0 | 46 | virtual ~nsKeygenThread(); |
michael@0 | 47 | |
michael@0 | 48 | NS_DECL_NSIKEYGENTHREAD |
michael@0 | 49 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 50 | |
michael@0 | 51 | void SetParams( |
michael@0 | 52 | PK11SlotInfo *a_slot, |
michael@0 | 53 | PK11AttrFlags a_flags, |
michael@0 | 54 | PK11SlotInfo *a_alternative_slot, |
michael@0 | 55 | PK11AttrFlags a_alternative_flags, |
michael@0 | 56 | uint32_t a_keyGenMechanism, |
michael@0 | 57 | void *a_params, |
michael@0 | 58 | void *a_wincx ); |
michael@0 | 59 | |
michael@0 | 60 | nsresult ConsumeResult( |
michael@0 | 61 | PK11SlotInfo **a_used_slot, |
michael@0 | 62 | SECKEYPrivateKey **a_privateKey, |
michael@0 | 63 | SECKEYPublicKey **a_publicKey); |
michael@0 | 64 | |
michael@0 | 65 | void Join(void); |
michael@0 | 66 | |
michael@0 | 67 | void Run(void); |
michael@0 | 68 | }; |
michael@0 | 69 | |
michael@0 | 70 | #endif //_NSKEYGENTHREAD_H_ |