|
1 /* |
|
2 * Copyright (c) 2006 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: Configuration representation classes for Out of Memory Monitor. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "oomactionconfig.h" |
|
21 #include "oomruleconfig.h" |
|
22 #include "oomtraces.h" |
|
23 |
|
24 // Add a rule |
|
25 // This class takes ownership of the given rule |
|
26 void COomActionConfig::AddRuleL(MOomRuleConfig* aRule) // Add the configuration for a rule (e.g. an idle time rule) |
|
27 { |
|
28 FUNC_LOG; |
|
29 |
|
30 iRules.AppendL(aRule); |
|
31 } |
|
32 |
|
33 COomActionConfig::~COomActionConfig() |
|
34 { |
|
35 FUNC_LOG; |
|
36 |
|
37 iRules.ResetAndDestroy(); |
|
38 iRules.Close(); |
|
39 } |
|
40 |
|
41 // Utility function to return the priority for this action for the given rule |
|
42 TUint COomActionConfig::Priority(const COomWindowGroupList& aWindowGroupList, TInt aAppIndexInWindowGroup) const |
|
43 { |
|
44 FUNC_LOG; |
|
45 |
|
46 TUint priority = iDefaultPriority; |
|
47 |
|
48 // See if any rules apply |
|
49 TInt index = 0; |
|
50 while (index < iRules.Count()) |
|
51 { |
|
52 if (iRules[index]->RuleIsApplicable(aWindowGroupList, aAppIndexInWindowGroup)) |
|
53 { |
|
54 // If an applicable rule has been found, then apply the new priority |
|
55 // The last applicable rule in the config file should be used |
|
56 // This is ensured because the last rule in the list will be the last rule from the file |
|
57 if (iRules[index]->Priority()) |
|
58 priority = iRules[index]->Priority(); |
|
59 } |
|
60 |
|
61 index++; |
|
62 } |
|
63 |
|
64 return priority; |
|
65 } |
|
66 |
|
67 void COomActionConfig::ConstructL() |
|
68 { |
|
69 FUNC_LOG; |
|
70 } |
|
71 |
|
72 COomActionConfig::COomActionConfig(TInt32 aId) : iId(aId) |
|
73 { |
|
74 FUNC_LOG; |
|
75 } |
|
76 |
|
77 |