Skip to content

Commit

Permalink
Bug 1207355 (Part 8) - Remove imgIContainer::RequestDecode() and imgI…
Browse files Browse the repository at this point in the history
…Request::RequestDecode(). r=tn
  • Loading branch information
sethfowler committed Oct 29, 2015
1 parent 66fb01a commit 6598853
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 75 deletions.
6 changes: 0 additions & 6 deletions image/DynamicImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,6 @@ DynamicImage::Draw(gfxContext* aContext,
return DrawResult::SUCCESS;
}

NS_IMETHODIMP
DynamicImage::RequestDecode()
{
return NS_OK;
}

NS_IMETHODIMP
DynamicImage::StartDecoding()
{
Expand Down
6 changes: 0 additions & 6 deletions image/ImageWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,6 @@ ImageWrapper::Draw(gfxContext* aContext,
aFilter, aSVGContext, aFlags);
}

NS_IMETHODIMP
ImageWrapper::RequestDecode()
{
return mInnerImage->RequestDecode();
}

NS_IMETHODIMP
ImageWrapper::StartDecoding()
{
Expand Down
11 changes: 1 addition & 10 deletions image/RasterImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1166,15 +1166,6 @@ RasterImage::CanDiscard() {
!mAnim; // Can never discard animated images
}

//******************************************************************************

NS_IMETHODIMP
RasterImage::RequestDecode()
{
return RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
}


NS_IMETHODIMP
RasterImage::StartDecoding()
{
Expand Down Expand Up @@ -1799,7 +1790,7 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder)
// If we were a metadata decode and a full decode was requested, do it.
if (done && wasMetadata && mWantFullDecode) {
mWantFullDecode = false;
RequestDecode();
RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
}
}

Expand Down
9 changes: 0 additions & 9 deletions image/VectorImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,15 +964,6 @@ VectorImage::RecoverFromLossOfSurfaces()
SurfaceCache::RemoveImage(ImageKey(this));
}

//******************************************************************************

NS_IMETHODIMP
VectorImage::RequestDecode()
{
// Nothing to do for SVG images
return NS_OK;
}

