--- a/applayerpluginsandutils/uripermissionservices/inc/ineturi.h Wed Apr 14 16:31:08 2010 +0300
+++ b/applayerpluginsandutils/uripermissionservices/inc/ineturi.h Tue Apr 27 17:12:14 2010 +0300
@@ -24,6 +24,7 @@
#ifndef __INETURI_H__
#define __INETURI_H__
+#include <ineturilistdef.h>
class CInetUriImpl;
class CInetUriProperties;
--- a/httpfilters/cookie/ManagerInc/CookieClientDataArray.h Wed Apr 14 16:31:08 2010 +0300
+++ b/httpfilters/cookie/ManagerInc/CookieClientDataArray.h Tue Apr 27 17:12:14 2010 +0300
@@ -26,21 +26,14 @@
/* Constructor
*
*/
- static CCookieClientDataArray* GetInstance();
-
- /* Reference Count method
- *
- */
- inline void Ref(){++iRefCount;}
-
- /*Dereference count method and will delete the CCookieClientDataArray object once the iRefCount is zero
- *
- */
- void DeRef();
-
- /* Destructor
- *
- */
+
+ static CCookieClientDataArray* New();
+
+ /* Initialization
+ *
+ */
+ void Init();
+
~CCookieClientDataArray();
/* Constructor
@@ -104,6 +97,7 @@
protected:
private:
+
/* Constructor
*
*/
@@ -118,7 +112,6 @@
protected:
private:
- TInt iRefCount;
RPointerArray<CCookieClientData>* iCookieClientData;
};
--- a/httpfilters/cookie/ManagerSrc/CookieClientDataArray.cpp Wed Apr 14 16:31:08 2010 +0300
+++ b/httpfilters/cookie/ManagerSrc/CookieClientDataArray.cpp Tue Apr 27 17:12:14 2010 +0300
@@ -20,50 +20,31 @@
//Constatnts
const TInt KCookieArrayGranularity = 10;
-// ---------------------------------------------------------
-// CCookieClientDataArray::GetInstance
+
// ---------------------------------------------------------
-//
-CCookieClientDataArray* CCookieClientDataArray::GetInstance()
- {
- CLOG( ( EClient, 0, _L( "-> CCookieClientDataArray::GetInstance" ) ) );
- CCookieClientDataArray *clientInstance = static_cast<CCookieClientDataArray*> (Dll::Tls());
- if (!clientInstance)
- {
- clientInstance = new (ELeave) CCookieClientDataArray();
- Dll::SetTls(clientInstance);
- }
- CLOG( ( EClient, 0, _L( "<- CCookieClientDataArray::GetInstance instance = %x" ),clientInstance ) );
- return clientInstance;
- }
-// ---------------------------------------------------------
-// CCookieClientDataArray::DeRef
+// CCookieClientDataArray::New
// ---------------------------------------------------------
//
-void CCookieClientDataArray::DeRef()
+
+CCookieClientDataArray* CCookieClientDataArray::New()
{
- CLOG( ( EClient, 0, _L( "-> CCookieClientDataArray::Deref" ) ) );
- --iRefCount;
- if (iRefCount <= 0)
- {
- delete iCookieClientData;
- iCookieClientData = NULL;
- Dll::SetTls(0);
- CLOG( ( EClient, 0, _L( "<- CCookieClientDataArray::Deref deletes iCookieClientData" ) ) );
- }
- CLOG( ( EClient, 0, _L( "<- CCookieClientDataArray::Deref" ) ) );
+ CCookieClientDataArray* arrayInstance = new CCookieClientDataArray();
+ if (arrayInstance)
+ {
+ arrayInstance->Init();
+ }
+ return arrayInstance ;
}
-// ---------------------------------------------------------
-// CCookieClientDataArray::ConstructL
-// ---------------------------------------------------------
-//
-CCookieClientDataArray::CCookieClientDataArray():iRefCount(0)
+
+CCookieClientDataArray::CCookieClientDataArray()
{
- CLOG( ( EClient, 0, _L( "-> CCookieClientDataArray::ConstructL" ) ) );
- iCookieClientData = new (ELeave) RPointerArray<CCookieClientData>(KCookieArrayGranularity);
- CLOG( ( EClient, 0, _L( "<- CCookieClientDataArray::ConstructL" ) ) );
}
+void CCookieClientDataArray::Init()
+ {
+ iCookieClientData = new RPointerArray<CCookieClientData>(KCookieArrayGranularity);
+ }
+
// ---------------------------------------------------------
// CCookieClientDataArray::~CCookieClientDataArray
// ---------------------------------------------------------
--- a/httpfilters/cookie/ManagerSrc/CookieManagerClient.cpp Wed Apr 14 16:31:08 2010 +0300
+++ b/httpfilters/cookie/ManagerSrc/CookieManagerClient.cpp Tue Apr 27 17:12:14 2010 +0300
@@ -49,7 +49,7 @@
// ---------------------------------------------------------
//
EXPORT_C RCookieManager::RCookieManager( RStringPool aStringPool )
-: iStringPool( aStringPool ), iCookiePacker( iStringPool )
+: iStringPool( aStringPool ),iCookieMgrData(NULL)
{
CLOG(( EClient, 0, _L(" ") ));
CLOG(( EClient, 0, _L("*****************") ));
@@ -81,7 +81,10 @@
EXPORT_C TInt RCookieManager::Connect()
{
CLOG( ( EClientConnect, 0, _L( "-> RCookieManager::Connect" ) ) );
- CCookieClientDataArray::GetInstance()->Ref();
+ iCookieMgrData = new TCookieMgrInternalStruct(iStringPool);
+ if (!(iCookieMgrData && iCookieMgrData->Init() == KErrNone))
+ return KErrNoMemory;
+
TInt error = KErrNone;
RProcess server;
error = server.Create( KCookieServerExe, TPtr( NULL, 0 ),
@@ -185,8 +188,9 @@
{
CLOG( ( EClient, 0, _L( "-> RCookieManager::GetCookiesL" ) ) );
TBool cookiefound(EFalse);
- CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
- if(cookieclientdataarray) // redundant check
+ CCookieClientDataArray* cookieclientdataarray = iCookieMgrData->GetCookieClientDataArray();
+
+ if(cookieclientdataarray)
{
TInt clientarraycount = cookieclientdataarray->Count();
if ( clientarraycount!=0 )
@@ -217,8 +221,7 @@
// it seems this is the only place where we cannot avoid leaving
// ==> we allocate memory for cookies when we fill up the cookie array.
- iCookiePacker.UnpackCookiesFromBufferL( *buf, aCookies );
-
+ iCookieMgrData->GetCookiePacker().UnpackCookiesFromBufferL( *buf, aCookies );
TInt count = aCookies.Count();
TInt i = 0;
TBool anyCookie2( EFalse );
@@ -254,7 +257,7 @@
const TUriC8& aUri )
{
CLOG( ( EClient, 0, _L( "-> RCookieManager::StoreCookie" ) ) );
-
+ StoreCookieAtClientSide(&aCookie,aUri.UriDes());
TInt err;
TInt cookieSize = aCookie.Size( EFalse );
@@ -266,11 +269,11 @@
cookieSize ) );
TPtr8 bufDes( buf->Des() );
- err = iCookiePacker.CliPackCookie( bufDes, aCookie );
+ err = iCookieMgrData->GetCookiePacker().CliPackCookie( bufDes, aCookie );
if ( !err )
{
//Appuid value only takes 8 chars
- HBufC* appbuf = HBufC::New(8); // harendra: 8 chars needed
+ HBufC* appbuf = HBufC::New(8);
TPtr ptr(appbuf->Des());
TUint32 appUid(0);
ptr.AppendNum(appUid,EHex);
@@ -315,7 +318,7 @@
{
CLOG(( EClient, 0, _L("->RCookieManager::SetAppUid") ));
TUint32 groupid = RProcess().SecureId().iId;
- CCookieClientData* cookieclientdata = CCookieClientDataArray::GetInstance()->Find(groupid, const_cast<TUint32&> (aAppUid));
+ CCookieClientData* cookieclientdata = iCookieMgrData->GetCookieClientDataArray()->Find(groupid, const_cast<TUint32&> (aAppUid));
if(cookieclientdata)
{
cookieclientdata->SetWidgetUid(aAppUid);
@@ -324,9 +327,9 @@
{
TBool cookieSharableFlag(EFalse);
TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
- CCookieClientData* cookieclientdata = CCookieClientData::NewL(groupid, aAppUid, cookieSharableFlag,ETrue);
+ cookieclientdata = CCookieClientData::NewL(groupid, aAppUid, cookieSharableFlag,ETrue);
cookieclientdata->SetInitFlag(ETrue);
- CCookieClientDataArray::GetInstance()->AddClientGroupDataL(cookieclientdata);
+ iCookieMgrData->GetCookieClientDataArray()->AddClientGroupDataL(cookieclientdata);
}
//Appuid value only takes 8 chars
HBufC* buf = HBufC::NewLC(8);
@@ -345,9 +348,10 @@
EXPORT_C void RCookieManager::Close()
{
CLOG(( EClient, 0, _L("-> RCookieManager::Close") ));
- CCookieClientDataArray::GetInstance()->DeRef();
TInt deletestatus =0;
DestroyCookiesFromMemory(deletestatus);
+ delete iCookieMgrData;
+ iCookieMgrData = NULL;
CLOG(( EClient, 0, _L("-> RCookieManager::Close deletestatus = %d"), deletestatus ));
RSessionBase::Close();
CLOG(( EClient, 0, _L("<- RCookieManager::Close") ));
@@ -372,7 +376,7 @@
cookieSize ) );
TPtr8 bufDes( buf->Des() );
- err = iCookiePacker.CliPackCookie( bufDes, aCookie );
+ err = iCookieMgrData->GetCookiePacker().CliPackCookie( bufDes, aCookie );
if ( !err )
{
@@ -407,7 +411,7 @@
{
CLOG( ( EClient, 0, _L( "-> RCookieManager::GetCookiesL" ) ) );
TBool cookiefound(EFalse);
- CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
+ CCookieClientDataArray* cookieclientdataarray = iCookieMgrData->GetCookieClientDataArray();
if(cookieclientdataarray)
{
TInt clientarraycount = cookieclientdataarray->Count();
@@ -425,7 +429,6 @@
CLOG( ( EClient, 0, _L( "-> RCookieManager::GetClientSideCookies:" ) ) );
//Gets the Cookie objects for aUri in case it is present
- //TInt clerr = cookieclientdata->GetClientSideCookies(aUri,aCookies,cookiefound);
TInt clerr = GetClientSideCookies(aUri,aCookies,cookiefound,aAppUid);
CLOG( ( EClient, 0, _L( "RCookieManager::GetClientSideCookies:cookiefound = %d" ), cookiefound ) );
@@ -451,8 +454,7 @@
// it seems this is the only place where we cannot avoid leaving
// ==> we allocate memory for cookies when we fill up the cookie array.
- iCookiePacker.UnpackCookiesFromBufferL( *buf, aCookies );
-
+ iCookieMgrData->GetCookiePacker().UnpackCookiesFromBufferL( *buf, aCookies );
TInt count = aCookies.Count();
for(TInt j=0; j<count; j++)
{
@@ -495,7 +497,7 @@
{
CLOG(( EClient, 0, _L("-> RCookieManager::ClearCookies") ));
//Client side cookie deletion specific to a appuid
- CCookieClientDataArray::GetInstance()->DestroyClientData(aAppUid);
+ iCookieMgrData->GetCookieClientDataArray()->DestroyClientData(aAppUid);
//Server side Cookie deletion specific to a appuid
//Appuid value only takes 8 chars
HBufC* buf = HBufC::NewLC(8);
@@ -514,8 +516,19 @@
{
CLOG( ( EClient, 0, _L( "-> RCookieManager::StoreCookieAtClientSide" ) ) );
TUint32 groupid = RProcess().SecureId().iId;
- CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
+ CCookieClientDataArray* cookieclientdataarray = iCookieMgrData->GetCookieClientDataArray();
+ CCookieClientData* cookieclientdata(NULL);
TInt count = cookieclientdataarray->Count();
+ if (count == 0)
+ {
+ TBool cookieSharableFlag(EFalse);
+ TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
+ cookieclientdata = CCookieClientData::NewL(groupid, aWidgetUid, cookieSharableFlag,ETrue);
+ cookieclientdata->SetInitFlag(ETrue);
+ cookieclientdataarray->AddClientGroupDataL(cookieclientdata);
+ cookieclientdata->StoreCookieAtClientSideL(aCookie,aUri);
+ return;
+ }
TInt itemIndex =0;
for(TInt i=0; i<count; i++)
{
@@ -533,7 +546,7 @@
break;
}
}
- CCookieClientData* cookieclientdata = cookieclientdataarray->At(itemIndex);
+ cookieclientdata = cookieclientdataarray->At(itemIndex);
cookieclientdata->StoreCookieAtClientSideL(aCookie,aUri);
CLOG( ( EClient, 0, _L( "<- RCookieManager::StoreCookieAtClientSide" ) ) );
}
@@ -547,9 +560,8 @@
{
CLOG( ( EClient, 0, _L( "-> RCookieManager::GetClientSideCookies" ) ) );
TUint32 groupid = RProcess().SecureId().iId;
- //TInt itemIndex =0;
CCookieClientData* cookieclientdata = NULL;
- CCookieClientDataArray* cookieclientdataarray = CCookieClientDataArray::GetInstance();
+ CCookieClientDataArray* cookieclientdataarray = iCookieMgrData->GetCookieClientDataArray();
TInt count = cookieclientdataarray->Count();
if (count == 0)
{
@@ -560,7 +572,6 @@
cookieclientdataarray->AddClientGroupDataL(cookieclientdata);
} else
{
- //harendra: move this for loop in CCookieClientDataArray::Find(), it should index or object
cookieclientdata = cookieclientdataarray->Find(groupid, aWidgetUid);
}
if(cookieclientdata)
@@ -571,7 +582,6 @@
TInt err = GetCookieSharableFlagFromServer(cookieSharableFlag);
cookieclientdata->SetCookieCookieSharableFlag(cookieSharableFlag);
}
- //cookieclientdata->SetInitFlag(ETrue);
return cookieclientdata->GetClientSideCookies( aRequestUri,aCookies, aCookieFound );
} else
{
@@ -588,4 +598,18 @@
return KErrNone;
}
+RCookieManager::TCookieMgrInternalStruct::~TCookieMgrInternalStruct()
+ {
+ delete iCookieClientDataArray;
+ }
+
+TInt RCookieManager::TCookieMgrInternalStruct::Init()
+ {
+ iCookieClientDataArray = CCookieClientDataArray::New();
+ if (iCookieClientDataArray)
+ return KErrNone;
+ return KErrNoMemory;
+
+ }
+
// End of file
--- a/httpfilters/cookie/ManagerSrc/CookieManagerServer.cpp Wed Apr 14 16:31:08 2010 +0300
+++ b/httpfilters/cookie/ManagerSrc/CookieManagerServer.cpp Tue Apr 27 17:12:14 2010 +0300
@@ -213,14 +213,6 @@
{
CLOG( ( EServer, 0, _L( "-> CCookieManagerServer::~CCookieManagerServer" ) ) );
iServerClosing = ETrue;
-
- // delete iPersistentCookies;
-
- //delete iCookieFileName;
-
- //iFs.Close();
- iStringPool.Close();
-// delete iCookiePacker;
if(iCookieGroupDataArray)
{
delete iCookieGroupDataArray;
@@ -229,7 +221,7 @@
delete iGroupIdArray;
delete iCloseTimer;
-
+ iStringPool.Close();
CLOG( ( EServer, 0, _L( "<-CCookieManagerServer::~CCookieManagerServer") ) );
CLOG( ( EServer, 0, _L( "*****************" ) ) );
}
@@ -314,8 +306,7 @@
// e.g. 1 minute before doing so as starting a server is expensive
// in many ways.
CLOG( ( EServer, 0, _L( "Closing Server" ) ) );
- //iPersistentCookies->RemoveNonPersistent();
- iCloseTimer->After( KCookieCloseTime );
+ iCloseTimer->After( KCookieCloseTime );
//just write cookies back to the file when browser is closed,
//no need wait till cookie server is shutdown.
//WriteCookiesToFile();
--- a/httpfilters/cookie/ManagerSrc/GroupIdInfoArray.cpp Wed Apr 14 16:31:08 2010 +0300
+++ b/httpfilters/cookie/ManagerSrc/GroupIdInfoArray.cpp Tue Apr 27 17:12:14 2010 +0300
@@ -281,7 +281,7 @@
TInt CGroupIdArray::GetGroupId(TUint32 aClientId,TUint32& aGroupId,TBool& aCookieSharableFlag)
{
- CLOG( ( EClient, 0, _L( "-> CGroupIdArray::GetGroupId aClientId = %x,aAppUid =%x" ), aClientId, aAppUid ) );
+ CLOG( ( EClient, 0, _L( "-> CGroupIdArray::GetGroupId aClientId = %x,aGroupId =%x" ), aClientId, aGroupId ) );
TInt count = Count();
TBool found(EFalse);
--- a/netprotocols_plat/cookie_manager_api/inc/cookiemanagerclient.h Wed Apr 14 16:31:08 2010 +0300
+++ b/netprotocols_plat/cookie_manager_api/inc/cookiemanagerclient.h Tue Apr 27 17:12:14 2010 +0300
@@ -30,6 +30,8 @@
#include <cookie.h>
#include <cookieipc.h>
+//FORWARD Class Declaration
+class CCookieClientDataArray;
// CLASS DECLARATION
/**
@@ -135,17 +137,54 @@
TInt DestroyCookiesFromMemory( TInt& aDeleteStatus );
- void StoreCookieAtClientSide( const CCookie* aCookie, const TDesC8& aUri,TUint32 aWidgetUid );
+ void StoreCookieAtClientSide( const CCookie* aCookie, const TDesC8& aUri,TUint32 aWidgetUid =0);
TInt GetClientSideCookies( const TDesC8& aRequestUri,RPointerArray<CCookie>& aCookies
,TBool& aFound, TUint32 aWidgetUid );
TInt GetCookieSharableFlagFromServer(TBool& aCookieSharableFlag ) const;
-
-
+
private : // data members
- RStringPool iStringPool;
+ //internal data structure for supporting Client side caching.
+ class TCookieMgrInternalStruct
+ {
+ public:
+ /* Constructor
+ *
+ */
+ TCookieMgrInternalStruct(RStringPool aStringPool)
+ : iCookiePacker(aStringPool),
+ iCookieClientDataArray(NULL)
+ {
+ }
+
+ /* Destructor
+ *
+ */
+ ~TCookieMgrInternalStruct();
+
+ /* Get Cookiepacker instance
+ *
+ */
+ inline TCookiePacker& GetCookiePacker(){return iCookiePacker;}
+
+ /* Get Client Data Array Instance
+ *
+ */
+ inline CCookieClientDataArray* GetCookieClientDataArray(){return iCookieClientDataArray;}
+
+ /* Initialization method for Cookie Client Data Array
+ *
+ */
+ TInt Init();
+
+ private:
+ TCookiePacker iCookiePacker;
+ CCookieClientDataArray* iCookieClientDataArray;
+ };
- TCookiePacker iCookiePacker;
+ RStringPool iStringPool;
+ TCookieMgrInternalStruct* iCookieMgrData;
+
};
#endif //__COOKIEMANAGER_CLIENT_H__