uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.h
changeset 0 15bf7259bb7c
child 3 d8a3531bc6b8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.h	Tue Feb 02 07:56:43 2010 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Classes for executing GOOM actions (e.g. closing applications and running plugins).
+*
+*/
+
+
+#ifndef GOOMRUNPLUGIN_H_
+#define GOOMRUNPLUGIN_H_
+
+#include "goomaction.h"
+
+class CGOomRunPlugin;
+class CGOomRunPluginConfig;
+class MGOomActionObserver;
+class CGOomPluginWaiter;
+class CGOomMonitorPlugin;
+class CGOomMonitorPluginV2;
+class CGOomActionConfig;
+
+/*
+ * The GOOM action of running an GOOM plug-in to free up memory.
+ * 
+ *  @lib oommonitor.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS(CGOomRunPlugin) : public CGOomAction
+    {
+public:
+    static CGOomRunPlugin* NewL(TUint aPluginId, CGOomRunPluginConfig& aConfig, MGOomActionObserver& aStateChangeObserver, CGOomMonitorPlugin& aPlugin);
+
+    ~CGOomRunPlugin();   
+    
+    // Run the GOOM plugin in order to free memory
+    // Call the CGOomAction::MemoryFreed when it is done
+    virtual void FreeMemory(TInt aBytesRequested);
+    
+    // Call the memory good function on the plugin but...
+    // only if there is an outstanding FreeMemory request
+    void MemoryGood();
+        
+    inline TBool IsRunning();
+    
+    // To be called by the CGOomPluginWaiter
+    inline void WaitCompleted();
+    
+protected:
+    
+    void ConstructL(CGOomRunPluginConfig& aPluginConfig);    
+    
+    inline CGOomActionConfig& GetConfig();   
+    
+private:
+    
+    CGOomRunPlugin(TUint aPluginId, CGOomRunPluginConfig& aConfig, MGOomActionObserver& aStateChangeObserver, CGOomMonitorPlugin& aPlugin);
+    
+    TUint iPluginId;
+    
+    CGOomMonitorPlugin& iPlugin;
+    
+    CGOomRunPluginConfig& iConfig;
+    
+    CGOomPluginWaiter* iPluginWaiter;
+    
+    TBool iFreeMemoryCalled; // True if FreeMemory has been called since the last call to MemoryGood
+    };
+
+#include "goomrunplugin.inl"
+
+#endif /*GOOMRUNPLUGIN_H_*/