NS_IMETHODIMP
VectorImage::StartDecoding()
{
Expand Down
20 changes: 7 additions & 13 deletions image/imgIContainer.idl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ native nsIntSizeByVal(nsIntSize);
*
* Internally, imgIContainer also manages animation of images.
*/
[scriptable, builtinclass, uuid(7c795421-a79c-43ac-9e20-6d4e8a9dfb76)]
[scriptable, builtinclass, uuid(a8dbee24-ff86-4755-b40e-51175caf31af)]
interface imgIContainer : nsISupports
{
/**
Expand Down Expand Up @@ -383,22 +383,16 @@ interface imgIContainer : nsISupports

/*
* Ensures that an image is decoding. Calling this function guarantees that
* the image will at some point fire off decode notifications. Calling draw()
* or getFrame() triggers the same mechanism internally. Thus, if you want to
* be sure that the image will be decoded but don't want to access it until
* then, you must call requestDecode().
*/
void requestDecode();

/*
* This is equivalent to requestDecode() but it also synchronously decodes
* images that can be decoded "quickly" according to some heuristic.
* the image will at some point fire off decode notifications. Images that
* can be decoded "quickly" according to some heuristic will be decoded
* synchronously.
*/
[noscript] void startDecoding();

/*
* This method is equivalent to requestDecode(), but enables the caller to
* provide more detailed information about the decode request.
* This method triggers decoding for an image, but unlike startDecoding() it
* enables the caller to provide more detailed information about the decode
* request.
*
* @param aSize The size to which the image should be scaled while decoding,
* if possible. If the image cannot be scaled to this size while
Expand Down
13 changes: 6 additions & 7 deletions image/imgIRequest.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface nsIPrincipal;
* @version 0.1
* @see imagelib2
*/
[scriptable, builtinclass, uuid(4cb01f0a-ef94-4345-a8d7-1a93f15ff548)]
[scriptable, builtinclass, uuid(db0a945c-3883-424a-98d0-2ee0523b0255)]
interface imgIRequest : nsIRequest
{
/**
Expand Down Expand Up @@ -145,15 +145,14 @@ interface imgIRequest : nsIRequest
void cancelAndForgetObserver(in nsresult aStatus);

/**
* Requests a decode for the image.
* Requests a synchronous decode for the image.
*
* imgIContainer has a requestDecode() method, but callers may want to request
* imgIContainer has a startDecoding() method, but callers may want to request
* a decode before the container has necessarily been instantiated. Calling
* requestDecode() on the imgIRequest simply forwards along the request if the
* container already exists, or calls it once it gets OnStartContainer if the
* container does not yet exist.
* startDecoding() on the imgIRequest simply forwards along the request if the
* container already exists, or calls it once the container becomes available
* if it does not yet exist.
*/
void requestDecode();
void startDecoding();

/**
Expand Down
4 changes: 2 additions & 2 deletions image/imgLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ imgLoader::ValidateRequestWithNewChannel(imgRequest* request,
// We will send notifications from imgCacheValidator::OnStartRequest().
// In the mean time, we must defer notifications because we are added to
// the imgRequest's proxy list, and we can get extra notifications
// resulting from methods such as RequestDecode(). See bug 579122.
// resulting from methods such as StartDecoding(). See bug 579122.
proxy->SetNotificationsDeferred(true);

// Attach the proxy without notifying
Expand Down Expand Up @@ -1666,7 +1666,7 @@ imgLoader::ValidateRequestWithNewChannel(imgRequest* request,
// We will send notifications from imgCacheValidator::OnStartRequest().
// In the mean time, we must defer notifications because we are added to
// the imgRequest's proxy list, and we can get extra notifications
// resulting from methods such as RequestDecode(). See bug 579122.
// resulting from methods such as StartDecoding(). See bug 579122.
req->SetNotificationsDeferred(true);

// Add the proxy without notifying
Expand Down
2 changes: 1 addition & 1 deletion image/imgRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ imgRequest::ContinueEvict()
}

void
imgRequest::RequestDecode()
imgRequest::StartDecoding()
{
MutexAutoLock lock(mMutex);
mDecodeRequested = true;
Expand Down
4 changes: 2 additions & 2 deletions image/imgRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class imgRequest final : public nsIStreamListener,
void ContinueEvict();

// Request that we start decoding the image as soon as data becomes available.
void RequestDecode();
void StartDecoding();

inline uint64_t InnerWindowID() const {
return mInnerWindowId;
Expand Down Expand Up @@ -220,7 +220,7 @@ class imgRequest final : public nsIStreamListener,
// Update the cache entry size based on the image container.
void UpdateCacheEntrySize();

/// Returns true if RequestDecode() was called.
/// Returns true if StartDecoding() was called.
bool IsDecodeRequested() const;

// Weak reference to parent loader; this request cannot outlive its owner.
Expand Down
9 changes: 1 addition & 8 deletions image/imgRequestProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,19 +371,12 @@ imgRequestProxy::StartDecoding()
}

if (GetOwner()) {
GetOwner()->RequestDecode();
GetOwner()->StartDecoding();
}

return NS_OK;
}

NS_IMETHODIMP
imgRequestProxy::RequestDecode()
{
return NS_OK;
}


NS_IMETHODIMP
imgRequestProxy::LockImage()
{
Expand Down
6 changes: 0 additions & 6 deletions image/test/unit/image_load_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ function ImageListener(start_callback, stop_callback)
{
do_check_false(this.synchronous);

try {
aRequest.requestDecode();
} catch (e) {
do_print("requestDecode threw " + e);
}

this.state |= LOAD_COMPLETE;

if (this.stop_callback)
Expand Down
4 changes: 2 additions & 2 deletions layout/reftests/generated-content/reftest.list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
skip-if(B2G||Mulet) == display-types-01.html display-types-01-ref.html # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
skip-if(B2G||Mulet) fuzzy-if(OSX==1010,1,3) == display-types-01.html display-types-01-ref.html # bug 773482 # Initial mulet triage: parity with B2G/B2G Desktop
== dynamic-attr-01.html dynamic-attr-01-ref.html
== dynamic-button-01a.html dynamic-button-01-ref.html
== dynamic-button-01b.html dynamic-button-01-ref.html
Expand All @@ -12,4 +12,4 @@ skip-if(B2G||Mulet) == display-types-01.html display-types-01-ref.html # bug 773
== positioned-01.html positioned-01-ref.html
== quotes-001.xml quotes-001-ref.xml
== table-ignoring-whitespace-01.html table-ignoring-whitespace-01-ref.html
== table-parts-01.html table-parts-01-ref.html
fuzzy-if(OSX==1010,1,1) == table-parts-01.html table-parts-01-ref.html
3 changes: 0 additions & 3 deletions layout/style/nsStyleStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,6 @@ struct nsStyleBorder {
return mBorderImageSource.IsLoaded();
}

// Defined in nsStyleStructInlines.h
inline nsresult RequestDecode();

void GetBorderColor(mozilla::css::Side aSide, nscolor& aColor,
bool& aForeground) const
{
Expand Down

0 comments on commit 6598853

Please sign in to comment.