sl@0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#include "server.h"
|
sl@0
|
17 |
#include "WSGRAPHICDRAWERFACTORY.H"
|
sl@0
|
18 |
#include "panics.h"
|
sl@0
|
19 |
#include <s32mem.h>
|
sl@0
|
20 |
#include "wstop.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
TInt CWsGraphicDrawerObject::TransientSequence=1;
|
sl@0
|
23 |
TBool CWsGraphicDrawerObject::RollOver=EFalse;
|
sl@0
|
24 |
|
sl@0
|
25 |
CWsGraphicDrawerObject* CWsGraphicDrawerObject::NewL(CWsClient* aClient,const TWsClCmdUnion &aParams)
|
sl@0
|
26 |
{
|
sl@0
|
27 |
if(!aClient)
|
sl@0
|
28 |
{
|
sl@0
|
29 |
WS_PANIC_DEBUG(EWsPanicWsGraphic);
|
sl@0
|
30 |
User::Leave(KErrGeneral);
|
sl@0
|
31 |
}
|
sl@0
|
32 |
TGraphicDrawerId id;
|
sl@0
|
33 |
id.iId = aParams.CreateGraphic->iId;
|
sl@0
|
34 |
id.iIsUid = !(EWsGraphicIdTransient & aParams.CreateGraphic->iFlags);
|
sl@0
|
35 |
// check for collision
|
sl@0
|
36 |
const CWsGraphicDrawer* dup = CWsTop::WindowServer()->ResolveGraphic(id);
|
sl@0
|
37 |
// request-specific checks
|
sl@0
|
38 |
if(dup)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
// must be exact same session
|
sl@0
|
41 |
if(&(dup->Owner()) != aClient)
|
sl@0
|
42 |
{
|
sl@0
|
43 |
/* Someone is squatting on someone else's uid, or trying to,
|
sl@0
|
44 |
but there is no good way to know which. */
|
sl@0
|
45 |
__DEBUG_ONLY(aClient->PPanic(EWservPanicPermissionDenied);)
|
sl@0
|
46 |
User::Leave(KErrAlreadyExists);
|
sl@0
|
47 |
}
|
sl@0
|
48 |
// dupping or otherwise must be explicitly intended by the client
|
sl@0
|
49 |
if(!(EWsGraphicReplace & aParams.CreateGraphic->iFlags))
|
sl@0
|
50 |
{
|
sl@0
|
51 |
aClient->PPanic(EWservPanicPermissionDenied);
|
sl@0
|
52 |
}
|
sl@0
|
53 |
}
|
sl@0
|
54 |
else
|
sl@0
|
55 |
{
|
sl@0
|
56 |
// dupping or otherwise must be explicitly intended by the client
|
sl@0
|
57 |
if(EWsGraphicReplace & aParams.CreateGraphic->iFlags)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
aClient->PPanic(EWservPanicPermissionDenied);
|
sl@0
|
60 |
}
|
sl@0
|
61 |
if(id.iIsUid)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
// police creation of artwork with UIDs
|
sl@0
|
64 |
_LIT_SECURITY_POLICY_C1(KSecurityPolicyCreateWithUid,ECapabilityProtServ);
|
sl@0
|
65 |
if(!KSecurityPolicyCreateWithUid.CheckPolicy(aClient->Client()))
|
sl@0
|
66 |
{
|
sl@0
|
67 |
__DEBUG_ONLY(aClient->PPanic(EWservPanicPermissionDenied);)
|
sl@0
|
68 |
User::Leave(KErrPermissionDenied);
|
sl@0
|
69 |
}
|
sl@0
|
70 |
}
|
sl@0
|
71 |
else
|
sl@0
|
72 |
{
|
sl@0
|
73 |
// allocate a new transient id
|
sl@0
|
74 |
// assumption: that there are more values of a TInt than there are possibly Transient objects
|
sl@0
|
75 |
do
|
sl@0
|
76 |
{
|
sl@0
|
77 |
id.iId = TransientSequence++;
|
sl@0
|
78 |
RollOver |= !TransientSequence;
|
sl@0
|
79 |
}
|
sl@0
|
80 |
while(RollOver && CWsTop::WindowServer()->ResolveGraphic(id)); // until no collision
|
sl@0
|
81 |
}
|
sl@0
|
82 |
}
|
sl@0
|
83 |
// create the drawer object
|
sl@0
|
84 |
TPtrC8 data;
|
sl@0
|
85 |
HBufC8* dataBuf = NULL;
|
sl@0
|
86 |
if(aParams.CreateGraphic->iRemoteReadData)
|
sl@0
|
87 |
{
|
sl@0
|
88 |
const TInt len = aParams.CreateGraphic->iDataLen;
|
sl@0
|
89 |
if ((len >= KMaxTInt/4) || (len < 0))
|
sl@0
|
90 |
aClient->PPanic(EWservPanicBuffer);
|
sl@0
|
91 |
dataBuf = HBufC8::NewLC(len);
|
sl@0
|
92 |
TPtr8 des = dataBuf->Des();
|
sl@0
|
93 |
aClient->RemoteRead(des,0);
|
sl@0
|
94 |
if(des.Size() != len)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
aClient->PPanic(EWservPanicBuffer);
|
sl@0
|
97 |
}
|
sl@0
|
98 |
data.Set(des);
|
sl@0
|
99 |
}
|
sl@0
|
100 |
else
|
sl@0
|
101 |
{
|
sl@0
|
102 |
data.Set(CWsClient::BufferTPtr8((TText8*)(aParams.CreateGraphic+1),aParams.CreateGraphic->iDataLen));
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
CWsGraphicDrawerObject* drawer = new(ELeave) CWsGraphicDrawerObject(aClient);
|
sl@0
|
106 |
CleanupStack::PushL(drawer);
|
sl@0
|
107 |
drawer->ConstructL(aParams.CreateGraphic->iType,*CWsTop::WindowServer(),id,data,aParams.CreateGraphic->iClientHandle);
|
sl@0
|
108 |
if(!dup)
|
sl@0
|
109 |
{
|
sl@0
|
110 |
User::LeaveIfError(CWsTop::WindowServer()->AddGraphicDrawer(drawer->Drawer()));
|
sl@0
|
111 |
}
|
sl@0
|
112 |
else
|
sl@0
|
113 |
{
|
sl@0
|
114 |
User::LeaveIfError(CWsTop::WindowServer()->SwapGraphicDrawer(drawer->Drawer()));
|
sl@0
|
115 |
}
|
sl@0
|
116 |
// take off cleanup stack
|
sl@0
|
117 |
CleanupStack::Pop(drawer);
|
sl@0
|
118 |
if(dataBuf)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
CleanupStack::PopAndDestroy(dataBuf);
|
sl@0
|
121 |
}
|
sl@0
|
122 |
// delete dup, which means resolving the object that encapsulates it
|
sl@0
|
123 |
if(dup)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
CWsGraphicDrawerObject* obj = aClient->DrawerObject(dup);
|
sl@0
|
126 |
WS_ASSERT_DEBUG(obj, EWsPanicWsGraphic);
|
sl@0
|
127 |
if(obj)
|
sl@0
|
128 |
{
|
sl@0
|
129 |
obj->CloseObject();
|
sl@0
|
130 |
}
|
sl@0
|
131 |
}
|
sl@0
|
132 |
// trigger redraws if anyone is drawing this graphic before it exists
|
sl@0
|
133 |
if(id.iIsUid)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
CWsTop::WindowServer()->Invalidate(id);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
// done
|
sl@0
|
138 |
return drawer;
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
CWsGraphicDrawerObject::CWsGraphicDrawerObject(CWsClient* aOwner):
|
sl@0
|
142 |
CWsObject(aOwner,WS_HANDLE_GRAPHIC_DRAWER)
|
sl@0
|
143 |
{
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
CWsGraphicDrawerObject::~CWsGraphicDrawerObject()
|
sl@0
|
147 |
{
|
sl@0
|
148 |
delete iDrawer;
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
void CWsGraphicDrawerObject::ConstructL(TUid aType,MWsGraphicDrawerEnvironment& aEnv,const TGraphicDrawerId& aId,const TDesC8& aData,TInt aClientHandle)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
CWsGraphicDrawer* drawer = WsGraphicDrawer::CreateLC(aType,aEnv,aId,*WsOwner(),aData);
|
sl@0
|
154 |
NewObjL();
|
sl@0
|
155 |
iClientHandle = aClientHandle;
|
sl@0
|
156 |
iDrawer=drawer;
|
sl@0
|
157 |
CleanupStack::Pop(iDrawer);
|
sl@0
|
158 |
}
|
sl@0
|
159 |
|
sl@0
|
160 |
void CWsGraphicDrawerObject::CommandL(TInt aOpcode, const TAny *aCmdData)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
WS_ASSERT_DEBUG(iDrawer, EWsPanicWsGraphic);
|
sl@0
|
163 |
|
sl@0
|
164 |
if(iDrawer)
|
sl@0
|
165 |
{
|
sl@0
|
166 |
TWsClCmdUnion pData;
|
sl@0
|
167 |
pData.any = aCmdData;
|
sl@0
|
168 |
switch(aOpcode)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
case EWsGdOpFree:
|
sl@0
|
171 |
// trigger redraws if anyone is drawing this graphic before it exists
|
sl@0
|
172 |
CWsTop::WindowServer()->RemoveGraphicDrawer(iDrawer->Id());
|
sl@0
|
173 |
CloseObject();
|
sl@0
|
174 |
return;
|
sl@0
|
175 |
case EWsGdOpSendMsg:
|
sl@0
|
176 |
case EWsGdOpSendSynchronMsg:
|
sl@0
|
177 |
{
|
sl@0
|
178 |
const TWsClCmdGdSendMessage& cmd = *pData.GraphicSendMessage;
|
sl@0
|
179 |
__ASSERT_DEBUG(cmd.iDataLen,WsOwner()->PPanic(EWservPanicPermissionDenied));
|
sl@0
|
180 |
if(cmd.iDataLen)
|
sl@0
|
181 |
{
|
sl@0
|
182 |
if(cmd.iRemoteReadData)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
HBufC8* wsAlloc = NULL;
|
sl@0
|
185 |
TUint8* drawerAlloc = NULL;
|
sl@0
|
186 |
TPtr8 des(NULL,0);
|
sl@0
|
187 |
// try to get the drawer to allocate for us
|
sl@0
|
188 |
MWsGraphicDrawerMessageAlloc* drawerAllocator = iDrawer->ObjectInterface<MWsGraphicDrawerMessageAlloc>();
|
sl@0
|
189 |
if(drawerAllocator)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
drawerAlloc = reinterpret_cast<TUint8*>(drawerAllocator->Alloc(cmd.iDataLen));
|
sl@0
|
192 |
if(drawerAlloc)
|
sl@0
|
193 |
des.Set(drawerAlloc,0,cmd.iDataLen);
|
sl@0
|
194 |
}
|
sl@0
|
195 |
// else use the normal WSERV default heap
|
sl@0
|
196 |
if(!drawerAlloc)
|
sl@0
|
197 |
{
|
sl@0
|
198 |
wsAlloc = HBufC8::NewLC(cmd.iDataLen);
|
sl@0
|
199 |
des.Set(wsAlloc->Des());
|
sl@0
|
200 |
}
|
sl@0
|
201 |
// fetch
|
sl@0
|
202 |
WsOwner()->RemoteRead(des,0);
|
sl@0
|
203 |
TBool receivedOk = (des.Size() == cmd.iDataLen);
|
sl@0
|
204 |
// dispatch
|
sl@0
|
205 |
if(receivedOk)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
if(aOpcode == EWsGdOpSendMsg)
|
sl@0
|
208 |
{
|
sl@0
|
209 |
iDrawer->HandleMessage(des);
|
sl@0
|
210 |
}
|
sl@0
|
211 |
else
|
sl@0
|
212 |
{
|
sl@0
|
213 |
MWsGraphicHandleSynchronMessage* obj = iDrawer->ObjectInterface<MWsGraphicHandleSynchronMessage>();
|
sl@0
|
214 |
|
sl@0
|
215 |
if(obj)
|
sl@0
|
216 |
SetReply(obj->HandleSynchronMessage(des));
|
sl@0
|
217 |
else
|
sl@0
|
218 |
SetReply(KErrNotSupported);
|
sl@0
|
219 |
}
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
// dealloc
|
sl@0
|
223 |
if(drawerAlloc)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
drawerAllocator->Free(drawerAlloc);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
else
|
sl@0
|
228 |
{
|
sl@0
|
229 |
CleanupStack::PopAndDestroy(wsAlloc);
|
sl@0
|
230 |
}
|
sl@0
|
231 |
// defer panic until after dealloc
|
sl@0
|
232 |
if(!receivedOk)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
WsOwner()->PPanic(EWservPanicBuffer);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
}
|
sl@0
|
237 |
else
|
sl@0
|
238 |
{
|
sl@0
|
239 |
const TPtrC8 data = CWsClient::BufferTPtr8((TText8*)(pData.GraphicSendMessage+1),cmd.iDataLen);
|
sl@0
|
240 |
if(aOpcode == EWsGdOpSendMsg)
|
sl@0
|
241 |
{
|
sl@0
|
242 |
iDrawer->HandleMessage(data);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
else
|
sl@0
|
245 |
{
|
sl@0
|
246 |
MWsGraphicHandleSynchronMessage* obj = iDrawer->ObjectInterface<MWsGraphicHandleSynchronMessage>();
|
sl@0
|
247 |
if(obj)
|
sl@0
|
248 |
SetReply(obj->HandleSynchronMessage(data));
|
sl@0
|
249 |
else
|
sl@0
|
250 |
SetReply(KErrNotSupported);
|
sl@0
|
251 |
}
|
sl@0
|
252 |
}
|
sl@0
|
253 |
}
|
sl@0
|
254 |
}
|
sl@0
|
255 |
break;
|
sl@0
|
256 |
case EWsGdOpGetGraphicId:
|
sl@0
|
257 |
{
|
sl@0
|
258 |
__ASSERT_COMPILE(sizeof(TWsClCmdGdGetId) == sizeof(TGraphicDrawerId));
|
sl@0
|
259 |
const TGraphicDrawerId id = iDrawer->Id();
|
sl@0
|
260 |
CWsClient::ReplyBuf(&id,sizeof(id));
|
sl@0
|
261 |
}
|
sl@0
|
262 |
break;
|
sl@0
|
263 |
case EWsGdOpShareGlobally:
|
sl@0
|
264 |
SetReply(iDrawer->ShareGlobally());
|
sl@0
|
265 |
break;
|
sl@0
|
266 |
case EWsGdOpUnShareGlobally:
|
sl@0
|
267 |
SetReply(iDrawer->UnShareGlobally());
|
sl@0
|
268 |
break;
|
sl@0
|
269 |
case EWsGdOpShare:
|
sl@0
|
270 |
{
|
sl@0
|
271 |
const TSecureId& secid = *reinterpret_cast<const TSecureId*>(aCmdData);
|
sl@0
|
272 |
SetReply(iDrawer->Share(secid));
|
sl@0
|
273 |
break;
|
sl@0
|
274 |
}
|
sl@0
|
275 |
case EWsGdOpUnShare:
|
sl@0
|
276 |
{
|
sl@0
|
277 |
const TSecureId& secid = *reinterpret_cast<const TSecureId*>(aCmdData);
|
sl@0
|
278 |
SetReply(iDrawer->UnShare(secid));
|
sl@0
|
279 |
break;
|
sl@0
|
280 |
}
|
sl@0
|
281 |
default:
|
sl@0
|
282 |
WsOwner()->PPanic(EWservPanicOpcode);
|
sl@0
|
283 |
}
|
sl@0
|
284 |
}
|
sl@0
|
285 |
}
|
sl@0
|
286 |
|
sl@0
|
287 |
CWsGraphicDrawer* CWsGraphicDrawerObject::Drawer()
|
sl@0
|
288 |
{
|
sl@0
|
289 |
return iDrawer;
|
sl@0
|
290 |
}
|
sl@0
|
291 |
|
sl@0
|
292 |
const CWsGraphicDrawer* CWsGraphicDrawerObject::Drawer() const
|
sl@0
|
293 |
{
|
sl@0
|
294 |
return iDrawer;
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
// CWsGraphicMessageQueue \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
sl@0
|
298 |
|
sl@0
|
299 |
CWsGraphicMessageQueue::CMessage* CWsGraphicMessageQueue::CMessage::New(const TDesC8& aData)
|
sl@0
|
300 |
{
|
sl@0
|
301 |
return new(aData.Size()) CMessage(aData);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
CWsGraphicMessageQueue::CMessage::CMessage(const TDesC8& aData):
|
sl@0
|
305 |
iData((reinterpret_cast<TUint8*>(this)+sizeof(*this)),aData.Size())
|
sl@0
|
306 |
{
|
sl@0
|
307 |
iData = aData;
|
sl@0
|
308 |
}
|
sl@0
|
309 |
|
sl@0
|
310 |
TPtrC8 CWsGraphicMessageQueue::CMessage::Data() const
|
sl@0
|
311 |
{
|
sl@0
|
312 |
return iData;
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
void CWsGraphicMessageQueue::CMessage::Release()
|
sl@0
|
316 |
{
|
sl@0
|
317 |
delete this;
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
CWsGraphicMessageQueue::CMessage::~CMessage()
|
sl@0
|
321 |
{
|
sl@0
|
322 |
}
|
sl@0
|
323 |
|
sl@0
|
324 |
CWsGraphicMessageQueue::CWsGraphicMessageQueue(CWsClient *aOwner):
|
sl@0
|
325 |
CEventBase(aOwner)
|
sl@0
|
326 |
{
|
sl@0
|
327 |
}
|
sl@0
|
328 |
|
sl@0
|
329 |
CWsGraphicMessageQueue::~CWsGraphicMessageQueue()
|
sl@0
|
330 |
{
|
sl@0
|
331 |
while(iHead)
|
sl@0
|
332 |
{
|
sl@0
|
333 |
CWsMessageData* msg = iHead;
|
sl@0
|
334 |
iHead = iHead->iNext;
|
sl@0
|
335 |
msg->Release();
|
sl@0
|
336 |
}
|
sl@0
|
337 |
}
|
sl@0
|
338 |
|
sl@0
|
339 |
TInt CWsGraphicMessageQueue::TopClientHandle() const
|
sl@0
|
340 |
{
|
sl@0
|
341 |
if(iHead)
|
sl@0
|
342 |
return iHead->iClientHandle;
|
sl@0
|
343 |
else
|
sl@0
|
344 |
return KErrNotFound;
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
/**
|
sl@0
|
348 |
same functionality as CEventBase::GetData, but this one also inserts the integer header in the reply.
|
sl@0
|
349 |
*/
|
sl@0
|
350 |
void CWsGraphicMessageQueue::GetDataWithHeader(TUint aHeader, const TDesC8& aData, TInt aDataLen)
|
sl@0
|
351 |
{
|
sl@0
|
352 |
TPckgBuf<TUint> hdr = aHeader | (EWsGraphMessageTypeUser & 0x03);
|
sl@0
|
353 |
CWsClient::ReplyBuf(hdr.Ptr(), sizeof(TUint));
|
sl@0
|
354 |
GetData((void*)aData.Ptr(), aDataLen);
|
sl@0
|
355 |
}
|
sl@0
|
356 |
|
sl@0
|
357 |
void CWsGraphicMessageQueue::GetGraphicMessage()
|
sl@0
|
358 |
{
|
sl@0
|
359 |
CWsMessageData* top = Pop();
|
sl@0
|
360 |
WS_ASSERT_DEBUG(top && top->Data().Length(), EWsPanicWsGraphic);
|
sl@0
|
361 |
if(top)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
GetDataWithHeader(top->iClientHandle, top->Data(), top->Data().Size());
|
sl@0
|
364 |
CWsGraphicDrawerObject* obj = iWsOwner->DrawerObject(top->iDrawer);
|
sl@0
|
365 |
if(obj)
|
sl@0
|
366 |
{
|
sl@0
|
367 |
MWsGraphicMessageCallback* messageCallback = obj->Drawer()->ObjectInterface<MWsGraphicMessageCallback>();
|
sl@0
|
368 |
if(messageCallback)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
messageCallback->HandleMessageDelivery(top->iId, KErrNone);
|
sl@0
|
371 |
}
|
sl@0
|
372 |
}
|
sl@0
|
373 |
|
sl@0
|
374 |
top->Release();
|
sl@0
|
375 |
}
|
sl@0
|
376 |
}
|
sl@0
|
377 |
|
sl@0
|
378 |
void CWsGraphicMessageQueue::AbortMessage(TInt aError)
|
sl@0
|
379 |
{
|
sl@0
|
380 |
CWsMessageData* top = Pop();
|
sl@0
|
381 |
WS_ASSERT_DEBUG(top, EWsPanicWsGraphic);
|
sl@0
|
382 |
if(top)
|
sl@0
|
383 |
{
|
sl@0
|
384 |
CWsGraphicDrawerObject* obj = iWsOwner->DrawerObject(top->iDrawer);
|
sl@0
|
385 |
if(obj)
|
sl@0
|
386 |
{
|
sl@0
|
387 |
MWsGraphicMessageCallback* messageCallback = obj->Drawer()->ObjectInterface<MWsGraphicMessageCallback>();
|
sl@0
|
388 |
if(messageCallback)
|
sl@0
|
389 |
{
|
sl@0
|
390 |
messageCallback->HandleMessageDelivery(top->iId, aError);
|
sl@0
|
391 |
}
|
sl@0
|
392 |
}
|
sl@0
|
393 |
top->Release();
|
sl@0
|
394 |
}
|
sl@0
|
395 |
}
|
sl@0
|
396 |
|
sl@0
|
397 |
void CWsGraphicMessageQueue::EventReady(const RMessagePtr2& aEventMsg)
|
sl@0
|
398 |
{
|
sl@0
|
399 |
CEventBase::EventReady(aEventMsg);
|
sl@0
|
400 |
if(iHead)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
SignalEvent(sizeof(TInt) + iHead->Data().Size());
|
sl@0
|
403 |
}
|
sl@0
|
404 |
}
|
sl@0
|
405 |
|
sl@0
|
406 |
|
sl@0
|
407 |
void CWsGraphicMessageQueue::Queue(CWsMessageData* aMessage)
|
sl@0
|
408 |
{
|
sl@0
|
409 |
WS_ASSERT_DEBUG(aMessage && !aMessage->iNext, EWsPanicWsGraphic);
|
sl@0
|
410 |
if(aMessage)
|
sl@0
|
411 |
{
|
sl@0
|
412 |
if(iHead)
|
sl@0
|
413 |
{
|
sl@0
|
414 |
iTail->iNext = aMessage;
|
sl@0
|
415 |
iTail = aMessage;
|
sl@0
|
416 |
}
|
sl@0
|
417 |
else
|
sl@0
|
418 |
{
|
sl@0
|
419 |
iHead = iTail = aMessage;
|
sl@0
|
420 |
if(!iEventMsg.IsNull())
|
sl@0
|
421 |
SignalEvent(sizeof(TInt) + iHead->Data().Size());
|
sl@0
|
422 |
}
|
sl@0
|
423 |
}
|
sl@0
|
424 |
}
|
sl@0
|
425 |
|
sl@0
|
426 |
CWsMessageData* CWsGraphicMessageQueue::Pop()
|
sl@0
|
427 |
{
|
sl@0
|
428 |
CWsMessageData* ret = NULL;
|
sl@0
|
429 |
if(iHead)
|
sl@0
|
430 |
{
|
sl@0
|
431 |
ret = iHead;
|
sl@0
|
432 |
iHead = iHead->iNext;
|
sl@0
|
433 |
}
|
sl@0
|
434 |
return ret;
|
sl@0
|
435 |
}
|