38 // CONSTANTS |
39 // CONSTANTS |
39 |
40 |
40 // kbyte |
41 // kbyte |
41 const TUint KDefaultCacheSize = 1048576; // 1MB = 1024*1024 |
42 const TUint KDefaultCacheSize = 1048576; // 1MB = 1024*1024 |
42 _LIT( KDefaultCacheDir, "c:\\cache\\"); |
43 _LIT( KDefaultCacheDir, "c:\\cache\\"); |
|
44 _LIT( KDefaultOperatorCacheDir, "c:\\cache\\op\\"); |
|
45 _LIT( KDefaultVssCacheDir, "c:\\cache\\vss\\"); |
43 _LIT( KDefaultIndexFile, "index.dat" ); |
46 _LIT( KDefaultIndexFile, "index.dat" ); |
44 _LIT( KDefaultOpIndexFile, "index_op.dat" ); |
47 _LIT( KDefaultOpIndexFile, "index_op.dat" ); |
45 _LIT( KDefaultVSSIndexFile, "index_vss.dat" ); |
48 _LIT( KDefaultVSSIndexFile, "index_vss.dat" ); |
46 _LIT( KIndexFileExtension, ".dat" ); |
49 _LIT( KIndexFileExtension, ".dat" ); |
|
50 _LIT( KValidationFileExtension, ".val" ); |
47 _LIT8( KVSSHeaderFileldName, "X-Vodafone-Content" ); |
51 _LIT8( KVSSHeaderFileldName, "X-Vodafone-Content" ); |
48 _LIT8( KVSSHeaderFileldValue, "Portal" ); |
52 _LIT8( KVSSHeaderFileldValue, "Portal" ); |
49 |
53 |
50 |
54 |
51 // MACROS |
55 // MACROS |
113 CleanupStack::Pop(); |
117 CleanupStack::Pop(); |
114 |
118 |
115 return self; |
119 return self; |
116 } |
120 } |
117 |
121 |
|
122 // ----------------------------------------------------------------------------- |
118 // Destructor |
123 // Destructor |
|
124 // ----------------------------------------------------------------------------- |
119 CHttpCacheManager::~CHttpCacheManager() |
125 CHttpCacheManager::~CHttpCacheManager() |
120 { |
126 { |
121 delete iOfflineNotifyHandler; |
127 delete iOfflineNotifyHandler; |
122 delete iOfflineRepository; |
128 delete iOfflineRepository; |
123 delete iCache; |
129 delete iCache; |
124 delete iOperatorCache; |
130 delete iOperatorCache; |
125 delete iOpDomain; |
131 delete iOpDomain; |
126 delete iphoneSpecificCache; |
132 delete iphoneSpecificCache; |
127 delete iVSSWhiteList; |
133 delete iVSSWhiteList; |
|
134 delete iFileWriteHandler; |
128 } |
135 } |
129 |
136 |
130 // ----------------------------------------------------------------------------- |
137 // ----------------------------------------------------------------------------- |
131 // CHttpCacheManager::VSSRequestCheck |
138 // CHttpCacheManager::VSSRequestCheck |
132 // |
139 // |
133 // ----------------------------------------------------------------------------- |
140 // ----------------------------------------------------------------------------- |
134 // |
141 // |
135 TBool CHttpCacheManager::VSSRequestCheck( const RHTTPTransaction& aTrans, |
142 TBool CHttpCacheManager::VSSRequestCheckL( const RHTTPTransaction& aTrans, |
136 const RHTTPHeaders& aHttpHeader, |
143 const RHTTPHeaders& aHttpHeader, |
137 const TDesC8& aUrl ) |
144 const TDesC8& aUrl ) |
138 { |
145 { |
139 TBool VSSTransaction ( EFalse ); |
146 TBool VSSTransaction ( EFalse ); |
140 if ( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) ) |
147 if ( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) ) |
141 { |
148 { |
142 RStringPool strP = aTrans.Session().StringPool(); |
149 RStringPool strP = aTrans.Session().StringPool(); |
350 // do not remove op cache |
358 // do not remove op cache |
351 if( iCacheEnabled ) |
359 if( iCacheEnabled ) |
352 { |
360 { |
353 numOfBytes = iCache->RemoveAllL(); |
361 numOfBytes = iCache->RemoveAllL(); |
354 } |
362 } |
355 |
363 |
356 //failure here is not mission critical |
364 //failure here is not mission critical |
357 TRAP_IGNORE( RemoveOrphanedFilesL() ); |
365 TRAP_IGNORE( RemoveOrphanedFilesL() ); |
358 |
366 |
359 return numOfBytes; |
367 return numOfBytes; |
360 } |
368 } |
361 |
369 |
362 |
370 // ----------------------------------------------------------------------------- |
|
371 // FilePathHash |
363 // Hash function for Symbian file paths: discards case first |
372 // Hash function for Symbian file paths: discards case first |
|
373 // ----------------------------------------------------------------------------- |
364 static TUint32 FilepathHash(const TDesC& aDes) |
374 static TUint32 FilepathHash(const TDesC& aDes) |
365 { |
375 { |
366 //since this function is intensively used by the HashMap, |
376 //since this function is intensively used by the HashMap, |
367 //keeping (slow) heap allocation out of it. |
377 //keeping (slow) heap allocation out of it. |
368 TBuf<KMaxPath> normalized ( aDes ); |
378 TBuf<KMaxPath> normalized ( aDes ); |
369 |
379 |
370 normalized.LowerCase(); |
380 normalized.LowerCase(); |
371 return DefaultHash::Des16( normalized ); |
381 return DefaultHash::Des16( normalized ); |
372 } |
382 } |
373 |
383 |
374 // Comparator for Symbian file paths: Use case-insensitive compare |
384 // ----------------------------------------------------------------------------- |
|
385 // FilepathIdent |
|
386 // Comparator for Symbian file paths: Use case-insensitive compare |
|
387 // ----------------------------------------------------------------------------- |
375 static TBool FilepathIdent(const TDesC& aL, const TDesC& aR) |
388 static TBool FilepathIdent(const TDesC& aL, const TDesC& aR) |
376 { |
389 { |
377 return ( aL.CompareF(aR) == 0 ); |
390 return ( aL.CompareF(aR) == 0 ); |
378 } |
391 } |
379 |
392 |
380 |
393 // ----------------------------------------------------------------------------- |
381 // ----------------------------------------------------------------------------- |
394 // CHttpCacheManager::RemoveOrphanedFilesL |
382 // CHttpCacheManager::RemoveOrphanedFilesL |
|
383 // Removes header/body files that exist on the file-system, but are not known to the in-memory Cache lookup table(s) |
395 // Removes header/body files that exist on the file-system, but are not known to the in-memory Cache lookup table(s) |
384 // We do this because cache performance degrades substantially if there are too many files in a Symbian FAT32 directory. |
396 // We do this because cache performance degrades substantially if there are too many files in a Symbian FAT32 directory. |
385 // Browser crash or out-of-battery situations may cause SaveLookuptable() to be not called, leading to such "orphaned files". |
397 // Browser crash or out-of-battery situations may cause SaveLookuptable() to be not called, leading to such "orphaned files". |
386 // Due to high file-server interaction, don't call this method from performance critical code. |
398 // Due to high file-server interaction, don't call this method from performance critical code. |
387 // ----------------------------------------------------------------------------- |
399 // ----------------------------------------------------------------------------- |
388 void CHttpCacheManager::RemoveOrphanedFilesL() |
400 void CHttpCacheManager::RemoveOrphanedFilesL() |
389 { |
401 { |
390 |
402 //Map that contains pointers to fully-qualified file paths as Keys, and "to be deleted flag" as Value. |
391 //Map that contains pointers to fully-qualified file paths as Keys, and "to be deleted flag" as Value. |
|
392 RPtrHashMap<TDesC, TInt> onDiskFilesMap(&FilepathHash, &FilepathIdent); |
403 RPtrHashMap<TDesC, TInt> onDiskFilesMap(&FilepathHash, &FilepathIdent); |
393 CleanupClosePushL( onDiskFilesMap ); |
404 CleanupClosePushL( onDiskFilesMap ); |
394 |
405 |
395 //Pointers to the following TInt are used as VALUES in the HashMap... |
406 //Pointers to the following TInt are used as VALUES in the HashMap... |
396 // so they must be in scope for the lifecycle of the HashMap. |
407 // so they must be in scope for the lifecycle of the HashMap. |
397 const TInt needsDelete( 1 ); |
408 const TInt needsDelete( 1 ); |
398 const TInt noDelete( 0 ); |
409 const TInt noDelete( 0 ); |
399 |
410 |
400 //collects objects that need to be deleted later on |
411 //collects objects that need to be deleted later on |
401 RPointerArray<HBufC> cleanupList; |
412 RPointerArray<HBufC> cleanupList; |
402 CleanupResetAndDestroyPushL( cleanupList ); |
413 CleanupResetAndDestroyPushL( cleanupList ); |
403 |
414 |
404 RFs rfs = CCoeEnv::Static()->FsSession(); |
415 RFs rfs = CCoeEnv::Static()->FsSession(); |
405 CDirScan* scanner = CDirScan::NewLC( rfs ); |
416 CDirScan* scanner = CDirScan::NewLC( rfs ); |
409 CDir* matchingFiles( 0 ); |
420 CDir* matchingFiles( 0 ); |
410 |
421 |
411 //Step 1. Find out all files on disk: by walking the directory hierarchy, one directory at a time |
422 //Step 1. Find out all files on disk: by walking the directory hierarchy, one directory at a time |
412 for (;;) |
423 for (;;) |
413 { |
424 { |
414 //1a. Get list of files in current directory, NULL if no directory left in tree |
425 //1a. Get list of files in current directory, NULL if no directory left in tree |
415 scanner->NextL( matchingFiles ); |
426 scanner->NextL( matchingFiles ); |
416 if ( !matchingFiles ) |
427 if ( !matchingFiles ) |
417 break; |
428 break; |
418 |
429 |
419 TPtrC dir( scanner->FullPath() ); |
430 TPtrC dir( scanner->FullPath() ); |
420 |
431 |
421 //1b. Add any files found to the HashTable |
432 //1b. Add any files found to the HashTable |
422 const TInt nMatches = matchingFiles->Count(); |
433 const TInt nMatches = matchingFiles->Count(); |
423 for ( TInt i = 0; i < nMatches; i++ ) |
434 for ( TInt i = 0; i < nMatches; i++ ) |
424 { |
435 { |
425 TEntry entry ( (*matchingFiles)[i] ) ; |
436 TEntry entry ( (*matchingFiles)[i] ) ; |
426 if (entry.iName.Right( KIndexFileExtension().Length() ). |
437 TPtrC ext( entry.iName.Right( KIndexFileExtension().Length() )); |
427 CompareF( KIndexFileExtension ) != 0) // ignore any .dat index files |
438 |
|
439 if ( ext.CompareF( KIndexFileExtension ) != 0 && // ignore any .dat index files |
|
440 ext.CompareF( KValidationFileExtension ) != 0 ) // ignore any .val index files |
428 { |
441 { |
429 HBufC* fullPath = HBufC::NewL( dir.Length() + entry.iName.Length() ); |
442 HBufC* fullPath = HBufC::NewL( dir.Length() + entry.iName.Length() ); |
430 cleanupList.Append( fullPath ); //keep object safe for later destruction |
443 cleanupList.Append( fullPath ); //keep object safe for later destruction |
431 fullPath->Des().Append( dir ); |
444 fullPath->Des().Append( dir ); |
432 fullPath->Des().Append( entry.iName ); //a fully qualified file path |
445 fullPath->Des().Append( entry.iName ); //a fully qualified file path |
433 onDiskFilesMap.Insert( fullPath, &needsDelete ); //add to the hash |
446 onDiskFilesMap.Insert( fullPath, &needsDelete ); //add to the hash |
434 } |
447 } |
435 } |
448 } |
436 |
|
437 |
449 |
438 delete matchingFiles; |
450 delete matchingFiles; |
439 } // End of step 1: adding all known files on disk to Map |
451 } // End of step 1: adding all known files on disk to Map |
440 |
452 |
441 CleanupStack::PopAndDestroy( 1, scanner ); |
453 CleanupStack::PopAndDestroy( 1, scanner ); |
442 |
454 |
443 #ifdef __CACHELOG__ |
455 #ifdef __CACHELOG__ |
444 { |
456 { |
445 RDebug::Print(_L("-----------START PRINTING MAP OF SIZE %d---------"), onDiskFilesMap.Count()); |
457 HttpCacheUtil::WriteFormatLog(0, _L("-----------START PRINTING MAP OF SIZE %d---------"), onDiskFilesMap.Count()); |
446 TPtrHashMapIter<TDesC, TInt> iter(onDiskFilesMap); |
458 TPtrHashMapIter<TDesC, TInt> iter(onDiskFilesMap); |
447 const TDesC* key; |
459 const TDesC* key; |
448 while ((key = iter.NextKey()) != 0) |
460 while ((key = iter.NextKey()) != 0) |
449 { |
461 { |
450 const TInt val = *(iter.CurrentValue()); |
462 const TInt val = *(iter.CurrentValue()); |
451 RDebug::Print(_L("MAP WALK: %S, with value = %d "), key, val); |
463 HttpCacheUtil::WriteFormatLog(0, _L("MAP WALK: %S, with value = %d "), key, val); |
452 } |
464 } |
453 RDebug::Print(_L("-----------DONE PRINTING MAP-------------")); |
465 HttpCacheUtil::WriteFormatLog(0, _L("-----------DONE PRINTING MAP-------------")); |
454 } |
466 } |
455 #endif |
467 #endif |
456 |
468 |
457 //Step 2. Get list of known (non-orphaned) files in each Cache's in-memory lookup table. Flag them as DO NOT DELETE |
469 //Step 2. Get list of known (non-orphaned) files in each Cache's in-memory lookup table. Flag them as DO NOT DELETE |
458 RPointerArray<TDesC> knownFiles; |
470 RPointerArray<TDesC> knownFiles; |
459 CleanupClosePushL( knownFiles ); |
471 CleanupClosePushL( knownFiles ); |
460 //Ask CacheHandlers to add their KNOWN files to this array. No ownership transfer occurs. |
472 //Ask CacheHandlers to add their KNOWN files to this array. No ownership transfer occurs. |
461 //Don't go ahead if any of the cache handlers choke to insure correct deletion of files. |
473 //Don't go ahead if any of the cache handlers choke to insure correct deletion of files. |
462 if (iCache) |
474 if (iCache) |
463 User::LeaveIfError( iCache->ListFiles( knownFiles ) ); |
475 User::LeaveIfError( iCache->ListFiles( knownFiles ) ); |
464 if (iOperatorCache) |
476 if (iOperatorCache) |
465 User::LeaveIfError( iOperatorCache->ListFiles( knownFiles ) ); |
477 User::LeaveIfError( iOperatorCache->ListFiles( knownFiles ) ); |
466 if (iphoneSpecificCache) |
478 if (iphoneSpecificCache) |
467 User::LeaveIfError( iphoneSpecificCache->ListFiles( knownFiles ) ); |
479 User::LeaveIfError( iphoneSpecificCache->ListFiles( knownFiles ) ); |
468 |
480 |
469 //2a. HashTable lookup, and modification of flag |
481 //2a. HashTable lookup, and modification of flag |
470 for (TInt i = 0; i < knownFiles.Count(); i++) |
482 for (TInt i = 0; i < knownFiles.Count(); i++) |
471 { |
483 { |
472 //lookup filename |
484 //lookup filename |
473 TInt* ptr = onDiskFilesMap.Find( *(knownFiles[i]) ); |
485 TInt* ptr = onDiskFilesMap.Find( *(knownFiles[i]) ); |
474 if (ptr) |
486 if (ptr) |
475 { |
487 { |
476 // Reinsert into Map, this time with NO DELETE |
488 // Reinsert into Map, this time with NO DELETE |
477 onDiskFilesMap.Insert( knownFiles[i], &noDelete ); |
489 onDiskFilesMap.Insert( knownFiles[i], &noDelete ); |
478 |
490 #if 0 // no header files any more. |
479 // Add the header file to HashMap |
491 // Add the header file to HashMap |
480 HBufC* headerFile = HBufC::NewL( KHttpCacheHeaderExt().Length() + (*(knownFiles[i])).Length() ); |
492 HBufC* headerFile = HBufC::NewL( KHttpCacheHeaderExt().Length() + (*(knownFiles[i])).Length() ); |
481 cleanupList.Append( headerFile ); //keep for later destruction |
493 cleanupList.Append( headerFile ); //keep for later destruction |
482 TPtr ptr( headerFile->Des() ); |
494 TPtr ptr( headerFile->Des() ); |
483 HttpCacheUtil::GetHeaderFileName( *(knownFiles[i]), ptr ); |
495 HttpCacheUtil::GetHeaderFileName( *(knownFiles[i]), ptr ); |
484 onDiskFilesMap.Insert( headerFile, &noDelete ); // register Header files as NO DELETE |
496 onDiskFilesMap.Insert( headerFile, &noDelete ); // register Header files as NO DELETE |
485 } |
497 #endif |
486 } |
498 } |
487 |
499 } |
488 knownFiles.Close(); |
500 |
|
501 knownFiles.Close(); |
489 CleanupStack::Pop( 1, &knownFiles ); |
502 CleanupStack::Pop( 1, &knownFiles ); |
490 |
503 |
491 //Step 3. Delete all files on disk that don't belong to any of the Cache Handlers. |
504 //Step 3. Delete all files on disk that don't belong to any of the Cache Handlers. |
492 CFileMan* fileMan = CFileMan::NewL( rfs ); |
505 CFileMan* fileMan = CFileMan::NewL( rfs ); |
493 TPtrHashMapIter<TDesC, TInt> iter( onDiskFilesMap ); |
506 TPtrHashMapIter<TDesC, TInt> iter( onDiskFilesMap ); |
682 // unless it is already there |
706 // unless it is already there |
683 if( iCacheFolder.LocateReverse( '\\' ) != iCacheFolder.Length() - 1 ) |
707 if( iCacheFolder.LocateReverse( '\\' ) != iCacheFolder.Length() - 1 ) |
684 { |
708 { |
685 iCacheFolder.Append( _L("\\") ); |
709 iCacheFolder.Append( _L("\\") ); |
686 } |
710 } |
687 |
711 |
688 // get drive letter for sysutil |
712 // get drive letter for sysutil |
689 TParsePtrC pathParser( iCacheFolder ); |
713 TParsePtrC pathParser( iCacheFolder ); |
690 TDriveUnit drive = pathParser.Drive(); |
714 TDriveUnit drive = pathParser.Drive(); |
691 // get critical level |
715 // get critical level |
692 // RAM drive can have different critical level |
716 // RAM drive can have different critical level |
693 TVolumeInfo vinfo; |
717 TVolumeInfo vinfo; |
694 User::LeaveIfError( CCoeEnv::Static()->FsSession().Volume( vinfo, drive ) ); |
718 User::LeaveIfError( CCoeEnv::Static()->FsSession().Volume( vinfo, drive ) ); |
695 // |
719 // |
696 TInt criticalLevel; |
720 TInt criticalLevel; |
697 User::LeaveIfError( repositoryDiskLevel->Get( ( vinfo.iDrive.iType == EMediaRam ? KRamDiskCriticalLevel : KDiskCriticalThreshold ), |
721 User::LeaveIfError( repositoryDiskLevel->Get( ( vinfo.iDrive.iType == EMediaRam ? KRamDiskCriticalLevel : KDiskCriticalThreshold ), |
698 criticalLevel ) ); |
722 criticalLevel ) ); |
699 |
723 |
700 if( (err == KErrNone) && iCacheEnabled ) |
724 if ( (err == KErrNone) && iCacheEnabled ) |
701 { |
725 { |
702 // create cache handler |
726 // create cache handler |
703 iCache = CHttpCacheHandler::NewL( cacheSize, iCacheFolder, KDefaultIndexFile(), criticalLevel ); |
727 iCache = CHttpCacheHandler::NewL( cacheSize, iCacheFolder, KDefaultIndexFile(), criticalLevel, postpone); |
704 |
728 |
705 // create operator cache. same settings |
729 // create operator cache. same settings |
706 if( FeatureManager::FeatureSupported( KFeatureIdOperatorCache ) ) |
730 if ( FeatureManager::FeatureSupported( KFeatureIdOperatorCache ) ) |
707 { |
731 { |
708 TBuf<512> url; |
732 TBuf<512> url; |
709 // if domain is missing, then no need to read further |
733 // if domain is missing, then no need to read further |
710 if( repository->Get( KOperatorDomainUrl, url ) == KErrNone ) |
734 if ( repository->Get( KOperatorDomainUrl, url ) == KErrNone ) |
711 { |
735 { |
712 |
736 |
713 HBufC8* opDomain8 = HBufC8::NewL( url.Length() ); |
737 HBufC8* opDomain8 = HBufC8::NewL( url.Length() ); |
714 CleanupStack::PushL(opDomain8); |
738 CleanupStack::PushL(opDomain8); |
715 opDomain8->Des().Append( url ); |
739 opDomain8->Des().Append( url ); |
716 |
740 |
717 TInt slashPos = opDomain8->LocateReverse('/'); |
741 TInt slashPos = opDomain8->LocateReverse('/'); |
718 if(slashPos == -1) |
742 if (slashPos == -1) |
719 { |
743 { |
720 slashPos = 0; |
744 slashPos = 0; |
721 } |
745 } |
722 TPtrC8 temp = opDomain8->Left(slashPos); |
746 |
723 iOpDomain = temp.AllocL(); |
747 TPtrC8 temp = opDomain8->Left(slashPos); |
724 CleanupStack::PopAndDestroy(opDomain8); |
748 iOpDomain = temp.AllocL(); |
|
749 CleanupStack::PopAndDestroy(opDomain8); |
725 |
750 |
726 // op cache size |
751 // op cache size |
727 TInt opCacheSize( KDefaultCacheSize ); |
752 TInt opCacheSize( KDefaultCacheSize ); |
728 repository->Get( KOperatorCacheSize, opCacheSize ); |
753 repository->Get( KOperatorCacheSize, opCacheSize ); |
729 |
754 |
730 // op cache folder |
755 // op cache folder |
731 TFileName opCacheFolder( KDefaultCacheDir ); |
756 TFileName opCacheFolder( KDefaultOperatorCacheDir ); |
732 repository->Get( KOperatorCacheFolder, opCacheFolder ); |
757 repository->Get( KOperatorCacheFolder, opCacheFolder ); |
733 |
758 |
734 if( opCacheFolder.LocateReverse( '\\' ) != opCacheFolder.Length() - 1 ) |
759 if ( opCacheFolder.LocateReverse( '\\' ) != opCacheFolder.Length() - 1 ) |
735 { |
760 { |
736 opCacheFolder.Append( _L("\\") ); |
761 opCacheFolder.Append( _L("\\") ); |
737 } |
762 } |
738 |
763 |
739 // create op cache |
764 // create op cache |
740 iOperatorCache = CHttpCacheHandler::NewL( opCacheSize, opCacheFolder, KDefaultOpIndexFile(), criticalLevel ); |
765 iOperatorCache = CHttpCacheHandler::NewL( opCacheSize, opCacheFolder, KDefaultOpIndexFile(), criticalLevel, postpone); |
741 } |
766 } |
742 } //end if( FeatureManager::FeatureSupported( KFeatureIdOperatorCache ) ) |
767 } //end if( FeatureManager::FeatureSupported( KFeatureIdOperatorCache ) ) |
743 } //end if( iCacheEnabled ) |
768 } //end if( iCacheEnabled ) |
744 |
769 |
745 TInt VSScacheEnabled( 0 ); |
770 TInt VSScacheEnabled( 0 ); |
746 err = repository->Get( KPhoneSpecificCacheEnabled, VSScacheEnabled ); |
771 err = repository->Get( KPhoneSpecificCacheEnabled, VSScacheEnabled ); |
747 |
772 |
748 iVSSCacheEnabled = VSScacheEnabled; |
773 iVSSCacheEnabled = VSScacheEnabled; |
749 |
774 |
750 if( (err == KErrNone) && iVSSCacheEnabled ) |
775 if ( (err == KErrNone) && iVSSCacheEnabled ) |
751 { |
776 { |
752 // cache size |
777 // cache size |
753 TInt VSScacheSize( KDefaultCacheSize ); |
778 TInt VSScacheSize( KDefaultCacheSize ); |
754 repository->Get( KPhoneSpecificCacheSize, VSScacheSize ); |
779 repository->Get( KPhoneSpecificCacheSize, VSScacheSize ); |
755 |
780 |
756 // cache folder |
781 // cache folder |
757 TFileName VSScacheFolder( KDefaultCacheDir ); |
782 TFileName VSScacheFolder( KDefaultVssCacheDir ); |
758 // ignore cache folder. use c:\ to save memory. (same for operator cache. see below) |
783 // ignore cache folder. use c:\ to save memory. (same for operator cache. see below) |
759 repository->Get( KPhoneSpecificCacheFolder, VSScacheFolder ); |
784 repository->Get( KPhoneSpecificCacheFolder, VSScacheFolder ); |
760 // fix folder by appending trailing \\ to the end -symbian thing |
785 // fix folder by appending trailing \\ to the end -symbian thing |
761 // unless it is already there |
786 // unless it is already there |
762 if( VSScacheFolder.LocateReverse( '\\' ) != VSScacheFolder.Length() - 1 ) |
787 if( VSScacheFolder.LocateReverse( '\\' ) != VSScacheFolder.Length() - 1 ) |
765 } |
790 } |
766 |
791 |
767 //Get the white list |
792 //Get the white list |
768 TBuf<2048> whiteList; |
793 TBuf<2048> whiteList; |
769 |
794 |
770 if( repository->Get( KPhoneSpecificCacheDomainUrl, whiteList ) == KErrNone ) |
795 if ( repository->Get( KPhoneSpecificCacheDomainUrl, whiteList ) == KErrNone ) |
771 { |
796 { |
772 iVSSWhiteList = HBufC8::NewL( whiteList.Length() ); |
797 iVSSWhiteList = HBufC8::NewL( whiteList.Length() ); |
773 iVSSWhiteList->Des().Append( whiteList ); |
798 iVSSWhiteList->Des().Append( whiteList ); |
774 } |
799 } |
775 else |
800 else |
776 { |
801 { |
777 iVSSWhiteList = NULL; |
802 iVSSWhiteList = NULL; |
778 } |
803 } |
779 |
804 |
780 // create cache handler |
805 // create cache handler |
781 iphoneSpecificCache = CHttpCacheHandler::NewL( VSScacheSize, VSScacheFolder, KDefaultVSSIndexFile(), criticalLevel ); |
806 iphoneSpecificCache = CHttpCacheHandler::NewL( VSScacheSize, VSScacheFolder, KDefaultVSSIndexFile(), criticalLevel, postpone); |
782 } |
807 } |
|
808 |
783 CleanupStack::PopAndDestroy(2); // repository, , repositoryDiskLevel |
809 CleanupStack::PopAndDestroy(2); // repository, , repositoryDiskLevel |
784 } |
810 } |
785 |
811 |
786 // ----------------------------------------------------------------------------- |
812 // ----------------------------------------------------------------------------- |
787 // CHttpCacheManager::CacheHandler |
813 // CHttpCacheManager::CacheHandler |