24 // ================= MEMBER FUNCTIONS ========================================== |
24 // ================= MEMBER FUNCTIONS ========================================== |
25 // ----------------------------------------------------------------------------- |
25 // ----------------------------------------------------------------------------- |
26 // CFSMailRequestHandler::CFSMailRequestHandler |
26 // CFSMailRequestHandler::CFSMailRequestHandler |
27 // ----------------------------------------------------------------------------- |
27 // ----------------------------------------------------------------------------- |
28 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler( |
28 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler( |
29 MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager) |
29 MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager), iInstanceCounter( 1 ) |
30 { |
30 { |
31 FUNC_LOG; |
31 FUNC_LOG; |
32 |
|
33 // store pointer to TLS |
|
34 TInt err = Dll::SetTls(static_cast<TAny*>(this)); |
|
35 } |
32 } |
36 |
33 |
37 // ----------------------------------------------------------------------------- |
34 // ----------------------------------------------------------------------------- |
38 // CFSMailRequestHandler::~CFSMailRequestHandler |
35 // CFSMailRequestHandler::~CFSMailRequestHandler |
39 // ----------------------------------------------------------------------------- |
36 // ----------------------------------------------------------------------------- |
40 |
|
41 CFSClientAPIRequestHandler::~CFSClientAPIRequestHandler() |
37 CFSClientAPIRequestHandler::~CFSClientAPIRequestHandler() |
42 { |
38 { |
43 FUNC_LOG; |
39 FUNC_LOG; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // CFSMailRequestHandler::GetInstanceL |
|
44 // ----------------------------------------------------------------------------- |
|
45 CFSClientAPIRequestHandler* CFSClientAPIRequestHandler::GetInstanceL( MEmailClientPluginManager* aPluginManager ) |
|
46 { |
|
47 CFSClientAPIRequestHandler *requestHandler = static_cast<CFSClientAPIRequestHandler*>( Dll::Tls() ); |
|
48 if ( requestHandler == NULL ) |
|
49 { |
|
50 requestHandler = CFSClientAPIRequestHandler::NewL( aPluginManager ); |
|
51 } |
|
52 else |
|
53 { |
|
54 requestHandler->iInstanceCounter++; |
|
55 } |
|
56 |
|
57 return requestHandler; |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CFSMailRequestHandler::ReleaseInstance |
|
62 // ----------------------------------------------------------------------------- |
|
63 void CFSClientAPIRequestHandler::ReleaseInstance() |
|
64 { |
|
65 if( iInstanceCounter > 1 ) |
|
66 { |
|
67 iInstanceCounter--; |
|
68 } |
|
69 else |
|
70 { |
|
71 delete this; |
|
72 } |
44 } |
73 } |
45 |
74 |
46 // ----------------------------------------------------------------------------- |
75 // ----------------------------------------------------------------------------- |
47 // CFSMailRequestHandler::NewL |
76 // CFSMailRequestHandler::NewL |
48 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |