Backed out changeset ad0d9f62c29c (bug 206659) for B2G desktop mochitest orange.
[gecko.git] / image / src / ScriptedNotificationObserver.cpp
blobe1023cbedf47a32e79a67e25e8756ef167e07088
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)
18 NS_INTERFACE_MAP_END
20 NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver)
21 NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver)
23 ScriptedNotificationObserver::ScriptedNotificationObserver(
24 imgIScriptedNotificationObserver* aInner)
25 : mInner(aInner)
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);
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);
48 return NS_OK;