Revision: 201032 RCL_3 PDK_3.0.3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 22:52:29 +0300
branchRCL_3
changeset 45 74aa6861c87d
parent 43 4a793f564d72
child 48 debf68073f2f
Revision: 201032 Kit: 201035
connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h
mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h
mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp
mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp
mtpfws/mtpfw/inc/cmtpconnection.h
mtpfws/mtpfw/src/cmtpconnection.cpp
--- a/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h	Wed Sep 01 12:20:56 2010 +0100
+++ b/connectivitymodules/SeCon/servers/pcconn/inc/sconpcconnclientserver.h	Tue Sep 14 22:52:29 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -48,7 +48,7 @@
 
 // Chunk
 const TUint KSConPCConnChunkSize = 128;
-const TUint KSConPCConnChunkMaxSize = 65536;
+const TUint KSConPCConnChunkMaxSize = 0x100000; // 1048576 bytes
 const TUint KSConPCConnBufferMaxSize = 65000; 
 
 // Version number
--- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h	Tue Sep 14 22:52:29 2010 +0300
@@ -58,7 +58,7 @@
     
 public:
     CMTPImageDpObjectPropertyMgr& PropertyMgr()const;
-    CMTPImageDpThumbnailCreator&  ThumbnailManager() const;
+    CMTPImageDpThumbnailCreator*  ThumbnailManager();
     CRepository& Repository() const;
     
     TMTPFormatCode FindFormat(const TDesC& aExtension);
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -96,8 +96,6 @@
     {
     __FLOG_OPEN(KMTPSubsystem, KComponent);
     __FLOG(_L8(">> CMTPImageDataProvider::ConstructL"));
-    
-    iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this);
     iNewPicNotifier = CMTPImageDpNewPicturesNotifier::NewL();
     
     //Setup central repository connection
@@ -454,11 +452,14 @@
     __FLOG(_L8("<< NotifyStorageEnumerationCompleteL"));        
     }
 
-CMTPImageDpThumbnailCreator& CMTPImageDataProvider::ThumbnailManager() const
-	{
-    __ASSERT_DEBUG(iThumbnailManager, User::Invariant());
-	return *iThumbnailManager;
-	}
+CMTPImageDpThumbnailCreator* CMTPImageDataProvider::ThumbnailManager()
+    {
+    if(NULL == iThumbnailManager)
+        {
+        TRAP_IGNORE(iThumbnailManager = CMTPImageDpThumbnailCreator::NewL(*this));
+        }
+    return iThumbnailManager;
+    }
 
 CMTPImageDpObjectPropertyMgr& CMTPImageDataProvider::PropertyMgr()const
 	{
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetthumb.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -111,21 +111,26 @@
         TEntry fileEntry;
         
         User::LeaveIfError(iFramework.Fs().Entry(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), fileEntry));
-        imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
-        if(fileEntry.FileSize() > KFileSizeMax)
+        
+        CMTPImageDpThumbnailCreator* tnc = imgDp.ThumbnailManager();
+        if(tnc != NULL)
             {
-            __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
-            imgDp.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+            tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+            if(fileEntry.FileSize() > KFileSizeMax)
+                {
+                __FLOG(_L8(">> CMTPImageDpGetThumb::ServiceL, fileEntry.FileSize() > KFileSizeMax"));
+                tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+                }
+            
+            tnc->GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
+            imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
             }
-        
-        imgDp.ThumbnailManager().GetThumbnailL(iObjectMeta->DesC(CMTPObjectMetaData::ESuid), thumbnailData, err);
-        User::LeaveIfError(err);
-        User::LeaveIfNull(thumbnailData);
-        
-        //Transfer ownership of thumbnailData to Property Manager
-        imgDp.PropertyMgr().StoreThunmnail(iObjectMeta->Uint(CMTPObjectMetaData::EHandle), thumbnailData);
+        //Transfer ownership of thumbnailData to Property Manager       
         }
-    iThumb->Write(*thumbnailData);
+    if(thumbnailData != NULL)
+        {
+        iThumb->Write(*thumbnailData);
+        }
     SendDataL(*iThumb);
     __FLOG(_L8("<< CMTPImageDpGetThumb::ServiceL"));
     }
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpobjectpropertymgr.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -454,21 +454,23 @@
          */
         TEntry fileEntry;
         TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
-        if (err == KErrNone)
+        CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
+        if (err == KErrNone && tnc != NULL)
             {
+            
             if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
                 {
-                iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+                tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
                 }
             else
                 {
-                iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+                tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
                 }
             
             /**
              * trap the leave to avoid return general error when PC get object property list
              */
-            TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
+            TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
             if (err == KErrNone)
                 {
                 iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
@@ -484,6 +486,10 @@
                     }
                 }
             }
