77
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 |
#include <e32property.h>
|
|
18 |
#include "ut_oomplugin.h"
|
|
19 |
|
|
20 |
const TUid KMyAppUid = { 0x20033981 }; // a nonsense UID for testing
|
|
21 |
|
|
22 |
CUtOomMonitorPlugin::CUtOomMonitorPlugin()
|
|
23 |
{
|
|
24 |
RDebug::Print(_L("CUtOomMonitorPlugin::COomMonitorTestPlugin"));
|
|
25 |
}
|
|
26 |
|
|
27 |
CUtOomMonitorPlugin::~CUtOomMonitorPlugin()
|
|
28 |
{
|
|
29 |
RDebug::Print(_L("CUtOomMonitorPlugin::~COomMonitorTestPlugin"));
|
|
30 |
}
|
|
31 |
|
|
32 |
void CUtOomMonitorPlugin::ConstructL()
|
|
33 |
{
|
|
34 |
COomMonitorPlugin::ConstructL();
|
|
35 |
RDebug::Print(_L("CUtOomMonitorPlugin::ConstructL"));
|
|
36 |
}
|
|
37 |
void CUtOomMonitorPlugin::FreeRam()
|
|
38 |
{
|
|
39 |
RDebug::Print(_L("CUtOomMonitorPlugin::FreeRam"));
|
|
40 |
}
|
|
41 |
|
|
42 |
void CUtOomMonitorPlugin::MemoryGood()
|
|
43 |
{
|
|
44 |
TInt err;
|
|
45 |
TAny * pointer = NULL;
|
|
46 |
RDebug::Print(_L("CUtOomMonitorPlugin::MemoryGood"));
|
|
47 |
ExtensionInterface(KMyAppUid,pointer);
|
|
48 |
COomMonitorPlugin::FsSession();
|
|
49 |
RProperty oomProperty;
|
|
50 |
err = oomProperty.Attach(KUtOomWatcherTestProperty, KUtOomPluginWatcherTestKey, EOwnerThread);
|
|
51 |
if(!err)
|
|
52 |
{
|
|
53 |
oomProperty.Set(KUtOomPluginMemGood);
|
|
54 |
}
|
|
55 |
oomProperty.Close();
|
|
56 |
}
|
|
57 |
|
|
58 |
void CUtOomMonitorPlugin::ExtensionInterface(TUid aInterfaceId,
|
|
59 |
TAny*& aImplementaion)
|
|
60 |
{
|
|
61 |
RDebug::Print(_L("CUtOomMonitorPlugin::ExtensionInterface(%08x, %08x)"),
|
|
62 |
aInterfaceId.iUid, aImplementaion);
|
|
63 |
COomMonitorPlugin::ExtensionInterface(aInterfaceId, aImplementaion);
|
|
64 |
}
|
|
65 |
|
|
66 |
TAny* CreateFullPluginL()
|
|
67 |
{
|
|
68 |
CUtOomMonitorPlugin* plugin = new (ELeave) CUtOomMonitorPlugin;
|
|
69 |
CleanupStack::PushL(plugin);
|
|
70 |
plugin->ConstructL();
|
|
71 |
CleanupStack::Pop(plugin);
|
|
72 |
plugin->FreeRam();
|
|
73 |
plugin->MemoryGood();
|
|
74 |
return plugin;
|
|
75 |
}
|
|
76 |
|
|
77 |
TAny* CreateAppPluginL()
|
|
78 |
{
|
|
79 |
return CAppOomMonitorPlugin::NewL(KMyAppUid);
|
|
80 |
}
|
|
81 |
|
|
82 |
//
|
|
83 |
// The ECom registration code
|
|
84 |
//
|
|
85 |
|
|
86 |
const TImplementationProxy ImplementationTable[] =
|
|
87 |
{
|
|
88 |
{{0x2003397f}, ::CreateFullPluginL},
|
|
89 |
{{0x20033980}, ::CreateAppPluginL}
|
|
90 |
};
|
|
91 |
|
|
92 |
EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
|
|
93 |
TInt& aTableCount)
|
|
94 |
{
|
|
95 |
aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);
|
|
96 |
return ImplementationTable;
|
|
97 |
}
|