Bug 382267. Addressing jst review comments. r+sr=roc
authorChris Double <chris.double@double.co.nz>
Wed, 09 Jul 2008 21:50:08 +1200
changeset 15754 ec1f8bfd1a99227714a9a30b6f87695d33ee529a
parent 15753 43558b8a21c16ad7c24c0285e6d848bf9f309998
child 15755 024ed893e13b686a09d46861dea349f47bb679da
push id473
push userrocallahan@mozilla.com
push dateWed, 09 Jul 2008 09:50:28 +0000
treeherdermozilla-central@ec1f8bfd1a99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs382267
milestone1.9.1a1pre
Bug 382267. Addressing jst review comments. r+sr=roc
content/events/src/nsDOMProgressEvent.cpp
content/html/content/src/nsHTMLMediaElement.cpp
--- a/content/events/src/nsDOMProgressEvent.cpp
+++ b/content/events/src/nsDOMProgressEvent.cpp
@@ -46,34 +46,31 @@ NS_INTERFACE_MAP_BEGIN(nsDOMProgressEven
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
 
 NS_IMPL_ADDREF_INHERITED(nsDOMProgressEvent, nsDOMEvent)
 NS_IMPL_RELEASE_INHERITED(nsDOMProgressEvent, nsDOMEvent)
 
 NS_IMETHODIMP
 nsDOMProgressEvent::GetLengthComputable(PRBool* aLengthComputable)
 {
-  if (aLengthComputable)
-    *aLengthComputable = mLengthComputable;
+  *aLengthComputable = mLengthComputable;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMProgressEvent::GetLoaded(PRUint32* aLoaded)
 {
-  if (aLoaded)
-    *aLoaded = mLoaded;
+  *aLoaded = mLoaded;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMProgressEvent::GetTotal(PRUint32* aTotal)
 {
-  if (aTotal)
-    *aTotal = mTotal;
+  *aTotal = mTotal;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMProgressEvent::InitProgressEvent(const nsAString& aType,
                                       PRBool aCanBubble,
                                       PRBool aCancelable,
                                       PRBool aLengthComputable,
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -118,19 +118,17 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCur
   aCurrentSrc = NS_ConvertUTF8toUTF16(src);
 
   return NS_OK;
 }
 
 /* readonly attribute unsigned short networkState; */
 NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
 {
-  if (aNetworkState) {
-    *aNetworkState = mNetworkState;
-  }
+  *aNetworkState = mNetworkState;
 
   return NS_OK;
 }
 
 /* readonly attribute float bufferingRate; */
 NS_IMETHODIMP nsHTMLMediaElement::GetBufferingRate(float *aBufferingRate)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -187,29 +185,25 @@ NS_IMETHODIMP nsHTMLMediaElement::Load()
   DispatchAsyncProgressEvent(NS_LITERAL_STRING("loadstart"));
 
   return NS_OK;
 }
 
 /* readonly attribute unsigned short readyState; */
 NS_IMETHODIMP nsHTMLMediaElement::GetReadyState(PRUint16 *aReadyState)
 {
-  if (aReadyState) {
-    *aReadyState = mReadyState;
-  }
+  *aReadyState = mReadyState;
 
   return NS_OK;
 }
 
 /* readonly attribute boolean seeking; */
 NS_IMETHODIMP nsHTMLMediaElement::GetSeeking(PRBool *aSeeking)
 {
-  if (aSeeking) {
-    *aSeeking = mSeeking;
-  }
+  *aSeeking = mSeeking;
 
   return NS_OK;
 }
 
 /* attribute float currentTime; */
 NS_IMETHODIMP nsHTMLMediaElement::GetCurrentTime(float *aCurrentTime)
 {
   *aCurrentTime = mDecoder ? mDecoder->GetCurrentTime() : 0.0;
@@ -219,34 +213,24 @@ NS_IMETHODIMP nsHTMLMediaElement::GetCur
 NS_IMETHODIMP nsHTMLMediaElement::SetCurrentTime(float aCurrentTime)
 {
   return mDecoder ? mDecoder->Seek(aCurrentTime) : NS_ERROR_DOM_INVALID_STATE_ERR;
 }
 
 /* readonly attribute float duration; */
 NS_IMETHODIMP nsHTMLMediaElement::GetDuration(float *aDuration)
 {
-  if (!aDuration)
-    return NS_OK;
-
-  if (!mDecoder) {
-    *aDuration = 0.0;
-    return NS_OK;
-  }
-
-  *aDuration = mDecoder->GetDuration();
+  *aDuration =  mDecoder ? mDecoder->GetDuration() : 0.0;
   return NS_OK;
 }
 
 /* readonly attribute unsigned short paused; */
 NS_IMETHODIMP nsHTMLMediaElement::GetPaused(PRUint16 *aPaused)
 {
-  if (aPaused) {
-    *aPaused = mPaused;
-  }
+  *aPaused = mPaused;
 
   return NS_OK;
 }
 
 /* readonly attribute nsIDOMHTMLTimeRanges played; */
 NS_IMETHODIMP nsHTMLMediaElement::GetPlayed(nsIDOMHTMLTimeRanges * *aPlayed)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
@@ -256,33 +240,29 @@ NS_IMETHODIMP nsHTMLMediaElement::GetPla
 NS_IMETHODIMP nsHTMLMediaElement::GetSeekable(nsIDOMHTMLTimeRanges * *aSeekable)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 /* readonly attribute boolean ended; */
 NS_IMETHODIMP nsHTMLMediaElement::GetEnded(PRBool *aEnded)
 {
-  if (aEnded)
-    *aEnded = mEnded;
+  *aEnded = mEnded;
 
   return NS_OK;
 }
 
 /* attribute boolean autoplay; */
 NS_IMETHODIMP nsHTMLMediaElement::GetAutoplay(PRBool *aAutoplay)
 {
-  if (!aAutoplay)
-    return NS_OK;
-
   if (HasAttr(kNameSpaceID_None, nsGkAtoms::autoplay)) 
     *aAutoplay = PR_TRUE;
   else
     *aAutoplay = PR_FALSE;
-
+  
   return NS_OK;
 }
 NS_IMETHODIMP nsHTMLMediaElement::SetAutoplay(PRBool aAutoplay)
 {
   return SetAttr(kNameSpaceID_None, 
                  nsGkAtoms::autoplay,
                  NS_LITERAL_STRING("true"),
                  PR_TRUE);
@@ -407,18 +387,17 @@ NS_IMETHODIMP nsHTMLMediaElement::SetVol
     DispatchSimpleEvent(NS_LITERAL_STRING("volumechange"));
   }
   return NS_OK;
 }
 
 /* attribute boolean muted; */
 NS_IMETHODIMP nsHTMLMediaElement::GetMuted(PRBool *aMuted)
 {
-  if (*aMuted)
-    *aMuted = mMuted;
+  *aMuted = mMuted;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsHTMLMediaElement::SetMuted(PRBool aMuted)
 {
   PRBool oldMuted = mMuted;