Bug 850253 - Remove Off-Main-Thread XPCWrappedJS refcounting from KeyGenRunnable. r=jedp
authorBobby Holley <bobbyholley@gmail.com>
Thu, 11 Apr 2013 14:05:35 -0700
changeset 128588 43acb3f9b06b35aaa23f2d708f180f5c39621ebc
parent 128587 25323c442d1adf6320d69f57310439fcac1425e3
child 128589 76166b14908a0e48a30b2647805005f8c9865f65
push id24532
push userryanvm@gmail.com
push dateFri, 12 Apr 2013 19:06:49 +0000
treeherdermozilla-central@2aff2d574a1e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjedp
bugs850253
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 850253 - Remove Off-Main-Thread XPCWrappedJS refcounting from KeyGenRunnable. r=jedp
toolkit/identity/IdentityCryptoService.cpp
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -6,16 +6,17 @@
 
 #include "nsIIdentityCryptoService.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsNSSShutDown.h"
 #include "nsIThread.h"
 #include "nsThreadUtils.h"
 #include "nsCOMPtr.h"
+#include "nsProxyRelease.h"
 #include "nsStringGlue.h"
 #include "mozilla/Base64.h"
 #include "mozilla/Util.h" // ArrayLength
 #include "ScopedNSSTypes.h"
 
 #include "nss.h"
 #include "pk11pub.h"
 #include "secmod.h"
@@ -132,17 +133,17 @@ private:
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown())
       return;
 
      mKeyPair = NULL;
   }
 
   const KeyType mKeyType; // in
-  nsCOMPtr<nsIIdentityKeyGenCallback> mCallback; // in
+  nsMainThreadPtrHandle<nsIIdentityKeyGenCallback> mCallback; // in
   nsresult mRv; // out
   nsCOMPtr<KeyPair> mKeyPair; // out
 
   KeyGenRunnable(const KeyGenRunnable &) MOZ_DELETE;
   void operator=(const KeyGenRunnable &) MOZ_DELETE;
 };
 
 class SignRunnable : public nsRunnable, public nsNSSShutDownObject
@@ -329,17 +330,17 @@ KeyPair::Sign(const nsACString & textToS
   nsCOMPtr<nsIThread> thread;
   nsresult rv = NS_NewThread(getter_AddRefs(thread), r);
   return rv;
 }
 
 KeyGenRunnable::KeyGenRunnable(KeyType keyType,
                                nsIIdentityKeyGenCallback * callback)
   : mKeyType(keyType)
-  , mCallback(callback)
+  , mCallback(new nsMainThreadPtrHolder<nsIIdentityKeyGenCallback>(callback))
   , mRv(NS_ERROR_NOT_INITIALIZED)
 {
 }
 
 MOZ_WARN_UNUSED_RESULT nsresult
 GenerateKeyPair(PK11SlotInfo * slot,
                 SECKEYPrivateKey ** privateKey,
                 SECKEYPublicKey ** publicKey,