Backed out changesets febbccd1cd1e and d834e57b0352 (bug 1137019) for making bug 1123563 permafail on Android 2.3.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2015-03-10 16:45:01 -04:00
parent 2f92d267be
commit 5c46df90e1
3 changed files with 61 additions and 27 deletions

View File

@ -589,6 +589,46 @@ imgRequest::CacheChanged(nsIRequest* aNewRequest)
return true;
}
nsresult
imgRequest::LockImage()
{
return mImage->LockImage();
}
nsresult
imgRequest::UnlockImage()
{
return mImage->UnlockImage();
}
nsresult
imgRequest::RequestDecode()
{
// If we've initialized our image, we can request a decode.
if (mImage) {
return mImage->RequestDecode();
}
// Otherwise, flag to do it when we get the image
mDecodeRequested = true;
return NS_OK;
}
nsresult
imgRequest::StartDecoding()
{
// If we've initialized our image, we can request a decode.
if (mImage) {
return mImage->StartDecoding();
}
// Otherwise, flag to do it when we get the image
mDecodeRequested = true;
return NS_OK;
}
/** nsIRequestObserver methods **/
/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */

View File

@ -19,7 +19,6 @@
#include "nsStringGlue.h"
#include "nsError.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "mozilla/Atomics.h"
#include "mozilla/net/ReferrerPolicy.h"
class imgCacheValidator;
@ -88,8 +87,12 @@ public:
// Called or dispatched by EvictFromCache for main thread only execution.
void ContinueEvict();
// Request that we start decoding the image as soon as data becomes available.
void RequestDecode() { mDecodeRequested = true; }
// Methods that get forwarded to the Image, or deferred until it's
// instantiated.
nsresult LockImage();
nsresult UnlockImage();
nsresult StartDecoding();
nsresult RequestDecode();
inline void SetInnerWindowID(uint64_t aInnerWindowId) {
mInnerWindowId = aInnerWindowId;
@ -261,7 +264,9 @@ private:
nsresult mImageErrorCode;
mozilla::Atomic<bool> mDecodeRequested;
// Sometimes consumers want to do things before the image is ready. Let them,
// and apply the action when the image becomes available.
bool mDecodeRequested : 1;
bool mIsMultiPartChannel : 1;
bool mGotData : 1;

View File

@ -224,9 +224,8 @@ nsresult imgRequestProxy::ChangeOwner(imgRequest *aNewOwner)
// If we were decoded, or if we'd previously requested a decode, request a
// decode on the new image
if (wasDecoded || mDecodeRequested) {
StartDecoding();
}
if (wasDecoded || mDecodeRequested)
GetOwner()->StartDecoding();
return NS_OK;
}
@ -353,38 +352,28 @@ NS_IMETHODIMP imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
NS_IMETHODIMP
imgRequestProxy::StartDecoding()
{
if (!GetOwner())
return NS_ERROR_FAILURE;
// Flag this, so we know to transfer the request if our owner changes
mDecodeRequested = true;
nsRefPtr<Image> image = GetImage();
if (image) {
return image->StartDecoding();
}
if (GetOwner()) {
GetOwner()->RequestDecode();
}
return NS_OK;
// Forward the request
return GetOwner()->StartDecoding();
}
/* void requestDecode (); */
NS_IMETHODIMP
imgRequestProxy::RequestDecode()
{
if (!GetOwner())
return NS_ERROR_FAILURE;
// Flag this, so we know to transfer the request if our owner changes
mDecodeRequested = true;
nsRefPtr<Image> image = GetImage();
if (image) {
return image->RequestDecode();
}
if (GetOwner()) {
GetOwner()->RequestDecode();
}
return NS_OK;
// Forward the request
return GetOwner()->RequestDecode();
}