Bug 408808 - "nsProxiedService.h should not use NS_GetProxyForObject" [p=prasad@medhas.org (Prasad Sunkari [prasad]) r=bsmedberg sr=Neil a1.9=schrep]
authorreed@reedloden.com
Wed, 16 Jan 2008 23:52:17 -0800
changeset 10358 7c76417436280d2232a1977cab04792cbbac3c8b
parent 10357 899accd1bd36731a99a41dd488e24d4e3a757a10
child 10359 88d846676f0354dbd290f6520b037859d756b4f5
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg, Neil
bugs408808
milestone1.9b3pre
Bug 408808 - "nsProxiedService.h should not use NS_GetProxyForObject" [p=prasad@medhas.org (Prasad Sunkari [prasad]) r=bsmedberg sr=Neil a1.9=schrep]
xpcom/proxy/public/nsProxiedService.h
--- a/xpcom/proxy/public/nsProxiedService.h
+++ b/xpcom/proxy/public/nsProxiedService.h
@@ -34,18 +34,19 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsProxiedService_h__
 #define nsProxiedService_h__
 
-#include "nsIServiceManager.h"
+#include "nsServiceManagerUtils.h"
 #include "nsIProxyObjectManager.h"
+#include "nsXPCOMCIDInternal.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // NS_WITH_PROXIED_SERVICE: macro to make using services that need to be proxied
 //                                   before using them easier. 
 // Now you can replace this:
 // {
 //      nsresult rv;
 //      nsCOMPtr<nsIMyService> pIMyService = 
@@ -120,19 +121,23 @@ private:
 
     void InitProxy(nsISupports *aObj, const nsIID &aIID,
                    nsIEventTarget* aTarget, PRBool always, nsresult*rv)
     {
         PRInt32 proxyType = NS_PROXY_SYNC;
         if (always)
             proxyType |= NS_PROXY_ALWAYS;
 
-        *rv = NS_GetProxyForObject(aTarget, 
-                                   aIID, 
-                                   aObj,
-                                   proxyType, 
-                                   getter_AddRefs(mProxiedService));
+        nsCOMPtr<nsIProxyObjectManager> proxyObjMgr = do_GetService(NS_XPCOMPROXY_CONTRACTID, rv);
+        if (NS_FAILED(*rv))
+          return;
+
+        *rv = proxyObjMgr->GetProxyForObject(aTarget,
+                                             aIID,
+                                             aObj,
+                                             proxyType,
+                                             getter_AddRefs(mProxiedService));
     }
 
     nsCOMPtr<nsISupports> mProxiedService;
 };
 
 #endif // nsProxiedService_h__