equal
deleted
inserted
replaced
19 #include "fbsmessage.h" |
19 #include "fbsmessage.h" |
20 #include "SERVER.H" |
20 #include "SERVER.H" |
21 #include "BackGroundCompression.h" |
21 #include "BackGroundCompression.h" |
22 #include <shapeinfo.h> |
22 #include <shapeinfo.h> |
23 #include <graphics/shaperparams.h> |
23 #include <graphics/shaperparams.h> |
24 #include "OstTraceDefinitions.h" |
|
25 #include "fbstrace.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "FBSCLITraces.h" |
|
28 #endif |
|
29 |
|
30 |
24 |
31 /** Helper function for converting a pointer to an offset from the passed |
25 /** Helper function for converting a pointer to an offset from the passed |
32 heap base. Use OffsetToPointer() to convert the returned offset back to a |
26 heap base. Use OffsetToPointer() to convert the returned offset back to a |
33 useable pointer. |
27 useable pointer. |
34 @param aAny A pointer to be converted to an offset. |
28 @param aAny A pointer to be converted to an offset. |
87 return c; |
81 return c; |
88 } |
82 } |
89 |
83 |
90 CFbClient::~CFbClient() |
84 CFbClient::~CFbClient() |
91 { |
85 { |
92 FBS_OST( OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_DESTRUCTOR_INFO, "# Server session destroyed; rc=%d; iSSH=0x%08x;", iResourceCount, iSessionHandle);) |
|
93 /* |
86 /* |
94 Don't call any CFontStore functions if CFbClient::NewL has left, or if FBSERV has already deleted the |
87 Don't call any CFontStore functions if CFbClient::NewL has left, or if FBSERV has already deleted the |
95 font store, which happens in test programs like TFBS when FBSERV is closed before the client(s). |
88 font store, which happens in test programs like TFBS when FBSERV is closed before the client(s). |
96 */ |
89 */ |
97 CFontStore* font_store = NULL; |
90 CFontStore* font_store = NULL; |
100 { |
93 { |
101 font_store = fbTop->FontStore(); |
94 font_store = fbTop->FontStore(); |
102 } |
95 } |
103 |
96 |
104 if (font_store) |
97 if (font_store) |
105 { |
|
106 font_store->DeleteSessionCache(iSessionHandle); |
98 font_store->DeleteSessionCache(iSessionHandle); |
107 } |
|
108 |
99 |
109 // If the font store doesn't exist, neither will the shared heap owned by FBSERV. |
100 // If the font store doesn't exist, neither will the shared heap owned by FBSERV. |
110 if (font_store) |
101 if (font_store) |
111 { |
|
112 iHeap->Free(iOpenFontGlyphData); |
102 iHeap->Free(iOpenFontGlyphData); |
113 } |
103 |
114 |
104 // delete fonts hold by the client |
115 // output each bitmap that is about to be destroyed... |
|
116 FBS_OST |
|
117 ({ |
|
118 for (TInt ii = iIx->Count() - 1; ii >= 0; --ii) |
|
119 { |
|
120 CObject* object = (*iIx)[ii]; |
|
121 TInt localHandle = iIx->At(object); |
|
122 if ((localHandle != KErrNotFound) && (iIx->At(localHandle, fbTop->BitmapConUniqueID()) != NULL)) |
|
123 { |
|
124 OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_DESTRUCTOR_INFO2, "# Server resource destroyed; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localHandle); |
|
125 } |
|
126 } |
|
127 }) |
|
128 // delete fonts and bitmaps held by the client |
|
129 delete iIx; |
105 delete iIx; |
130 |
106 |
131 // delete font files held by the client |
107 // delete font files hold by the client |
132 if (iFontFileIndex) |
108 if (iFontFileIndex) |
133 { |
109 { |
134 TInt count = iFontFileIndex->Count(); |
110 TInt count = iFontFileIndex->Count(); |
135 for (TInt index = 0;index < count; index++) |
111 for (TInt index = 0;index < count; index++) |
136 { |
112 { |
232 break; |
208 break; |
233 } |
209 } |
234 iIx->Remove(localhandle); |
210 iIx->Remove(localhandle); |
235 iResourceCount--; |
211 iResourceCount--; |
236 aMessage.Complete(KErrNone); |
212 aMessage.Complete(KErrNone); |
237 FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_SERVICEL_INFO, "# Server resource destroyed; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);) |
|
238 #ifdef _DEBUG |
213 #ifdef _DEBUG |
239 iRet=KErrNone; |
214 iRet=KErrNone; |
240 #endif |
215 #endif |
241 break; |
216 break; |
242 } |
217 } |
422 return ret; |
397 return ret; |
423 } |
398 } |
424 |
399 |
425 // success |
400 // success |
426 iResourceCount++; |
401 iResourceCount++; |
427 FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_HANDLEMESGFONTDUPLICATE_INFO, "# Server font duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);) |
|
428 return KErrNone; |
402 return KErrNone; |
429 } |
403 } |
430 |
404 |
431 |
405 |
432 /** Handler for EFbsMessGetNearestFontToDesignHeightInTwips, EFbsMessGetNearestFontToDesignHeightInPixels, |
406 /** Handler for EFbsMessGetNearestFontToDesignHeightInTwips, EFbsMessGetNearestFontToDesignHeightInPixels, |
512 aPanicRequired = ETrue; |
486 aPanicRequired = ETrue; |
513 return ret; |
487 return ret; |
514 } |
488 } |
515 // success |
489 // success |
516 iResourceCount++; |
490 iResourceCount++; |
517 FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_COPYFONTINFOINTORETURNMESSAGE_INFO, "# Server font duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);) |
|
518 return KErrNone; |
491 return KErrNone; |
519 } |
492 } |
520 |
493 |
521 |
494 |
522 /** Handler for EFbsMessGetFontById message |
495 /** Handler for EFbsMessGetFontById message |
996 if(ret!=KErrNone) |
969 if(ret!=KErrNone) |
997 { |
970 { |
998 bmpptr->Close(); |
971 bmpptr->Close(); |
999 break; |
972 break; |
1000 } |
973 } |
1001 |
|
1002 bmpSpec.iHandle=localhandle; |
974 bmpSpec.iHandle=localhandle; |
1003 bmpSpec.iServerHandle = bmpptr->Handle(); |
975 bmpSpec.iServerHandle = bmpptr->Handle(); |
1004 bmpSpec.iAddressOffset=TInt(bmpptr->Address())-TopLevelStore()->HeapBase(); |
976 bmpSpec.iAddressOffset=TInt(bmpptr->Address())-TopLevelStore()->HeapBase(); |
1005 ret = aMessage.Write(0,bs); |
977 ret = aMessage.Write(0,bs); |
1006 if(ret!=KErrNone) |
978 if(ret!=KErrNone) |
1008 iIx->Remove(localhandle); |
980 iIx->Remove(localhandle); |
1009 aMessage.Panic(KFBSERVPanicCategory,ret); |
981 aMessage.Panic(KFBSERVPanicCategory,ret); |
1010 return; |
982 return; |
1011 } |
983 } |
1012 iResourceCount++; |
984 iResourceCount++; |
1013 FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO, "# Server bitmap created; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, bmpSpec.iHandle, bmpSpec.iServerHandle, bmpptr->Address()->DataStride() * bmpSpec.iSizeInPixels.iHeight);) |
|
1014 break; |
985 break; |
1015 } |
986 } |
1016 |
987 |
1017 case EFbsMessBitmapLoad: |
988 case EFbsMessBitmapLoad: |
1018 case EFbsMessBitmapLoadFast: |
989 case EFbsMessBitmapLoadFast: |
1116 iIx->Remove(localhandle); |
1087 iIx->Remove(localhandle); |
1117 aMessage.Panic(KFBSERVPanicCategory,ret); |
1088 aMessage.Panic(KFBSERVPanicCategory,ret); |
1118 return; |
1089 return; |
1119 } |
1090 } |
1120 iResourceCount++; |
1091 iResourceCount++; |
1121 FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO2, "# Server bitmap loaded; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, handlebuffer().iHandle, handlebuffer().iServerHandle, bmpptr->Address()->DataStride() * bmpptr->Address()->SizeInPixels().iHeight);) |
|
1122 break; |
1092 break; |
1123 } |
1093 } |
1124 case EFbsMessBitmapResize: |
1094 case EFbsMessBitmapResize: |
1125 { |
1095 { |
1126 localhandle=aMessage.Int0(); |
1096 localhandle=aMessage.Int0(); |
1186 { |
1156 { |
1187 iIx->Remove(newlocalhandle); |
1157 iIx->Remove(newlocalhandle); |
1188 aMessage.Panic(KFBSERVPanicCategory, ret); |
1158 aMessage.Panic(KFBSERVPanicCategory, ret); |
1189 return; |
1159 return; |
1190 } |
1160 } |
1191 FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO4, "# Server bitmap resized; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x; iNewSH=0x%08x; newbytes=%d;", iSessionHandle, localhandle, newlocalhandle, newbmpptr->Handle(), newbmpptr->Address()->DataStride() * newsize.iHeight);) |
|
1192 break; |
1161 break; |
1193 } |
1162 } |
1194 case EFbsMessBitmapDuplicate: |
1163 case EFbsMessBitmapDuplicate: |
1195 { |
1164 { |
1196 bmpptr = TopLevelStore()->FindBitmap(aMessage.Int0()); |
1165 bmpptr = TopLevelStore()->FindBitmap(aMessage.Int0()); |
1221 iIx->Remove(localhandle); |
1190 iIx->Remove(localhandle); |
1222 aMessage.Panic(KFBSERVPanicCategory,ret); |
1191 aMessage.Panic(KFBSERVPanicCategory,ret); |
1223 return; |
1192 return; |
1224 } |
1193 } |
1225 iResourceCount++; |
1194 iResourceCount++; |
1226 FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO3, "# Server bitmap duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, handlebuffer().iHandle, handlebuffer().iServerHandle, bmpptr->Address()->DataStride() * bmpptr->Address()->SizeInPixels().iHeight);) |
|
1227 break; |
1195 break; |
1228 } |
1196 } |
1229 case EFbsMessBitmapCompress: |
1197 case EFbsMessBitmapCompress: |
1230 { |
1198 { |
1231 localhandle = aMessage.Int0(); |
1199 localhandle = aMessage.Int0(); |
1283 { |
1251 { |
1284 iIx->Remove(newlocalhandle); |
1252 iIx->Remove(newlocalhandle); |
1285 aMessage.Panic(KFBSERVPanicCategory, ret); |
1253 aMessage.Panic(KFBSERVPanicCategory, ret); |
1286 return; |
1254 return; |
1287 } |
1255 } |
1288 FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO5, "# Server bitmap compressed; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x; iNewSH=0x%08x;", (TUint)iSessionHandle, localhandle, newlocalhandle, handlebuffer().iServerHandle);) |
|
1289 break; |
1256 break; |
1290 } |
1257 } |
1291 case EFbsMessBitmapBgCompress: |
1258 case EFbsMessBitmapBgCompress: |
1292 { |
1259 { |
1293 localhandle = aMessage.Int0(); |
1260 localhandle = aMessage.Int0(); |
1351 { |
1318 { |
1352 iIx->Remove(cleanlocalhandle); |
1319 iIx->Remove(cleanlocalhandle); |
1353 aMessage.Panic(KFBSERVPanicCategory, ret); |
1320 aMessage.Panic(KFBSERVPanicCategory, ret); |
1354 return; |
1321 return; |
1355 } |
1322 } |
1356 FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO6, "# Server bitmap cleaned; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x;", iSessionHandle, localhandle, cleanlocalhandle);) |
|
1357 break; |
1323 break; |
1358 } |
1324 } |
1359 case EFbsGetAllBitmapHandles: |
1325 case EFbsGetAllBitmapHandles: |
1360 { |
1326 { |
1361 ret = TopLevelStore()->GetAllBitmapHandles(aMessage); |
1327 ret = TopLevelStore()->GetAllBitmapHandles(aMessage); |