|
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 #include "enginewrapper.h" |
|
19 #include <QMessageBox> |
|
20 |
|
21 EngineWrapper::~EngineWrapper() |
|
22 { |
|
23 mSession.Close(); |
|
24 } |
|
25 |
|
26 bool EngineWrapper::initialize() |
|
27 { |
|
28 return mSession.Connect() == KErrNone; |
|
29 } |
|
30 |
|
31 QList<MemSpyProcess*> EngineWrapper::getProcesses() |
|
32 { |
|
33 QList<MemSpyProcess*> result; |
|
34 |
|
35 RArray<CMemSpyApiProcess*> proc; |
|
36 TRAPD(error, mSession.GetProcessesL(proc)); |
|
37 if (error == KErrNone) |
|
38 for(TInt i=0; i<proc.Count(); i++) |
|
39 result.append(new MemSpyProcess(proc[i])); |
|
40 |
|
41 return result; |
|
42 } |
|
43 |
|
44 QList<MemSpyThread*> EngineWrapper::getThreads(ProcessId processId) |
|
45 { |
|
46 QList<MemSpyThread*> result; |
|
47 |
|
48 RArray<CMemSpyApiThread*> proc; |
|
49 TRAPD(error, mSession.GetThreadsL(processId, proc)); |
|
50 if (error == KErrNone) |
|
51 for(TInt i=0; i<proc.Count(); i++) |
|
52 result.append(new MemSpyThread(proc[i])); |
|
53 |
|
54 return result; |
|
55 } |
|
56 |
|
57 void EngineWrapper::setThreadPriority(ThreadId threadId, ThreadPriority priority) |
|
58 { |
|
59 TRAPD(error, mSession.SetThreadPriorityL(threadId, priority)); |
|
60 } |
|
61 |
|
62 QList<MemSpyKernelObjectType*> EngineWrapper::getKernelObjectTypes() |
|
63 { |
|
64 QList<MemSpyKernelObjectType*> result; |
|
65 |
|
66 RArray<CMemSpyApiKernelObject*> types; |
|
67 TInt error = mSession.GetKernelObjects(types); |
|
68 if (error == KErrNone) |
|
69 for(TInt i=0; i<types.Count(); i++) |
|
70 result.append(new MemSpyKernelObjectType(types[i])); |
|
71 |
|
72 return result; |
|
73 } |
|
74 |
|
75 QList<MemSpyKernelObject*> EngineWrapper::getKernelObjects(int type) |
|
76 { |
|
77 QList<MemSpyKernelObject*> result; |
|
78 |
|
79 RArray<CMemSpyApiKernelObjectItem*> objects; |
|
80 TInt error = mSession.GetKernelObjectItems(objects, |
|
81 static_cast<TMemSpyDriverContainerType>(type)); |
|
82 if (error == KErrNone) |
|
83 for(TInt i=0; i<objects.Count(); i++) |
|
84 result.append(new MemSpyKernelObject(objects[i])); |
|
85 |
|
86 return result; |
|
87 } |