graphicscomposition/openwfsupport/src/surfacestream.cpp
branchRCL_3
changeset 164 25ffed67c7ef
parent 163 bbf46f59e123
equal deleted inserted replaced
163:bbf46f59e123 164:25ffed67c7ef
     1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   668          case TSurfaceTypes::ESurfaceManagerSurface:
   668          case TSurfaceTypes::ESurfaceManagerSurface:
   669              {                         
   669              {                         
   670              if (iBufferChunk.Handle() == 0)
   670              if (iBufferChunk.Handle() == 0)
   671                  {
   671                  {
   672                  RChunk threadChunk;
   672                  RChunk threadChunk;
   673                  RSurfaceManager sm;
   673                  User::LeaveIfError(GetSingletonL().SurfaceManager().MapSurface(iSurfaceId, threadChunk));
   674                  sm.Open();
   674 				 CleanupClosePushL(threadChunk);
   675                  TInt err = sm.MapSurface(iSurfaceId, threadChunk);
   675 
   676                  sm.Close();
       
   677                  CleanupClosePushL(threadChunk);
       
   678                  				 			
       
   679 				 RChunk duplicateChunk;
   676 				 RChunk duplicateChunk;
   680 				 duplicateChunk.SetHandle(threadChunk.Handle());
   677 				 duplicateChunk.SetHandle(threadChunk.Handle());
   681                  User::LeaveIfError(duplicateChunk.Duplicate(RThread(), EOwnerProcess));
   678 				 User::LeaveIfError(duplicateChunk.Duplicate(RThread(), EOwnerProcess));
   682  
   679 
   683                  iBufferChunk.SetHandle(duplicateChunk.Handle());
   680                  iBufferChunk.SetHandle(duplicateChunk.Handle());
   684                  CleanupStack::PopAndDestroy(&threadChunk);
   681 				 CleanupStack::PopAndDestroy(&threadChunk);
   685                  }
   682                  }
   686              break;
   683              break;
   687              }
   684              }
   688 	     case TSurfaceId::EScreenSurface:
   685 	     case TSurfaceId::EScreenSurface:
   689 	         {
   686 	         {
  1095                 {
  1092                 {
  1096                 case ESOWF_EventDisplayed:
  1093                 case ESOWF_EventDisplayed:
  1097                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1094                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1098                         {
  1095                         {
  1099                         Displayed(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1096                         Displayed(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1100                         delete (TNotificationDisplayed*) callBackData;
  1097                         delete callBackData;
  1101                         iCallBacks[count].Reset();
  1098                         iCallBacks[count].Reset();
  1102                         if (iNumberOfScreenAttachedDisplayedNotif > 0)
  1099                         if (iNumberOfScreenAttachedDisplayedNotif > 0)
  1103                             {
  1100                             {
  1104                             iNumberOfScreenAttachedDisplayedNotif--;
  1101                             iNumberOfScreenAttachedDisplayedNotif--;
  1105                             }
  1102                             }
  1109              
  1106              
  1110                 case ESOWF_EventAvailable:
  1107                 case ESOWF_EventAvailable:
  1111                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1108                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1112                         {
  1109                         {
  1113                         Available(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1110                         Available(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1114                         delete (TNotificationAvailable*) callBackData;
  1111                         delete callBackData;
  1115                         iCallBacks[count].Reset();
  1112                         iCallBacks[count].Reset();
  1116                         if (iNumberOfScreenAttachedAvailableNotif > 0)
  1113                         if (iNumberOfScreenAttachedAvailableNotif > 0)
  1117                             {
  1114                             {
  1118                             iNumberOfScreenAttachedAvailableNotif--;
  1115                             iNumberOfScreenAttachedAvailableNotif--;
  1119                             }
  1116                             }
  1123              
  1120              
  1124                 case ESOWF_EventDisplayedX:
  1121                 case ESOWF_EventDisplayedX:
  1125                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1122                     if (callBackData && (!aData || (iCallBacks[count].iScreenNumber == susScreenNumber)))
  1126                         {
  1123                         {
  1127                         DisplayedXTimes(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1124                         DisplayedXTimes(ESOWF_ObserverCancel, iCallBacks[count].iScreenNumber, NULL, callBackData, NULL);
  1128                         delete (TNotificationDisplayedX*) callBackData;
  1125                         delete callBackData;
  1129                         iCallBacks[count].Reset();
  1126                         iCallBacks[count].Reset();
  1130                         if (iNumberOfScreenAttachedDisplayedXNotif)
  1127                         if (iNumberOfScreenAttachedDisplayedXNotif)
  1131                             {
  1128                             {
  1132                             iNumberOfScreenAttachedDisplayedXNotif--;
  1129                             iNumberOfScreenAttachedDisplayedXNotif--;
  1133                             }
  1130                             }
  1226             entry = iCallBacks[i];
  1223             entry = iCallBacks[i];
  1227             iRefCountMutex.Signal();
  1224             iRefCountMutex.Signal();
  1228             NFLOG(("###CSurfaceStream::NotifyComposerContext() ESOWF_EventUpdated aParam(%d)", aParam? aParam->id: -1));
  1225             NFLOG(("###CSurfaceStream::NotifyComposerContext() ESOWF_EventUpdated aParam(%d)", aParam? aParam->id: -1));
  1229             entry.iCallBackFunction(ToHandle(), ESOWF_EventUpdated, entry.iCallBackClientParam, aParam);
  1226             entry.iCallBackFunction(ToHandle(), ESOWF_EventUpdated, entry.iCallBackClientParam, aParam);
  1230             ret = ETrue;
  1227             ret = ETrue;
  1231 			// We are meant to hold this lock when we leave this function so coverity warning is false
       
  1232 			//coverity[lock]
       
  1233             iRefCountMutex.Wait();
  1228             iRefCountMutex.Wait();
  1234             }
  1229             }
  1235         }
  1230         }
  1236     NFLOG(("### EXIT CSurfaceStream::NotifyComposerContext() ret(%d)", ret));
  1231     NFLOG(("### EXIT CSurfaceStream::NotifyComposerContext() ret(%d)", ret));
  1237     return ret;
  1232     return ret;
  1368     immediateAvailable = param.immediateAvailable && ETrue;
  1363     immediateAvailable = param.immediateAvailable && ETrue;
  1369     immediateVisibility = param.immediateVisibility;
  1364     immediateVisibility = param.immediateVisibility;
  1370     serialNumber = param.serialNumber;
  1365     serialNumber = param.serialNumber;
  1371     
  1366     
  1372     
  1367     
  1373     // we take, initially in consideration "available" even if we might not have received a consumed request status
  1368     // we take, initially in consideration "availble" even if we might not have received a consumed request status
  1374     eventsToProcess = 0;
  1369     eventsToProcess = 0;
  1375     
  1370     
  1376     // we try to figure out which are the events we have to process and to get hold of their position
  1371     // we try to figure out which are the vents we have to process and to get hold of their position
  1377     // in the observers array, in order to avoid traversing it again
  1372     // in the observers array, in order to avoid traversing it again
  1378     TInt idx = iCallBacks.Count();
  1373     TInt idx = iCallBacks.Count();
  1379     //we will intend to mark the visited events, as an optimisation
  1374     //we will intend to mark the visited events, as an optimisation
  1380     TInt32 eventsToCheck = eventsReceived | ESOWF_EventAvailable;
  1375     TInt32 eventsToCheck = eventsReceived | ESOWF_EventAvailable;
  1381     TInt32 currentEvent = 0;
  1376     TInt32 currentEvent = 0;
  2135     else
  2130     else
  2136         {
  2131         {
  2137         iNewFlip = EFlippedTargetNormal;
  2132         iNewFlip = EFlippedTargetNormal;
  2138         }
  2133         }
  2139     }
  2134     }
  2140 
       
  2141 TInt CSurfaceStream::GetChunkHandle()
       
  2142     {
       
  2143     return iBufferChunk.Handle();
       
  2144     }