16 |
16 |
17 // |
17 // |
18 // CBtraceAppResponse |
18 // CBtraceAppResponse |
19 // |
19 // |
20 |
20 |
21 EXPORT_C CBtraceAppResponse* CBtraceAppResponse::NewL(CBtraceReader& aReader) |
21 EXPORT_C CBtraceAppResponse* CBtraceAppResponse::NewL(CBtraceReader& aReader, CBtraceContext& aContext) |
22 { |
22 { |
23 CBtraceAppResponse* self = new (ELeave) CBtraceAppResponse(aReader); |
23 CBtraceAppResponse* self = new (ELeave) CBtraceAppResponse(aReader, aContext); |
24 CleanupStack::PushL(self); |
24 CleanupStack::PushL(self); |
25 self->ConstructL(); |
25 self->ConstructL(); |
26 CleanupStack::Pop(self); |
26 CleanupStack::Pop(self); |
27 return self; |
27 return self; |
28 } |
28 } |
29 |
29 |
30 CBtraceAppResponse::CBtraceAppResponse(CBtraceReader& aReader) |
30 CBtraceAppResponse::CBtraceAppResponse(CBtraceReader& aReader, CBtraceContext& aContext) |
31 : iReader(aReader) |
31 : iReader(aReader), iContext(aContext) |
32 { |
32 { |
33 } |
33 } |
34 |
34 |
35 EXPORT_C CBtraceAppResponse::~CBtraceAppResponse() |
35 EXPORT_C CBtraceAppResponse::~CBtraceAppResponse() |
36 { |
36 { |
51 { |
51 { |
52 case EAmTraceSubCategoryEvCapture: |
52 case EAmTraceSubCategoryEvCapture: |
53 { |
53 { |
54 const TUint32* data = reinterpret_cast<const TUint32*>(aFrame.iData.Ptr()); |
54 const TUint32* data = reinterpret_cast<const TUint32*>(aFrame.iData.Ptr()); |
55 const TAmTraceEventEvCapture event = static_cast<TAmTraceEventEvCapture>(*data++); |
55 const TAmTraceEventEvCapture event = static_cast<TAmTraceEventEvCapture>(*data++); |
56 const TUint32 processIdLowWord = *data++; |
|
57 const TUint32 processIdHighWord = *data++; |
|
58 |
56 |
59 switch (event) |
57 switch (event) |
60 { |
58 { |
61 case EAmTraceEventEvCaptureSystemAppResponse: |
59 case EAmTraceEventEvCaptureAppResponse: |
62 { |
60 { |
63 SeenAppResponseL(aFrame.iTickCount, MAKE_TUINT64(processIdHighWord, processIdLowWord)); |
61 const TInt32 wgId = *data++; |
|
62 SeenAppResponseL(aFrame.iTickCount, wgId); |
64 } |
63 } |
65 break; |
64 break; |
66 |
65 |
67 default: |
66 default: |
68 // ignore the event |
67 // ignore the event |
75 // ignore anything we don't know about. |
74 // ignore anything we don't know about. |
76 break; |
75 break; |
77 }; |
76 }; |
78 } |
77 } |
79 |
78 |
80 void CBtraceAppResponse::SeenAppResponseL(const TBtraceTickCount& aTickCount, const TProcessId& aProcessId) |
79 void CBtraceAppResponse::SeenAppResponseL(const TBtraceTickCount& aTickCount, TInt aWindowGroupId) |
81 { |
80 { |
82 TInt ii = iNotifs.Count(); |
81 const TBtraceWindowGroupId* btraceWgId = iContext.FindWindowGroup(aWindowGroupId); |
83 while (--ii >= 0) |
82 if (btraceWgId) |
84 { |
83 { |
85 TAppResponseNotif& nt = iNotifs[ii]; |
84 TInt ii = iNotifs.Count(); |
86 if (nt.iProcessId == aProcessId) |
85 while (--ii >= 0) |
87 { |
86 { |
88 MBtraceAppResponseObserver& observer = nt.iObserver; |
87 TAppResponseNotif& nt = iNotifs[ii]; |
89 if (nt.iPersistence == ENotificationOneShot) |
88 if (iContext.WindowGroupName(*btraceWgId).MatchF(nt.iWindowGroupNamePattern) != KErrNotFound) |
90 { |
89 { |
91 iNotifs.Remove(ii); |
90 MBtraceAppResponseObserver& observer = nt.iObserver; |
|
91 if (nt.iPersistence == ENotificationOneShot) |
|
92 { |
|
93 iNotifs.Remove(ii); |
|
94 } |
|
95 observer.HandleAppResponseSeenL(aTickCount); |
92 } |
96 } |
93 observer.HandleAppResponseSeenL(aTickCount); |
|
94 } |
97 } |
95 } |
98 } |
96 } |
99 } |
97 |
100 |
98 EXPORT_C void CBtraceAppResponse::NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId) |
101 EXPORT_C void CBtraceAppResponse::NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TDesC& aWindowGroupNamePattern) |
99 { |
102 { |
100 NotifyAppResponseL(aObserver, aProcessId, ENotificationOneShot); |
103 NotifyAppResponseL(aObserver, aWindowGroupNamePattern, ENotificationOneShot); |
101 } |
104 } |
102 |
105 |
103 EXPORT_C void CBtraceAppResponse::NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId, TBtraceNotificationPersistence aPersistence) |
106 EXPORT_C void CBtraceAppResponse::NotifyAppResponseL(MBtraceAppResponseObserver& aObserver, const TDesC& aWindowGroupNamePattern, TBtraceNotificationPersistence aPersistence) |
104 { |
107 { |
105 TAppResponseNotif notify(aObserver, aProcessId, aPersistence); |
108 TAppResponseNotif notify(aObserver, aWindowGroupNamePattern, aPersistence); |
106 User::LeaveIfError(iNotifs.Append(notify)); |
109 User::LeaveIfError(iNotifs.Append(notify)); |
107 } |
110 } |
108 |
111 |
109 EXPORT_C void CBtraceAppResponse::CancelNotifyAppResponse(MBtraceAppResponseObserver& aObserver) |
112 EXPORT_C void CBtraceAppResponse::CancelNotifyAppResponse(MBtraceAppResponseObserver& aObserver) |
110 { |
113 { |
120 |
123 |
121 // |
124 // |
122 // CBtraceAppResponse::TAppResponseNotif |
125 // CBtraceAppResponse::TAppResponseNotif |
123 // |
126 // |
124 |
127 |
125 CBtraceAppResponse::TAppResponseNotif::TAppResponseNotif(MBtraceAppResponseObserver& aObserver, const TProcessId& aProcessId, TBtraceNotificationPersistence aPersistence) |
128 CBtraceAppResponse::TAppResponseNotif::TAppResponseNotif(MBtraceAppResponseObserver& aObserver, const TDesC& aWindowGroupNamePattern, TBtraceNotificationPersistence aPersistence) |
126 : iObserver(aObserver), iProcessId(aProcessId), iPersistence(aPersistence) |
129 : iObserver(aObserver), iWindowGroupNamePattern(aWindowGroupNamePattern), iPersistence(aPersistence) |
127 { |
130 { |
128 } |
131 } |