Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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/. */
6 :
7 : #include "ScriptedNotificationObserver.h"
8 : #include "imgIScriptedNotificationObserver.h"
9 : #include "nsCycleCollectionParticipant.h"
10 :
11 : namespace mozilla {
12 : namespace image {
13 :
14 0 : NS_IMPL_CYCLE_COLLECTION(ScriptedNotificationObserver, mInner)
15 :
16 0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ScriptedNotificationObserver)
17 0 : NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
18 0 : NS_INTERFACE_MAP_ENTRY(nsISupports)
19 0 : NS_INTERFACE_MAP_END
20 :
21 0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(ScriptedNotificationObserver)
22 0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(ScriptedNotificationObserver)
23 :
24 0 : ScriptedNotificationObserver::ScriptedNotificationObserver(
25 0 : imgIScriptedNotificationObserver* aInner)
26 0 : : mInner(aInner)
27 0 : { }
28 :
29 : NS_IMETHODIMP
30 0 : ScriptedNotificationObserver::Notify(imgIRequest* aRequest,
31 : int32_t aType,
32 : const nsIntRect* /*aUnused*/)
33 : {
34 0 : if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
35 0 : return mInner->SizeAvailable(aRequest);
36 : }
37 0 : if (aType == imgINotificationObserver::FRAME_UPDATE) {
38 0 : return mInner->FrameUpdate(aRequest);
39 : }
40 0 : if (aType == imgINotificationObserver::FRAME_COMPLETE) {
41 0 : return mInner->FrameComplete(aRequest);
42 : }
43 0 : if (aType == imgINotificationObserver::DECODE_COMPLETE) {
44 0 : return mInner->DecodeComplete(aRequest);
45 : }
46 0 : if (aType == imgINotificationObserver::LOAD_COMPLETE) {
47 0 : return mInner->LoadComplete(aRequest);
48 : }
49 0 : if (aType == imgINotificationObserver::DISCARD) {
50 0 : return mInner->Discard(aRequest);
51 : }
52 0 : if (aType == imgINotificationObserver::IS_ANIMATED) {
53 0 : return mInner->IsAnimated(aRequest);
54 : }
55 0 : if (aType == imgINotificationObserver::HAS_TRANSPARENCY) {
56 0 : return mInner->HasTransparency(aRequest);
57 : }
58 0 : return NS_OK;
59 : }
60 :
61 : } // namespace image
62 : } // namespace mozilla
|