2012-10-12 09:11:22 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ScriptedNotificationObserver.h"
|
|
|
|
#include "imgIScriptedNotificationObserver.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
2014-07-10 08:00:31 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace image {
|
2012-10-12 09:11:22 -07:00
|
|
|
|
2014-04-25 09:49:00 -07:00
|
|
|
NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
|
2012-10-12 09:11:22 -07:00
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScriptedNotificationObserver)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver)
|
|
|
|
|
|
|
|
ScriptedNotificationObserver::ScriptedNotificationObserver(
|
|
|
|
imgIScriptedNotificationObserver* aInner)
|
|
|
|
: mInner(aInner)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
|
|
|
|
int32_t aType,
|
|
|
|
const nsIntRect* /*aUnused*/)
|
|
|
|
{
|
2012-10-12 09:11:23 -07:00
|
|
|
if (aType == imgINotificationObserver::SIZE_AVAILABLE)
|
|
|
|
return mInner->SizeAvailable(aRequest);
|
|
|
|
if (aType == imgINotificationObserver::FRAME_UPDATE)
|
|
|
|
return mInner->FrameUpdate(aRequest);
|
|
|
|
if (aType == imgINotificationObserver::FRAME_COMPLETE)
|
|
|
|
return mInner->FrameComplete(aRequest);
|
|
|
|
if (aType == imgINotificationObserver::DECODE_COMPLETE)
|
|
|
|
return mInner->DecodeComplete(aRequest);
|
|
|
|
if (aType == imgINotificationObserver::LOAD_COMPLETE)
|
|
|
|
return mInner->LoadComplete(aRequest);
|
2012-10-12 09:11:22 -07:00
|
|
|
if (aType == imgINotificationObserver::DISCARD)
|
2012-10-12 09:11:22 -07:00
|
|
|
return mInner->Discard(aRequest);
|
2012-10-12 09:11:22 -07:00
|
|
|
if (aType == imgINotificationObserver::IS_ANIMATED)
|
|
|
|
return mInner->IsAnimated(aRequest);
|
2014-11-17 11:16:45 -08:00
|
|
|
if (aType == imgINotificationObserver::HAS_TRANSPARENCY)
|
|
|
|
return mInner->HasTransparency(aRequest);
|
2012-10-12 09:11:22 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2014-07-10 08:00:31 -07:00
|
|
|
|
|
|
|
} // namespace image
|
|
|
|
} // namespace mozilla
|