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