|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Active scheduler for MPM server. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "mpmscheduler.h" |
|
19 #include "mpmlogger.h" |
|
20 |
|
21 // --------------------------------------------------------------------------- |
|
22 // Two phased construction. |
|
23 // --------------------------------------------------------------------------- |
|
24 // |
|
25 CMpmScheduler* CMpmScheduler::NewL() |
|
26 { |
|
27 CMpmScheduler* self = CMpmScheduler::NewLC(); |
|
28 CleanupStack::Pop( self ); |
|
29 return self; |
|
30 } |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // Two phased construction. |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CMpmScheduler* CMpmScheduler::NewLC() |
|
37 { |
|
38 CMpmScheduler* self = new( ELeave ) CMpmScheduler(); |
|
39 CleanupStack::PushL( self ); |
|
40 self->ConstructL(); |
|
41 return self; |
|
42 } |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // Destructor. |
|
46 // --------------------------------------------------------------------------- |
|
47 // |
|
48 CMpmScheduler::~CMpmScheduler() |
|
49 { |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // Constructor. |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CMpmScheduler::CMpmScheduler() : iMpmServer( NULL ) |
|
57 { |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // Second phase constructor. |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 void CMpmScheduler::ConstructL() |
|
65 { |
|
66 } |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // Set the MPM server pointer. Used to restart the server in error situation |
|
70 // if needed. |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 void CMpmScheduler::SetMpmServer( CServer2* aMpmServer ) |
|
74 { |
|
75 iMpmServer = aMpmServer; |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // Error handling for the active scheduler. |
|
80 // Handles any leave occuring in an active object's RunL() function that hasn't |
|
81 // been properly handled in the active object's own RunError() function. |
|
82 // |
|
83 // All active objects in MPM server should handle their own error situations. |
|
84 // If execution ends up here, there is a problem in the originating active |
|
85 // object RunL() function and the problem should be fixed there. |
|
86 // --------------------------------------------------------------------------- |
|
87 // |
|
88 void CMpmScheduler::Error( TInt aError ) const |
|
89 { |
|
90 MPMLOGSTRING2( "CMpmScheduler::Error, ERROR: %d", aError ) |
|
91 aError = aError; |
|
92 |
|
93 // Restart server if not active. |
|
94 if ( iMpmServer && !iMpmServer->IsActive() ) |
|
95 { |
|
96 iMpmServer->ReStart(); |
|
97 } |
|
98 } |
|
99 |
|
100 // End of file |