author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 25 May 2010 13:52:38 +0300 | |
branch | RCL_3 |
changeset 71 | 4bd5176e1bc8 |
parent 17 | c8a366e56285 |
child 92 | e1bea15f9a39 |
permissions | -rw-r--r-- |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Implementation of CHttpCacheStreamHandler |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
17 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
18 |
// INCLUDE FILES |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
19 |
#include <f32file.h> |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
20 |
#include "HttpCacheStreamHandler.h" |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
21 |
#include "HttpCacheEntry.h" |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
22 |
#include "HttpCacheUtil.h" |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
23 |
#include "HttpCacheHandler.h" |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
24 |
#include <centralrepository.h> |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
25 |
#include <SysUtilDomainCRKeys.h> |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
26 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
27 |
// EXTERNAL DATA STRUCTURES |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
28 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
29 |
// EXTERNAL FUNCTION PROTOTYPES |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
30 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
31 |
// CONSTANTS |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
32 |
const TInt KHttpCacheActiveCount = 20; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
33 |
#if 0 |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
34 |
const TInt KHttpCacheChunkSize = 2048; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
35 |
#endif // 0 |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
36 |
// MACROS |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
37 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
38 |
// LOCAL CONSTANTS AND MACROS |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
39 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
40 |
// MODULE DATA STRUCTURES |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
41 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
42 |
// LOCAL FUNCTION PROTOTYPES |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
43 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
44 |
// FORWARD DECLARATIONS |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
45 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
46 |
// ============================= LOCAL FUNCTIONS =============================== |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
47 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
48 |
// ============================ MEMBER FUNCTIONS =============================== |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
49 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
50 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
51 |
// CHttpCacheStreamHandler::CHttpCacheStreamHandler |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
52 |
// C++ default constructor can NOT contain any code, that |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
53 |
// might leave. |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
54 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
55 |
// |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
56 |
CHttpCacheStreamHandler::CHttpCacheStreamHandler(RFs& aRFs) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
57 |
: iRfs( aRFs ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
58 |
{ |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
59 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
60 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
61 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
62 |
// CHttpCacheStreamHandler::ConstructL |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
63 |
// Symbian 2nd phase constructor can leave. |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
64 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
65 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
66 |
void CHttpCacheStreamHandler::ConstructL( |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
67 |
const TDesC& aDirectory, |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
68 |
TInt aCriticalLevel) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
69 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
70 |
iActiveEntries = new( ELeave )CArrayPtrFlat<CHttpCacheEntry>( KHttpCacheActiveCount ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
71 |
// get drive letter for sysutil |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
72 |
TParsePtrC pathParser( aDirectory ); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
73 |
iDrive = pathParser.Drive(); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
74 |
iCriticalLevel = aCriticalLevel; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
75 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
76 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
77 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
78 |
// CHttpCacheStreamHandler::NewL |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
79 |
// Two-phased constructor. |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
80 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
81 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
82 |
CHttpCacheStreamHandler* CHttpCacheStreamHandler::NewL( |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
83 |
const TDesC& aDirectory , |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
84 |
TInt aCriticalLevel, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
85 |
RFs& aRFs) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
86 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
87 |
CHttpCacheStreamHandler* self = new( ELeave ) CHttpCacheStreamHandler(aRFs); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
88 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
89 |
CleanupStack::PushL( self ); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
90 |
self->ConstructL( aDirectory , aCriticalLevel); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
91 |
CleanupStack::Pop(); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
92 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
93 |
return self; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
94 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
95 |
|
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
96 |
// ----------------------------------------------------------------------------- |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
97 |
// Destructor |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
98 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
99 |
// |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
100 |
CHttpCacheStreamHandler::~CHttpCacheStreamHandler() |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
101 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
102 |
if ( iActiveEntries ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
103 |
{ |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
104 |
iActiveEntries->ResetAndDestroy(); |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
105 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
106 |
delete iActiveEntries; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
107 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
108 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
109 |
// ----------------------------------------------------------------------------- |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
110 |
// CHttpCacheStreamHandler::InitialiseCacheEntryL |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
111 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
112 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
113 |
void CHttpCacheStreamHandler::InitialiseCacheEntryL(CHttpCacheEntry& aCacheEntry) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
114 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
115 |
// create a filename for the cache entry. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
116 |
TPath sessionPath; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
117 |
User::LeaveIfError( iRfs.SessionPath( sessionPath ) ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
118 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
119 |
// Given the full URL, generates a fully qualified path for saving the HTTP response |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
120 |
HBufC* bodyFileName = HttpCacheUtil::GenerateNameLC( aCacheEntry.Url(), sessionPath ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
121 |
TPtrC bodyFileNamePtr( *bodyFileName ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
122 |
aCacheEntry.SetFileNameL(bodyFileNamePtr); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
123 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
124 |
CleanupStack::PopAndDestroy(bodyFileName); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
125 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
126 |
// any more one-time initialisation to go here. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
127 |
aCacheEntry.SetState( CHttpCacheEntry::ECacheInitialized ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
128 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
129 |
// since this only happens one time, we can check if we have files left over with no index entry |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
130 |
// we're too late to reuse any information stored in there, so lets just delete them. This might prevent any |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
131 |
// problems later down the line.. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
132 |
iRfs.Delete(aCacheEntry.Filename()); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
133 |
// header filename |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
134 |
TFileName headerFileName; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
135 |
HttpCacheUtil::GetHeaderFileName( aCacheEntry.Filename(), headerFileName ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
136 |
iRfs.Delete(headerFileName); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
137 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
138 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
139 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
140 |
// CHttpCacheStreamHandler::Erase |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
141 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
142 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
143 |
// |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
144 |
void CHttpCacheStreamHandler::Erase( CHttpCacheEntry& aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
145 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
146 |
HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheStreamHandler::Erase - erase files associated with" ), aCacheEntry.Url() ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
147 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
148 |
// just in case it's busy being written out... |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
149 |
aCacheEntry.CancelBodyWrite(); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
150 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
151 |
// Delete body file |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
152 |
#ifndef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
153 |
iRfs.Delete( aCacheEntry.Filename() ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
154 |
#else |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
155 |
TInt statusBody( KErrNotFound ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
156 |
statusBody = iRfs.Delete( aCacheEntry.Filename() ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
157 |
#endif |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
158 |
// Adjust the size |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
159 |
iContentSize -= aCacheEntry.BodySize(); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
160 |
iContentSize -= aCacheEntry.HeaderSize(); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
161 |
|
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
162 |
#ifdef __CACHELOG__ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
163 |
if ( statusBody == KErrNone ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
164 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
165 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
166 |
_L("CHttpCacheStreamHandler::Erase - SUCCESS bodyFile delete"), |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
167 |
aCacheEntry.Filename(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
168 |
aCacheEntry.Url(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
169 |
aCacheEntry.BodySize(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
170 |
ELogEntrySize ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
171 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
172 |
else if ( statusBody == KErrNotFound ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
173 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
174 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
175 |
_L("CHttpCacheStreamHandler::Erase - CHECK bodyFile not found."), |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
176 |
aCacheEntry.Filename(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
177 |
aCacheEntry.Url(), |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
178 |
statusBody, |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
179 |
ELogFileErrorCode ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
180 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
181 |
else |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
182 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
183 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
184 |
_L("CHttpCacheStreamHandler::Erase - ERROR bodyFile delete"), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
185 |
aCacheEntry.Filename(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
186 |
aCacheEntry.Url(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
187 |
statusBody, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
188 |
ELogFileErrorCode ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
189 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
190 |
#endif //__CACHELOG__ |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
191 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
192 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
193 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
194 |
// CHttpCacheStreamHandler::HeadersL |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
195 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
196 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
197 |
// |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
198 |
HBufC8* CHttpCacheStreamHandler::HeadersL( CHttpCacheEntry& aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
199 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
200 |
return aCacheEntry.HeaderData().AllocL(); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
201 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
202 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
203 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
204 |
// CHttpCacheStreamHandler::NextChunkL |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
205 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
206 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
207 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
208 |
HBufC8* CHttpCacheStreamHandler::NextChunkL( |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
209 |
CHttpCacheEntry& aCacheEntry, |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
210 |
TBool& aLastChunk ) |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
211 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
212 |
HBufC8 *bodyStr = NULL; |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
213 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
214 |
if ( !aCacheEntry.BodyDataCached() && OpenBodyFile(aCacheEntry) ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
215 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
216 |
CleanupClosePushL( aCacheEntry.BodyFile() ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
217 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
218 |
// read body |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
219 |
TInt size; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
220 |
TInt err( aCacheEntry.BodyFile().Size( size ) ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
221 |
if ( err == KErrNone && size > 0 ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
222 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
223 |
bodyStr = HBufC8::NewL( size ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
224 |
TPtr8 ptr( bodyStr->Des() ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
225 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
226 |
err = aCacheEntry.BodyFile().Read( ptr, size ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
227 |
#ifdef __CACHELOG__ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
228 |
if ( err != KErrNone ) { |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
229 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
230 |
_L("CCHttpCacheStreamEntry::NextChunkL - bodyFile.read"), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
231 |
aCacheEntry.Filename(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
232 |
aCacheEntry.Url(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
233 |
err, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
234 |
ELogFileErrorCode ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
235 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
236 |
else { |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
237 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
238 |
_L("CCHttpCacheStreamEntry::NextChunkL - bodyFile.read"), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
239 |
aCacheEntry.Filename(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
240 |
aCacheEntry.Url(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
241 |
ptr.Length(), |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
242 |
ELogEntrySize ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
243 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
244 |
#endif // __CACHELOG__ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
245 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
246 |
// Close body file |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
247 |
CleanupStack::PopAndDestroy(1); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
248 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
249 |
else |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
250 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
251 |
// reuse stored data if we have any. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
252 |
CSegmentedHeapBuffer& buffer = aCacheEntry.BodyData(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
253 |
TInt size = buffer.Length(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
254 |
bodyStr = HBufC8::NewL( size ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
255 |
TPtr8 ptr(bodyStr->Des()); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
256 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
257 |
TInt readSegment = 0; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
258 |
TInt count = buffer.Count(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
259 |
while(readSegment < count) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
260 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
261 |
TPtrC8 source = buffer.GetSegmentData(readSegment); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
262 |
ptr.Append(source); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
263 |
} |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
264 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
265 |
aLastChunk = ETrue; |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
266 |
return bodyStr; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
267 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
268 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
269 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
270 |
// CHttpCacheStreamHandler::SaveHeaders |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
271 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
272 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
273 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
274 |
TBool CHttpCacheStreamHandler::SaveHeaders( |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
275 |
CHttpCacheEntry& aCacheEntry, |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
276 |
const TDesC8& aHeaderStr ) |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
277 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
278 |
TBool headerSaved( EFalse ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
279 |
TInt headerLen = aHeaderStr.Length(); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
280 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
281 |
if ( headerLen && IsDiskSpaceAvailable( headerLen ) ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
282 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
283 |
TRAPD(err, aCacheEntry.CreateHeaderBufferL(aHeaderStr)); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
284 |
if ( err == KErrNone ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
285 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
286 |
iContentSize += aCacheEntry.HeaderSize(); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
287 |
headerSaved = ETrue; |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
288 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
289 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
290 |
return headerSaved; |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
291 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
292 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
293 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
294 |
// CHttpCacheStreamHandler::RemoveHeaders |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
295 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
296 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
297 |
// |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
298 |
void CHttpCacheStreamHandler::RemoveHeaders( CHttpCacheEntry& aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
299 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
300 |
iContentSize -= aCacheEntry.HeaderSize(); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
301 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
302 |
TRAP_IGNORE( aCacheEntry.CreateHeaderBufferL( 0 ) ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
303 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
304 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
305 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
306 |
// CHttpCacheStreamHandler::SaveBodyData |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
307 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
308 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
309 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
310 |
TBool CHttpCacheStreamHandler::SaveBodyData( |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
311 |
CHttpCacheEntry& aCacheEntry, |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
312 |
const TDesC8& aBodyStr ) |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
313 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
314 |
TInt bodySaved( KErrNone ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
315 |
TInt newBodyLength( aBodyStr.Length() ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
316 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
317 |
if ( newBodyLength ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
318 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
319 |
TInt remainder = 0; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
320 |
CSegmentedHeapBuffer& cacheBuffer = aCacheEntry.BodyData(); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
321 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
322 |
// Add data to the buffer |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
323 |
TRAPD( err, cacheBuffer.AppendL(remainder, aBodyStr) ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
324 |
if ( err == KErrNone ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
325 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
326 |
aCacheEntry.SetBodyDataCached(ETrue); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
327 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
328 |
else |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
329 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
330 |
// We failed to allocate memory to store the new data in the current buffer. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
331 |
// Check to see if it's possible to write it to disk instead. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
332 |
TBool bodyFileCreated = CreateNewBodyFile( aCacheEntry ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
333 |
if ( !bodyFileCreated ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
334 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
335 |
return EFalse; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
336 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
337 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
338 |
TBool enoughSpace; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
339 |
enoughSpace = IsDiskSpaceAvailable( cacheBuffer.Length() + remainder ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
340 |
if ( enoughSpace ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
341 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
342 |
// In this case, we have not been able to store all the data. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
343 |
// if there is enough space on disk to write everything we know |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
344 |
// about now, we will flush the current buffer out synchronously. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
345 |
TInt block=0; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
346 |
TInt count = cacheBuffer.Count(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
347 |
while ( bodySaved == KErrNone && count > block ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
348 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
349 |
TPtrC8 buf = cacheBuffer.GetSegmentData(block); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
350 |
bodySaved = aCacheEntry.BodyFile().Write(buf); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
351 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
352 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
353 |
else |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
354 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
355 |
// disk too full, drop the cache data |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
356 |
bodySaved = KErrDiskFull; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
357 |
// reset buffers |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
358 |
cacheBuffer.Reset(); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
359 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
360 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
361 |
if ( bodySaved == KErrNone ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
362 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
363 |
// We have completed writing out the cached data, now |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
364 |
// try to save the new data if we haven't run out of disk space. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
365 |
bodySaved = aCacheEntry.BodyFile().Write(aBodyStr.Right(remainder)); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
366 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
367 |
aCacheEntry.SetBodyDataCached(EFalse); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
368 |
aCacheEntry.BodyFile().Close(); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
369 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
370 |
// update size information |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
371 |
aCacheEntry.SetBodySize( aCacheEntry.BodySize() + newBodyLength ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
372 |
iContentSize += aBodyStr.Length(); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
373 |
} |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
374 |
return ( bodySaved == KErrNone ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
375 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
376 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
377 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
378 |
// CHttpCacheStreamHandler::RemoveBodyData |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
379 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
380 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
381 |
// |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
382 |
void CHttpCacheStreamHandler::RemoveBodyData( CHttpCacheEntry& aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
383 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
384 |
#ifdef __CACHELOG__ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
385 |
HttpCacheUtil::WriteLogFilenameAndUrl( 0, |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
386 |
_L("CHttpCacheStreamHandler::RemoveBodyData - CLEAR iCacheBuffer, entrySize, and iBodyFile"), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
387 |
aCacheEntry.Filename(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
388 |
aCacheEntry.Url(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
389 |
aCacheEntry.BodySize(), |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
390 |
ELogEntrySize ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
391 |
#endif |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
392 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
393 |
// Remove data |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
394 |
iContentSize -= aCacheEntry.BodySize(); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
395 |
aCacheEntry.SetBodySize( 0 ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
396 |
aCacheEntry.BodyData().Reset(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
397 |
if ( OpenBodyFile(aCacheEntry) ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
398 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
399 |
aCacheEntry.BodyFile().SetSize( 0 ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
400 |
aCacheEntry.BodyFile().Close(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
401 |
} |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
402 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
403 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
404 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
405 |
// CHttpCacheStreamHandler::Flush |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
406 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
407 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
408 |
// |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
409 |
TBool CHttpCacheStreamHandler::Flush( CHttpCacheEntry& aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
410 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
411 |
TInt err( KErrNone ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
412 |
TBool bFlushed( EFalse ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
413 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
414 |
TRAP( err, bFlushed = FlushL( aCacheEntry ) ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
415 |
if ( err || !bFlushed ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
416 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
417 |
return EFalse; |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
418 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
419 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
420 |
return ETrue; |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
421 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
422 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
423 |
// ----------------------------------------------------------------------------- |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
424 |
// CHttpCacheStreamHandler::FlushL |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
425 |
// |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
426 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
427 |
// |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
428 |
TBool CHttpCacheStreamHandler::FlushL( CHttpCacheEntry& aCacheEntry ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
429 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
430 |
TInt saveOk( KErrNone ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
431 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
432 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
433 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: >>StreamHander::Flush object %08x"), &aCacheEntry ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
434 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
435 |
CSegmentedHeapBuffer& cacheBuffer = aCacheEntry.BodyData(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
436 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
437 |
TInt dataLength = cacheBuffer.Length() + aCacheEntry.HeaderData().Length(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
438 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
439 |
if ( !IsDiskSpaceAvailable( dataLength ) || !CreateNewBodyFile( aCacheEntry ) ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
440 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
441 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
442 |
HttpCacheUtil::WriteLog(0, _L("CACHEPOSTPONE: Flush failed: not enough space or cannot create file.")); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
443 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
444 |
// can't flush if not enough space, or cannot create new files |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
445 |
return EFalse; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
446 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
447 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
448 |
// files are open, push them onto cleanup stack. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
449 |
CleanupClosePushL( aCacheEntry.BodyFile() ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
450 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
451 |
if ( aCacheEntry.BodyDataCached() ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
452 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
453 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
454 |
HttpCacheUtil::WriteLog(0, _L("CACHEPOSTPONE: Body Data is Cached")); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
455 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
456 |
// append body |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
457 |
TInt segment=0; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
458 |
TInt count=cacheBuffer.Count(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
459 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
460 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: %d segments stored"), count); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
461 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
462 |
while ( saveOk == KErrNone && count > segment ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
463 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
464 |
TPtrC8 segBuf = cacheBuffer.GetSegmentData(segment); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
465 |
saveOk = aCacheEntry.BodyFile().Write( segBuf ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
466 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
467 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: segment %d write returned %d"), (segment-1), saveOk ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
468 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
469 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
470 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
471 |
cacheBuffer.Reset(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
472 |
aCacheEntry.SetBodyDataCached(EFalse); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
473 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
474 |
// close files |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
475 |
CleanupStack::PopAndDestroy(1); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
476 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
477 |
return ( saveOk == KErrNone ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
478 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
479 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
480 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
481 |
// CHttpCacheStreamHandler::FlushAsync |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
482 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
483 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
484 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
485 |
TInt CHttpCacheStreamHandler::FlushAsync(CHttpCacheEntry& aEntry, TRequestStatus& aStatus) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
486 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
487 |
TInt saveOk( KErrNone ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
488 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
489 |
TInt datalen = aEntry.BodyData().Length() + aEntry.HeaderData().Length(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
490 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
491 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
492 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: CHttpCacheStreamEntry::FlushAsync called on object %08x. Cached data %d bytes"), &aEntry, datalen ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
493 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
494 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
495 |
if ( datalen && aEntry.BodyData().Length() ) // don't bother writing files which have no body data |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
496 |
{ |
17
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
497 |
if ( IsDiskSpaceAvailable( datalen ) && CreateNewBodyFile( aEntry, ETrue ) ) |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
498 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
499 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
500 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: Triggering Async write for object 0x%08x."), &aEntry); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
501 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
502 |
// trim any spare space available. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
503 |
aEntry.BodyData().Compress(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
504 |
aEntry.WriteBodyDataAsync(aStatus); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
505 |
aEntry.SetDelayedWriteInProgress(ETrue); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
506 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
507 |
else |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
508 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
509 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
510 |
HttpCacheUtil::WriteLog(0, _L("CACHEPOSTPONE: FAILED FlushAsync.")); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
511 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
512 |
// !enoughSpace |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
513 |
saveOk = KErrDiskFull; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
514 |
aEntry.BodyData().Reset(); |
71
4bd5176e1bc8
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
17
diff
changeset
|
515 |
TRequestStatus *stat = &aStatus; |
4bd5176e1bc8
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
17
diff
changeset
|
516 |
User::RequestComplete(stat, saveOk); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
517 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
518 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
519 |
else |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
520 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
521 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
522 |
HttpCacheUtil::WriteFormatLog(0, _L("CACHEPOSTPONE: Not writing file %S for entry %08x since it has no data."), &(aEntry.Filename()), &aEntry ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
523 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
524 |
TRequestStatus* stat = &aStatus; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
525 |
User::RequestComplete(stat, KErrNone); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
526 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
527 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
528 |
return ( saveOk == KErrNone ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
529 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
530 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
531 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
532 |
// CHttpCacheStreamHandler::OpenBodyFile |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
533 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
534 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
535 |
TBool CHttpCacheStreamHandler::OpenBodyFile( CHttpCacheEntry& aCacheEntry ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
536 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
537 |
TInt statusBody( KErrNotFound ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
538 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
539 |
// get body filename |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
540 |
TFileName bodyFileName = aCacheEntry.Filename(); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
541 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
542 |
statusBody = aCacheEntry.BodyFile().Open( iRfs, bodyFileName, EFileShareExclusive | EFileWrite ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
543 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
544 |
return ( statusBody == KErrNone ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
545 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
546 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
547 |
#if 0 |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
548 |
// ----------------------------------------------------------------------------- |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
549 |
// CHttpCacheStreamHandler::CreateNewFilesL |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
550 |
// |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
551 |
// ----------------------------------------------------------------------------- |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
552 |
// |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
553 |
TBool CHttpCacheStreamHandler::CreateNewFilesL( CHttpCacheEntry& aCacheEntry ) |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
554 |
{ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
555 |
TInt statusHeader( KErrNotFound ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
556 |
TInt statusBody( KErrNotFound ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
557 |
|
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
558 |
// Create header file name from body file name |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
559 |
TFileName headerFileName; |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
560 |
HttpCacheUtil::GetHeaderFileName( aCacheEntry.Filename(), headerFileName ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
561 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
562 |
// Create the body file or replace it, if it exists. |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
563 |
statusBody = aCacheEntry.BodyFile().Replace( iRfs, aCacheEntry.Filename(), EFileShareExclusive | EFileWrite ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
564 |
if ( statusBody == KErrNone ) |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
565 |
{ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
566 |
// Header file should not fail |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
567 |
statusHeader = aCacheEntry.HeaderFile().Replace( iRfs, headerFileName, EFileShareExclusive | EFileWrite ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
568 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
569 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
570 |
#ifdef __CACHELOG__ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
571 |
HttpCacheUtil::WriteUrlToLog( 0, bodyFileNamePtr, aCacheEntry.Url() ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
572 |
#endif |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
573 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
574 |
TBool fileOk( statusHeader == KErrNone && statusBody == KErrNone ); |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
575 |
if ( !fileOk ) |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
576 |
{ |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
577 |
// Only the body file created, no header file, delete body file |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
578 |
iRfs.Delete( aCacheEntry.Filename() ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
579 |
iRfs.Delete( headerFileName ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
580 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
581 |
aCacheEntry.SetBodySize( 0 ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
582 |
aCacheEntry.SetHeaderSize( 0 ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
583 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
584 |
#ifdef __CACHELOG__ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
585 |
HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEntry::CreateNewFilesL - DELETE body file, header file failed" ) ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
586 |
#endif |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
587 |
// __ASSERT_DEBUG( EFalse, User::Panic( _L("CHttpCacheHandler::CreateNewFilesL Panic"), KErrCorrupt ) ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
588 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
589 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
590 |
return fileOk; |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
591 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
592 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
593 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
594 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
595 |
// CHttpCacheStreamHandler::CreateNewBodyFile |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
596 |
// |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
597 |
// ----------------------------------------------------------------------------- |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
598 |
// |
17
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
599 |
TBool CHttpCacheStreamHandler::CreateNewBodyFile( CHttpCacheEntry& aCacheEntry, TBool aUseDirectIO ) |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
600 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
601 |
TInt statusBody( KErrNotFound ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
602 |
|
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
603 |
// Create the body file or replace it, if it exists. |
17
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
604 |
#ifdef BRDO_RFILE_WRITE_DIRECT_IO_FF |
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
605 |
statusBody = aCacheEntry.BodyFile().Replace( iRfs, aCacheEntry.Filename(), EFileShareExclusive | EFileWrite | (aUseDirectIO ? EFileWriteDirectIO : 0) ); |
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
606 |
#else |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
607 |
statusBody = aCacheEntry.BodyFile().Replace( iRfs, aCacheEntry.Filename(), EFileShareExclusive | EFileWrite ); |
17
c8a366e56285
Revision: 200937
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
16
diff
changeset
|
608 |
#endif |
16
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
609 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
610 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
611 |
HttpCacheUtil::WriteUrlToLog( 0, aCacheEntry.Filename(), aCacheEntry.Url() ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
612 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
613 |
|
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
614 |
if ( statusBody != KErrNone ) |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
615 |
{ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
616 |
aCacheEntry.SetBodySize( 0 ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
617 |
aCacheEntry.BodyData().Reset(); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
618 |
#ifdef __CACHELOG__ |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
619 |
HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEntry::CreateNewBodyFileL - create body file failed!" ) ); |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
620 |
#endif |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
621 |
} |
a359256acfc6
Revision: 200929
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
8
diff
changeset
|
622 |
return ( statusBody == KErrNone ); |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
623 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
624 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
625 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
626 |
// CHttpCacheStreamHandler::FindCacheEntryIndex |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
627 |
// |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
628 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
629 |
// |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
630 |
void CHttpCacheStreamHandler::FindCacheEntryIndex( |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
631 |
const CHttpCacheEntry& aCacheEntry, |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
632 |
TInt* aIndex ) |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
633 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
634 |
for ( TInt i = 0; i < iActiveEntries->Count(); i++ ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
635 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
636 |
CHttpCacheEntry* entry = iActiveEntries->At( i ); |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
637 |
|
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
638 |
if ( entry == &aCacheEntry ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
639 |
{ |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
640 |
if ( aIndex ) |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
641 |
{ |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
642 |
*aIndex = i; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
643 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
644 |
break; |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
645 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
646 |
} |
8
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
647 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
648 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
649 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
650 |
// CHttpCacheStreamHandler::IsDiskSpaceAvailable |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
651 |
// |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
652 |
// ----------------------------------------------------------------------------- |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
653 |
// |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
654 |
TBool CHttpCacheStreamHandler::IsDiskSpaceAvailable( TInt aContentSize ) |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
655 |
{ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
656 |
TBool diskSpaceAvailable( EFalse ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
657 |
TVolumeInfo vinfo; |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
658 |
TInt errorCode = iRfs.Volume( vinfo, iDrive ); |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
659 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
660 |
if ( errorCode == KErrNone && ( vinfo.iFree - aContentSize ) > iCriticalLevel ) |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
661 |
{ |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
662 |
// We have space on the disk for the content |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
663 |
diskSpaceAvailable = ETrue; |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
664 |
} |
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
665 |
|
7c90e6132015
Revision: 200915
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
0
diff
changeset
|
666 |
return diskSpaceAvailable; |
0
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
667 |
} |
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
668 |
|
dd21522fd290
Revision: 200911
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
669 |
// End of File |