|
1 /* |
|
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CSvgtRasterizerOOMPropertyMonitor class for OOM implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "SvgtRasterizerOOMPropertyMonitor.h" |
|
19 #include <graphics/fbsrasterizer.h> |
|
20 #include <graphics/fbsrasterizerclearcache.h> |
|
21 #include "SvgtRasterizerCacheLimitHandler.h" |
|
22 #include <fbs.h> |
|
23 //#include <e32debug.h> |
|
24 |
|
25 CSvgtRasterizerOOMPropertyMonitor* CSvgtRasterizerOOMPropertyMonitor::NewL() |
|
26 { |
|
27 CSvgtRasterizerOOMPropertyMonitor* self = new (ELeave) CSvgtRasterizerOOMPropertyMonitor(); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(); |
|
31 return self; |
|
32 } |
|
33 |
|
34 CSvgtRasterizerOOMPropertyMonitor::CSvgtRasterizerOOMPropertyMonitor() |
|
35 : CActive(CActive::EPriorityStandard) |
|
36 { |
|
37 if (CActiveScheduler::Current()) |
|
38 { |
|
39 CActiveScheduler::Add(this); |
|
40 } |
|
41 |
|
42 } |
|
43 |
|
44 CSvgtRasterizerOOMPropertyMonitor::~CSvgtRasterizerOOMPropertyMonitor() |
|
45 { |
|
46 if (CActiveScheduler::Current()) |
|
47 { |
|
48 Cancel(); |
|
49 } |
|
50 iOomWatcher.Close(); |
|
51 } |
|
52 |
|
53 void CSvgtRasterizerOOMPropertyMonitor::ConstructL() |
|
54 { |
|
55 |
|
56 if (CActiveScheduler::Current()) |
|
57 { |
|
58 User::LeaveIfError(iOomWatcher.Attach(KSvgtPropertyCategory, ESvgtPropertyBool)); |
|
59 Queue(); |
|
60 } |
|
61 } |
|
62 |
|
63 void CSvgtRasterizerOOMPropertyMonitor::RunL() |
|
64 { |
|
65 TBool changeCacheLimit=ETrue; |
|
66 iOomWatcher.Get(changeCacheLimit); |
|
67 iRasterizer = CFbsBitmap::Rasterizer(); |
|
68 if(!changeCacheLimit) |
|
69 { |
|
70 MFbsRasterizerClearCache* cacheInterfacePtr = NULL; |
|
71 iRasterizer->GetInterface(TUid::Uid(KUidFbsRasterizerClearCache), (TAny*&)cacheInterfacePtr); |
|
72 if(cacheInterfacePtr) |
|
73 cacheInterfacePtr->ClearCache(); |
|
74 } |
|
75 MSvgtRasterizerCacheLimitHandler* interfacePtr = NULL; |
|
76 iRasterizer->GetInterface(TUid::Uid(KUidEnableSvgtRasterizer), (TAny*&)interfacePtr); |
|
77 if(interfacePtr) |
|
78 interfacePtr->ChangeCacheLimit(changeCacheLimit); |
|
79 Queue(); |
|
80 } |
|
81 |
|
82 void CSvgtRasterizerOOMPropertyMonitor::DoCancel() |
|
83 { |
|
84 iOomWatcher.Cancel(); |
|
85 } |
|
86 |
|
87 void CSvgtRasterizerOOMPropertyMonitor::Queue() |
|
88 { |
|
89 if (!IsActive()) |
|
90 { |
|
91 iOomWatcher.Subscribe(iStatus); |
|
92 SetActive(); |
|
93 } |
|
94 } |
|
95 |