+        else
+            {
+            aValue = KThumbCompressedSize;
+            }
         }
         break;       
        
@@ -599,22 +605,23 @@
              */
             TEntry fileEntry;
             TInt err = iFs.Entry(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), fileEntry);
-            if (err == KErrNone)
+            CMTPImageDpThumbnailCreator* tnc = iDataProvider.ThumbnailManager();
+            if (err == KErrNone && tnc != NULL)
                 {
                 
                 if(fileEntry.FileSize() > KFileSizeMax || !alwaysCreate)
                     {
-                    iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
+                    tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDoNotCreate);
                     }
                 else
                     {
-                    iDataProvider.ThumbnailManager().GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
+                    tnc->GetThumbMgr()->SetFlagsL(CThumbnailManager::EDefaultFlags);
                     }
                 
                 /**
                  * trap the leave to avoid return general error when PC get object property list
                  */
-                TRAP(err, iDataProvider.ThumbnailManager().GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
+                TRAP(err, tnc->GetThumbnailL(iObjectInfo->DesC(CMTPObjectMetaData::ESuid), iThumbnailCache.iThumbnailData, err));
                 if (err == KErrNone)
                     {
                     iThumbnailCache.iObjectHandle = iObjectInfo->Uint(CMTPObjectMetaData::EHandle);                        
--- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpthumbnailcreator.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -68,7 +68,7 @@
     delete iBitmap;  
     delete iObjectSource;
     delete iThumbMgr;
-    if(iActiveSchedulerWait->IsStarted())
+    if(iActiveSchedulerWait != NULL && iActiveSchedulerWait->IsStarted())
         {
         *iCreationErr = KErrNotReady;
         iActiveSchedulerWait->AsyncStop();
--- a/mtpfws/mtpfw/inc/cmtpconnection.h	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpfws/mtpfw/inc/cmtpconnection.h	Tue Sep 14 22:52:29 2010 +0300
@@ -147,6 +147,7 @@
     
     void EnqueueEvent(CMTPEventLink* aLink);
     void DequeueEvent(CMTPEventLink* aLink);
+	void DequeueAllEvents();
 
 /**
   * This method define and attach the property for publishing connection state 
--- a/mtpfws/mtpfw/src/cmtpconnection.cpp	Wed Sep 01 12:20:56 2010 +0100
+++ b/mtpfws/mtpfw/src/cmtpconnection.cpp	Tue Sep 14 22:52:29 2010 +0300
@@ -82,17 +82,9 @@
     __FLOG(_L8("~CMTPConnection - Entry"));
     CloseAllSessions();
     
-    // Remove any events not associated 
-    // with a session
-    TSglQueIter<CMTPEventLink> iter(iEventQ);
-    iter.SetToFirst();
-    CMTPEventLink* link = NULL;
-    
-    while ((link = iter++) != NULL)
-    	{
-    	delete link;
-    	}
-    
+	//remove all events
+    DequeueAllEvents();
+	
     iSessions.ResetAndDestroy();
     
     if (iTransportConnection != NULL)
@@ -667,9 +659,16 @@
     DequeueEvent(iEventQ.First());       
    	if (iPendingEventCount > 0)
    		{
-   		// Forward the event to the transport connection layer.
-   		__FLOG(_L8("Sending queued event"));
- 	    iTransportConnection->SendEventL(iEventQ.First()->iEvent);
+		if (NULL != iTransportConnection)
+			{
+			// Forward the event to the transport connection layer.
+			__FLOG(_L8("Sending queued event"));
+			iTransportConnection->SendEventL(iEventQ.First()->iEvent);
+			}
+		else
+			{
+			DequeueAllEvents();
+			}
    		}
     
     __FLOG(_L8("SendEventCompleteL - Exit"));
@@ -1046,6 +1045,19 @@
     __FLOG(_L8("RemoveEventsForSession - Exit"));
 	}
 
+void CMTPConnection::DequeueAllEvents()
+	{
+	TSglQueIter<CMTPEventLink> iter(iEventQ);
+    iter.SetToFirst();
+    CMTPEventLink* link = NULL;
+    
+    while ((link = iter++) != NULL)
+    	{
+    	delete link;
+    	}
+	iPendingEventCount = 0;
+	}
+	
 void CMTPConnection::DequeueEvent(CMTPEventLink* aLink)
 	{
 	iEventQ.Remove(*aLink);