Backed out changeset 177eae915693 (bug 1206581) for bustage
[gecko.git] / image / ScriptedNotificationObserver.cpp
blob3c7f0529657354aabfbe80db923d4b4070c95a60
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 namespace mozilla {
12 namespace image {
14 NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
16 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScriptedNotificationObserver)
17 NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
18 NS_INTERFACE_MAP_ENTRY(nsISupports)
19 NS_INTERFACE_MAP_END
21 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver)
22 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver)
24 ScriptedNotificationObserver::ScriptedNotificationObserver(
25 imgIScriptedNotificationObserver* aInner)
26 : mInner(aInner)
27 { }
29 NS_IMETHODIMP
30 ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
31 int32_t aType,
32 const nsIntRect* /*aUnused*/)
34 if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
35 return mInner->SizeAvailable(aRequest);
37 if (aType == imgINotificationObserver::FRAME_UPDATE) {
38 return mInner->FrameUpdate(aRequest);
40 if (aType == imgINotificationObserver::FRAME_COMPLETE) {
41 return mInner->FrameComplete(aRequest);
43 if (aType == imgINotificationObserver::DECODE_COMPLETE) {
44 return mInner->DecodeComplete(aRequest);
46 if (aType == imgINotificationObserver::LOAD_COMPLETE) {
47 return mInner->LoadComplete(aRequest);
49 if (aType == imgINotificationObserver::DISCARD) {
50 return mInner->Discard(aRequest);
52 if (aType == imgINotificationObserver::IS_ANIMATED) {
53 return mInner->IsAnimated(aRequest);
55 if (aType == imgINotificationObserver::HAS_TRANSPARENCY) {
56 return mInner->HasTransparency(aRequest);
58 return NS_OK;
61 } // namespace image
62 } // namespace mozilla