1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef MEMSPYDRIVERUSEREVENTMONITOR_H |
|
19 #define MEMSPYDRIVERUSEREVENTMONITOR_H |
|
20 |
|
21 // System includes |
|
22 #include <e32cmn.h> |
|
23 #include <kern_priv.h> |
|
24 #ifdef __MARM__ |
|
25 #include <arm.h> |
|
26 #endif |
|
27 |
|
28 // User includes |
|
29 #include "MemSpyDriverEventMonitor.h" |
|
30 |
|
31 // Classes referenced |
|
32 class DMemSpyDriverDevice; |
|
33 class DMemSpyDriverClientEM; |
|
34 |
|
35 |
|
36 class DMemSpyDriverClientEMManager : public DBase |
|
37 { |
|
38 public: |
|
39 DMemSpyDriverClientEMManager( DMemSpyDriverDevice& aDevice ); |
|
40 ~DMemSpyDriverClientEMManager(); |
|
41 TInt Create(); |
|
42 |
|
43 public: // API |
|
44 DMemSpyDriverClientEM* EMOpen(); |
|
45 TInt EMClose( TUint aHandle ); |
|
46 DMemSpyDriverClientEM* EMInstance( TUint aHandle ); |
|
47 |
|
48 private: // Internal methods |
|
49 void FreeAllInstances(); |
|
50 |
|
51 private: |
|
52 DMemSpyDriverDevice& iDevice; |
|
53 TUint iNextHandle; |
|
54 SDblQue iEMInstances; |
|
55 }; |
|
56 |
|
57 |
|
58 /** |
|
59 * This class represents a client-originated Event Monitor request |
|
60 */ |
|
61 class DMemSpyDriverClientEM : public DBase, public MMemSpyEventMonitorObserver |
|
62 { |
|
63 public: |
|
64 DMemSpyDriverClientEM( DMemSpyDriverDevice& aDevice, TUint aHandle ); |
|
65 ~DMemSpyDriverClientEM(); |
|
66 TInt Create(); |
|
67 |
|
68 public: // API |
|
69 inline TUint Handle() const { return iHandle; } |
|
70 // |
|
71 TInt NotifyChanges( DThread* aClientThread, TRequestStatus* aClientRS, TAny* aClientContext ); |
|
72 TInt NotifyChangesCancel(); |
|
73 |
|
74 public: // From MMemSpyEventMonitorObserver |
|
75 TUint EMTypeMask() const; |
|
76 void EMHandleProcessAdd( DProcess& aProcess ); |
|
77 void EMHandleProcessRemoved( DProcess& aProcess ); |
|
78 void EMHandleThreadAdd( DThread& aThread ); |
|
79 void EMHandleThreadKilled( DThread& aThread ); |
|
80 void EMHandleChunkAdd( DChunk& aChunk ); |
|
81 void EMHandleChunkDeleted( DChunk& aChunk ); |
|
82 |
|
83 private: // Internal methods |
|
84 void ResetPendingChanges(); |
|
85 void CompleteClientsRequest( TInt aCompletionCode, TUint aContext = 0 ); |
|
86 |
|
87 private: // Internal objects |
|
88 |
|
89 class TChange |
|
90 { |
|
91 public: |
|
92 inline TChange( TInt aCompletionCode, TUint aContext ) |
|
93 : iCompletionCode( aCompletionCode ), iContext( aContext ) |
|
94 { |
|
95 } |
|
96 |
|
97 public: // Data members |
|
98 TInt iCompletionCode; |
|
99 TUint iContext; |
|
100 SDblQueLink iLink; |
|
101 }; |
|
102 |
|
103 private: |
|
104 DMemSpyDriverDevice& iDevice; |
|
105 DMutex* iLock; |
|
106 const TUint iHandle; |
|
107 SDblQue iPendingChanges; |
|
108 |
|
109 // Transient: client-originated |
|
110 DThread* iClientThread; |
|
111 TRequestStatus* iClientRS; |
|
112 TAny* iClientContext; |
|
113 |
|
114 public: |
|
115 SDblQueLink iLink; |
|
116 }; |
|
117 |
|
118 |
|
119 #endif |
|