From efd0cccb1877d9a23850e7ddfe2814ab62870714 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 26 Jul 2010 15:59:34 -0400 Subject: [PATCH] Bug 580450 - Clean up IPC::URI. r=dwitte --- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 10 +++++----- extensions/cookie/nsPermissionManager.cpp | 4 ++-- netwerk/cookie/CookieServiceParent.cpp | 8 ++++---- netwerk/ipc/NeckoMessageUtils.h | 12 ++++++------ netwerk/protocol/http/HttpChannelParent.cpp | 10 +++++----- toolkit/components/places/src/History.cpp | 8 ++++---- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 72aa9b0a51d..6f17a16f708 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -351,7 +351,7 @@ ContentChild::RecvNotifyRemotePrefObserver(const nsCString& aPref) bool ContentChild::RecvNotifyVisited(const IPC::URI& aURI) { - nsCOMPtr newURI = aURI; + nsCOMPtr newURI(aURI); History::GetService()->NotifyVisited(newURI); return true; } diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index f94531bf701..855ea2ff154 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -277,7 +277,7 @@ ContentParent::RecvTestPermission(const IPC::URI& aUri, { EnsurePermissionService(); - nsCOMPtr uri = aUri; + nsCOMPtr uri(aUri); if (aExact) { mPermissionService->TestExactPermission(uri, aType.get(), retValue); } else { @@ -435,7 +435,7 @@ ContentParent::RequestRunToCompletion() bool ContentParent::RecvStartVisitedQuery(const IPC::URI& aURI) { - nsCOMPtr newURI = aURI; + nsCOMPtr newURI(aURI); IHistory *history = nsContentUtils::GetHistory(); history->RegisterVisitedCallback(newURI, nsnull); return true; @@ -447,8 +447,8 @@ ContentParent::RecvVisitURI(const IPC::URI& uri, const IPC::URI& referrer, const PRUint32& flags) { - nsCOMPtr ourURI = uri; - nsCOMPtr ourReferrer = referrer; + nsCOMPtr ourURI(uri); + nsCOMPtr ourReferrer(referrer); IHistory *history = nsContentUtils::GetHistory(); history->VisitURI(ourURI, ourReferrer, flags); return true; @@ -459,7 +459,7 @@ bool ContentParent::RecvSetURITitle(const IPC::URI& uri, const nsString& title) { - nsCOMPtr ourURI = uri; + nsCOMPtr ourURI(uri); IHistory *history = nsContentUtils::GetHistory(); history->SetURITitle(ourURI, title); return true; diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp index 9230e731aee..5933beedd9a 100644 --- a/extensions/cookie/nsPermissionManager.cpp +++ b/extensions/cookie/nsPermissionManager.cpp @@ -594,7 +594,7 @@ nsPermissionManager::TestExactPermission(nsIURI *aURI, #ifdef MOZ_IPC ContentChild* cpc = ChildProcess(); if (cpc) { - return cpc->SendTestPermission(IPC::URI(aURI), nsDependentCString(aType), PR_TRUE, + return cpc->SendTestPermission(aURI, nsDependentCString(aType), PR_TRUE, aPermission) ? NS_OK : NS_ERROR_FAILURE; } #endif @@ -609,7 +609,7 @@ nsPermissionManager::TestPermission(nsIURI *aURI, #ifdef MOZ_IPC ContentChild* cpc = ChildProcess(); if (cpc) { - return cpc->SendTestPermission(IPC::URI(aURI), nsDependentCString(aType), PR_FALSE, + return cpc->SendTestPermission(aURI, nsDependentCString(aType), PR_FALSE, aPermission) ? NS_OK : NS_ERROR_FAILURE; } #endif diff --git a/netwerk/cookie/CookieServiceParent.cpp b/netwerk/cookie/CookieServiceParent.cpp index aab9e3751ca..0c2a55de228 100644 --- a/netwerk/cookie/CookieServiceParent.cpp +++ b/netwerk/cookie/CookieServiceParent.cpp @@ -70,8 +70,8 @@ CookieServiceParent::RecvGetCookieString(const IPC::URI& aHost, // Deserialize URIs. Having a host URI is mandatory and should always be // provided by the child; thus we consider failure fatal. - nsCOMPtr hostURI = aHost; - nsCOMPtr originatingURI = aOriginating; + nsCOMPtr hostURI(aHost); + nsCOMPtr originatingURI(aOriginating); if (!hostURI) return false; @@ -92,8 +92,8 @@ CookieServiceParent::RecvSetCookieString(const IPC::URI& aHost, // Deserialize URIs. Having a host URI is mandatory and should always be // provided by the child; thus we consider failure fatal. - nsCOMPtr hostURI = aHost; - nsCOMPtr originatingURI = aOriginating; + nsCOMPtr hostURI(aHost); + nsCOMPtr originatingURI(aOriginating); if (!hostURI) return false; diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h index e1eca945dfc..ecb3dc194e6 100644 --- a/netwerk/ipc/NeckoMessageUtils.h +++ b/netwerk/ipc/NeckoMessageUtils.h @@ -57,15 +57,15 @@ class URI { public: URI() : mURI(nsnull) {} URI(nsIURI* aURI) : mURI(aURI) {} - // The contained URI is already addrefed on creation. We don't want another - // addref when passing it off to its actual owner. - operator nsCOMPtr() const { return already_AddRefed(mURI); } + operator nsIURI*() const { return mURI.get(); } friend struct ParamTraits; private: + // Unimplemented URI& operator=(URI&); - nsIURI* mURI; + + nsCOMPtr mURI; }; template<> @@ -136,7 +136,7 @@ struct ParamTraits if (NS_FAILED(rv)) return false; - uri.forget(&aResult->mURI); + uri.swap(aResult->mURI); return true; } @@ -153,7 +153,7 @@ struct ParamTraits if (!serializable || !serializable->Read(aMsg, aIter)) return false; - uri.forget(&aResult->mURI); + uri.swap(aResult->mURI); return true; } diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index ddc1571f109..57a9f16d1c1 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -107,11 +107,11 @@ HttpChannelParent::RecvAsyncOpen(const IPC::URI& aURI, const PRBool& allowPipelining, const PRBool& forceAllowThirdPartyCookie) { - nsCOMPtr uri = aURI; - nsCOMPtr originalUri = aOriginalURI; - nsCOMPtr docUri = aDocURI; - nsCOMPtr referrerUri = aReferrerURI; - + nsCOMPtr uri(aURI); + nsCOMPtr originalUri(aOriginalURI); + nsCOMPtr docUri(aDocURI); + nsCOMPtr referrerUri(aReferrerURI); + nsCString uriSpec; uri->GetSpec(uriSpec); LOG(("HttpChannelParent RecvAsyncOpen [this=%x uri=%s]\n", diff --git a/toolkit/components/places/src/History.cpp b/toolkit/components/places/src/History.cpp index 44b82037d65..76ef969dccc 100644 --- a/toolkit/components/places/src/History.cpp +++ b/toolkit/components/places/src/History.cpp @@ -173,7 +173,7 @@ public: mozilla::dom::ContentChild * cpc = mozilla::dom::ContentChild::GetSingleton(); NS_ASSERTION(cpc, "Content Protocol is NULL!"); - (void)cpc->SendStartVisitedQuery(IPC::URI(aURI)); + (void)cpc->SendStartVisitedQuery(aURI); return NS_OK; } #endif @@ -984,7 +984,7 @@ History::NotifyVisited(nsIURI* aURI) mozilla::dom::ContentParent* cpp = mozilla::dom::ContentParent::GetSingleton(PR_FALSE); if (cpp) - (void)cpp->SendNotifyVisited(IPC::URI(aURI)); + (void)cpp->SendNotifyVisited(aURI); } #endif @@ -1089,7 +1089,7 @@ History::VisitURI(nsIURI* aURI, mozilla::dom::ContentChild * cpc = mozilla::dom::ContentChild::GetSingleton(); NS_ASSERTION(cpc, "Content Protocol is NULL!"); - (void)cpc->SendVisitURI(IPC::URI(aURI), IPC::URI(aLastVisitedURI), aFlags); + (void)cpc->SendVisitURI(aURI, aLastVisitedURI, aFlags); return NS_OK; } #endif /* MOZ_IPC */ @@ -1268,7 +1268,7 @@ History::SetURITitle(nsIURI* aURI, const nsAString& aTitle) mozilla::dom::ContentChild * cpc = mozilla::dom::ContentChild::GetSingleton(); NS_ASSERTION(cpc, "Content Protocol is NULL!"); - (void)cpc->SendSetURITitle(IPC::URI(aURI), nsDependentString(aTitle)); + (void)cpc->SendSetURITitle(aURI, nsDependentString(aTitle)); return NS_OK; } #endif /* MOZ_IPC */