1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 // All rights reserved. |
2 // All rights reserved. |
3 // This component and the accompanying materials are made available |
3 // This component and the accompanying materials are made available |
4 // under the terms of the License "Eclipse Public License v1.0" |
4 // under the terms of "Eclipse Public License v1.0" |
5 // which accompanies this distribution, and is available |
5 // which accompanies this distribution, and is available |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 // |
7 // |
8 // Initial Contributors: |
8 // Initial Contributors: |
9 // Nokia Corporation - initial contribution. |
9 // Nokia Corporation - initial contribution. |
50 static void CleanupRFbsSession(TAny*) |
56 static void CleanupRFbsSession(TAny*) |
51 { |
57 { |
52 RFbsSession::Disconnect(); |
58 RFbsSession::Disconnect(); |
53 } |
59 } |
54 |
60 |
55 static void RunServerL(MApaAppStarter* aAppStarter) |
61 static void RunServerL() |
56 // |
62 // |
57 // Perform all server initialisation, in particular creation of the |
63 // Perform all server initialisation, in particular creation of the |
58 // scheduler and server and then run the scheduler |
64 // scheduler and server and then run the scheduler |
59 // |
65 // |
60 { |
66 { |
61 MApaAppStarter* appStarter = aAppStarter; |
|
62 // create and install the active scheduler we need |
67 // create and install the active scheduler we need |
63 CSvActiveScheduler::NewLC(); |
68 CSvActiveScheduler::NewLC(); |
|
69 |
64 // create a RFbsSession |
70 // create a RFbsSession |
65 User::LeaveIfError(RFbsSession::Connect()); |
71 User::LeaveIfError(RFbsSession::Connect()); |
66 CleanupStack::PushL(TCleanupItem(CleanupRFbsSession, NULL)); |
72 CleanupStack::PushL(TCleanupItem(CleanupRFbsSession, NULL)); |
67 // |
73 |
68 // create the server (leave it on the cleanup stack) |
74 // create the server (leave it on the cleanup stack) |
69 CApaAppListServer* appListServer = CApaAppListServer::NewL(appStarter); |
75 CApaAppArcServer* appArcServer = CApaAppArcServer::NewL(); |
70 CleanupStack::PushL(appListServer); |
76 CleanupStack::PushL(appArcServer); |
71 // |
77 |
72 // Initialisation complete, now signal the client |
78 // Initialisation complete, now signal the client |
73 #ifdef APA_SERVER_IN_THREAD |
79 RProcess::Rendezvous(KErrNone); |
74 RThread::Rendezvous(KErrNone); |
80 |
75 #else |
|
76 if(aAppStarter) |
|
77 { |
|
78 // Launching in a thread within an existing process. |
|
79 RThread::Rendezvous(KErrNone); |
|
80 } |
|
81 else |
|
82 { |
|
83 RProcess::Rendezvous(KErrNone); |
|
84 } |
|
85 #endif |
|
86 // |
|
87 // Ready to run |
81 // Ready to run |
88 CActiveScheduler::Start(); |
82 CActiveScheduler::Start(); |
89 // |
83 |
90 // Cleanup the server, RFbsSession and scheduler |
84 // Cleanup the server, RFbsSession and scheduler |
91 CleanupStack::PopAndDestroy(3); |
85 CleanupStack::PopAndDestroy(3); |
92 } |
86 } |
93 |
87 |
94 static TInt RunServer(MApaAppStarter* aAppStarter) |
88 static TInt RunServer() |
95 // |
89 // |
96 // Main entry-point for the server thread |
90 // Main entry-point for the server thread |
97 // |
91 // |
98 { |
92 { |
99 __UHEAP_MARK; |
93 __UHEAP_MARK; |