1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "ScriptedNotificationObserver.h"
8 #include "imgIScriptedNotificationObserver.h"
9 #include "nsCycleCollectionParticipant.h"
11 using namespace mozilla::image
;
13 NS_IMPL_CYCLE_COLLECTION_1(ScriptedNotificationObserver
, mInner
)
15 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScriptedNotificationObserver
)
16 NS_INTERFACE_MAP_ENTRY(imgINotificationObserver
)
17 NS_INTERFACE_MAP_ENTRY(nsISupports
)
20 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver
)
21 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver
)
23 ScriptedNotificationObserver::ScriptedNotificationObserver(
24 imgIScriptedNotificationObserver
* aInner
)
30 ScriptedNotificationObserver::Notify(imgIRequest
* aRequest
,
32 const nsIntRect
* /*aUnused*/)
34 if (aType
== imgINotificationObserver::SIZE_AVAILABLE
)
35 return mInner
->SizeAvailable(aRequest
);
36 if (aType
== imgINotificationObserver::FRAME_UPDATE
)
37 return mInner
->FrameUpdate(aRequest
);
38 if (aType
== imgINotificationObserver::FRAME_COMPLETE
)
39 return mInner
->FrameComplete(aRequest
);
40 if (aType
== imgINotificationObserver::DECODE_COMPLETE
)
41 return mInner
->DecodeComplete(aRequest
);
42 if (aType
== imgINotificationObserver::LOAD_COMPLETE
)
43 return mInner
->LoadComplete(aRequest
);
44 if (aType
== imgINotificationObserver::DISCARD
)
45 return mInner
->Discard(aRequest
);
46 if (aType
== imgINotificationObserver::IS_ANIMATED
)
47 return mInner
->IsAnimated(aRequest
);