Bug 869893 - Remove Off-Main-Thread XPCWrappedJS refcounting from SignRunnable. r=jedp
authorJosh Matthews <josh@joshmatthews.net>
Wed, 08 May 2013 10:50:36 -0400
changeset 138037 c0057a14ffc56f828593bf0ad224f35f601c4450
parent 138036 d95ddf1d37b09e50c3ea2a90a755c09621c81c71
child 138038 2d98636bc27bb9b5d7a06543279e6327ef31b891
push idunknown
push userunknown
push dateunknown
reviewersjedp
bugs869893
milestone23.0a1
Bug 869893 - Remove Off-Main-Thread XPCWrappedJS refcounting from SignRunnable. r=jedp
toolkit/identity/IdentityCryptoService.cpp
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -173,17 +173,17 @@ private:
       return;
 
     SECKEY_DestroyPrivateKey(mPrivateKey);
     mPrivateKey = NULL;
   }
 
   const nsCString mTextToSign; // in
   SECKEYPrivateKey* mPrivateKey; // in
-  const nsCOMPtr<nsIIdentitySignCallback> mCallback; // in
+  nsMainThreadPtrHandle<nsIIdentitySignCallback> mCallback; // in
   nsresult mRv; // out
   nsCString mSignature; // out
 
 private:
   SignRunnable(const SignRunnable &) MOZ_DELETE;
   void operator=(const SignRunnable &) MOZ_DELETE;
 };
 
@@ -491,17 +491,17 @@ KeyGenRunnable::Run()
   return NS_OK;
 }
 
 SignRunnable::SignRunnable(const nsACString & aText,
                            SECKEYPrivateKey * privateKey,
                            nsIIdentitySignCallback * aCallback)
   : mTextToSign(aText)
   , mPrivateKey(SECKEY_CopyPrivateKey(privateKey))
-  , mCallback(aCallback)
+  , mCallback(new nsMainThreadPtrHolder<nsIIdentitySignCallback>(aCallback))
   , mRv(NS_ERROR_NOT_INITIALIZED)
 {
 }
 
 NS_IMETHODIMP
 SignRunnable::Run()
 {
   if (!NS_IsMainThread()) {