equal
deleted
inserted
replaced
61 } |
61 } |
62 |
62 |
63 void CHuiFxEffectCache::CreateL(MHuiFxEffectCacheNode *aNode) |
63 void CHuiFxEffectCache::CreateL(MHuiFxEffectCacheNode *aNode) |
64 { // registration of fxml file |
64 { // registration of fxml file |
65 MHuiFxEffectCacheNode *cachedNode = Find(aNode); |
65 MHuiFxEffectCacheNode *cachedNode = Find(aNode); |
|
66 MHuiFxEffectCacheNode *dupNode = FindDuplicate(aNode); |
66 if (cachedNode) |
67 if (cachedNode) |
67 { // found in cache => duplicate registration => no need to do anything |
68 { // found in cache => duplicate registration => no need to do anything |
68 cachedNode->Ref(1); |
69 cachedNode->Ref(1); |
69 delete aNode; |
70 delete aNode; |
70 } |
71 } |
|
72 else if (dupNode) |
|
73 { // found same file already being loaded |
|
74 dupNode->Ref(1); |
|
75 delete aNode; |
|
76 } |
71 else |
77 else |
72 { // not found in cache, so insert it and start parsing the effect. |
78 { // not found in cache, so insert it and start parsing the effect. |
73 TInt id = UniqueId(); |
79 TInt id = UniqueId(); |
74 IDNode n = { id, aNode }; |
80 IDNode n = { id, aNode }; |
75 iDuplicateEffects.Append(n); |
81 iDuplicateEffects.Append(n); |
117 if (cachedNode) |
123 if (cachedNode) |
118 { |
124 { |
119 TInt count = cachedNode->Ref(-1); |
125 TInt count = cachedNode->Ref(-1); |
120 if (count == 0) |
126 if (count == 0) |
121 { |
127 { |
|
128 Remove(iCachedEffects, cachedNode); |
122 delete cachedNode; |
129 delete cachedNode; |
123 Remove(iCachedEffects, cachedNode); |
|
124 } |
130 } |
125 } |
131 } |
126 if (cachedNode != aNode) |
132 if (cachedNode != aNode) |
127 { // this node was not found in iCachedEffects array, so it needs to be in iDuplicateEffects array |
133 { // this node was not found in iCachedEffects array, so it needs to be in iDuplicateEffects array |
|
134 Remove(iDuplicateEffects, aNode); |
128 delete aNode; |
135 delete aNode; |
129 Remove(iDuplicateEffects, aNode); |
|
130 } |
136 } |
131 } |
137 } |
132 |
138 |
133 void CHuiFxEffectCache::ParsingEnded(TInt aHandle) |
139 void CHuiFxEffectCache::ParsingEnded(TInt aHandle) |
134 { |
140 { |
159 return node; |
165 return node; |
160 } |
166 } |
161 } |
167 } |
162 return 0; |
168 return 0; |
163 } |
169 } |
|
170 MHuiFxEffectCacheNode *CHuiFxEffectCache::FindDuplicate(MHuiFxEffectCacheNode *aNode) |
|
171 { |
|
172 TInt size = iDuplicateEffects.Count(); |
|
173 for(TInt i=0;i<size;i++) |
|
174 { |
|
175 MHuiFxEffectCacheNode *node = iDuplicateEffects[i].iNode; |
|
176 if (Compare(node, aNode)) |
|
177 { |
|
178 return node; |
|
179 } |
|
180 } |
|
181 return 0; |
|
182 } |
164 |
183 |
165 TInt CHuiFxEffectCache::FindById(TInt aId) |
184 TInt CHuiFxEffectCache::FindById(TInt aId) |
166 { |
185 { |
167 TInt size = iDuplicateEffects.Count(); |
186 TInt size = iDuplicateEffects.Count(); |
168 for(TInt i=0;i<size;i++) |
187 for(TInt i=0;i<size;i++) |