|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __IMAGE_PROCESSOR_CALLBACK_H__ |
|
17 #define __IMAGE_PROCESSOR_CALLBACK_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 |
|
21 namespace ImageProcessor |
|
22 { |
|
23 |
|
24 class MImgProcessorObserver; |
|
25 class CImgProcessor; |
|
26 |
|
27 /* AO for callback makes concurrency issues easier when client makes calls |
|
28 from callback e.g. deletes image processor from within a callback. |
|
29 Callbacks must be able to succeed (or at least a best effort to ensure |
|
30 that they will succeed. e.g. client may wait indefinately if ImageProcessingComplete |
|
31 callback cannot be made because of OOM. |
|
32 Some callbacks are not in direct response to client request. |
|
33 e.g. Progress indications - Can possibly use a pre-allocated queue. |
|
34 The AO must be able to handle multiple outstanding callbacks. |
|
35 At the moment simultaneous Processing & Rendering is not supported (CAPS restriction) |
|
36 A work around is possible but then the callback AO should also be able to handle it. |
|
37 The callback AO must be running at a higher priority than the worker AO, to ensure |
|
38 callbacks are not delayed (e.g. receiving all progress callbacks only after processing had completed)*/ |
|
39 |
|
40 NONSHARABLE_CLASS(CImageProcessorCallback) : public CActive |
|
41 { |
|
42 public: |
|
43 static CImageProcessorCallback* NewL(CImgProcessor& aImageProcessor,MImgProcessorObserver& aObserver); |
|
44 ~CImageProcessorCallback(); |
|
45 |
|
46 void AddCallback(TInt aEventId, TUid aUid, TInt aId, TInt aError); |
|
47 |
|
48 private: |
|
49 class TCallbackInfo |
|
50 { |
|
51 public: |
|
52 TCallbackInfo(TInt aEventId, TUid aUid, TInt aId, TInt aError); |
|
53 |
|
54 public: |
|
55 TInt iEventId; |
|
56 TUid iUid; |
|
57 TInt iId; |
|
58 TInt iError; |
|
59 }; |
|
60 |
|
61 CImageProcessorCallback(CImgProcessor& aImageProcessor, MImgProcessorObserver& aObserver); |
|
62 void ConstructL(); |
|
63 void SelfComplete(); |
|
64 |
|
65 //from CActive |
|
66 void RunL(); |
|
67 void DoCancel(); |
|
68 |
|
69 void EnsureSpace(); |
|
70 |
|
71 private: |
|
72 CImgProcessor& iProcessor; |
|
73 MImgProcessorObserver& iObserver; |
|
74 RArray<TCallbackInfo> iCallbackInfo; |
|
75 }; |
|
76 |
|
77 } |
|
78 |
|
79 #endif //__IMAGE_PROCESSOR_CALLBACK_H__ |