os/graphics/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,162 @@
     1.4 +/*
     1.5 +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:  Graphics-Out-Of-Memory plugin for Font and Bitmap server.
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +#include <ecom/ecom.h>
    1.22 +#include <ecom/implementationproxy.h>
    1.23 +#include <graphics/fbsoogmmessage.h>
    1.24 +#include <w32std.h>
    1.25 +#include <FBS.H>
    1.26 +
    1.27 +#include "fbsoogmplugin.h"
    1.28 +#include "OstTraceDefinitions.h"
    1.29 +#ifdef OST_TRACE_COMPILER_IN_USE
    1.30 +#include "fbsoogmpluginTraces.h"
    1.31 +#endif
    1.32 +
    1.33 +
    1.34 +/**
    1.35 + Called by the GOoM monitor framework in the case of low GPU memory.
    1.36 +
    1.37 + Note: In the case of failure, this framework method will do so silently.
    1.38 +
    1.39 + @param aBytesToFree The amount of GPU memory to be freed.
    1.40 + */
    1.41 +void CFbsOogmMonitorPlugin::FreeRam( TInt aBytesToFree, TInt aFlags )
    1.42 +    {
    1.43 +    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_FREERAM, "> " );
    1.44 +
    1.45 +    if ( (NULL == RFbsSession::GetSession()) )
    1.46 +         {
    1.47 +         if ( KErrNone != RFbsSession::Connect() )
    1.48 +             {
    1.49 +             OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_FREERAM, "< No FbsSession" );
    1.50 +
    1.51 +             return;
    1.52 +             }
    1.53 +
    1.54 +         }
    1.55 +
    1.56 +    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmLowNotification, aBytesToFree, aFlags );
    1.57 +    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
    1.58 +
    1.59 +    OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_FREERAM, "< " );
    1.60 +    }
    1.61 +
    1.62 +
    1.63 +
    1.64 +/**
    1.65 + Called by the GOoM monitor framework in the case of normal GPU memory-usage being permissible.
    1.66 +
    1.67 + Note: In the case of failure, this framework method will do so silently.
    1.68 + */
    1.69 +void CFbsOogmMonitorPlugin::MemoryGood( TInt aFlags )
    1.70 +    {
    1.71 +    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_MEMORYGOOD, ">" );
    1.72 +
    1.73 +    if ( (NULL == RFbsSession::GetSession()) )
    1.74 +         {
    1.75 +        if ( KErrNone != RFbsSession::Connect() )
    1.76 +            {
    1.77 +            OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "< No FbsSession" );
    1.78 +
    1.79 +            return;
    1.80 +            }
    1.81 +
    1.82 +         }
    1.83 +
    1.84 +    const TInt KOogmDummyIntegerArgument = 0;
    1.85 +    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmOkayNotification, KOogmDummyIntegerArgument, aFlags );
    1.86 +    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
    1.87 +
    1.88 +	OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "<" );
    1.89 +    }
    1.90 +
    1.91 +
    1.92 +
    1.93 +/**
    1.94 +
    1.95 + */
    1.96 +CFbsOogmMonitorPlugin::CFbsOogmMonitorPlugin()
    1.97 +    {
    1.98 +    }
    1.99 +
   1.100 +
   1.101 +
   1.102 +/**
   1.103 +
   1.104 + */
   1.105 +CFbsOogmMonitorPlugin::~CFbsOogmMonitorPlugin()
   1.106 +    {
   1.107 +    RFbsSession::Disconnect();
   1.108 +    }
   1.109 +
   1.110 +
   1.111 +
   1.112 +/**
   1.113 +
   1.114 + */
   1.115 +void CFbsOogmMonitorPlugin::ConstructL()
   1.116 +    {
   1.117 +    CGOomMonitorPluginBase::ConstructL();
   1.118 +    }
   1.119 +
   1.120 +
   1.121 +
   1.122 +/**
   1.123 +
   1.124 + */
   1.125 +TAny* CreatePlugin()
   1.126 +    {
   1.127 +    CFbsOogmMonitorPlugin* self = new CFbsOogmMonitorPlugin;
   1.128 +    if ( self )
   1.129 +        {
   1.130 +        TRAPD( err, self->ConstructL() );
   1.131 +        if ( err != KErrNone )
   1.132 +            {
   1.133 +            delete self;
   1.134 +            self = NULL;
   1.135 +            }
   1.136 +        }
   1.137 +
   1.138 +    return self;
   1.139 +    }
   1.140 +
   1.141 +
   1.142 +
   1.143 +/**
   1.144 +
   1.145 + */
   1.146 +const TImplementationProxy ImplementationTable[] =
   1.147 +    {
   1.148 +    { {0x2002B638}, ::CreatePlugin }
   1.149 +    };
   1.150 +
   1.151 +
   1.152 +
   1.153 +/**
   1.154 +
   1.155 + */
   1.156 +EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
   1.157 +    {
   1.158 +    OstTrace0( TRACE_NORMAL, _IMPLEMENTATIONGROUPPROXY, "> ::ImplementationGroupProxy" );
   1.159 +    
   1.160 +    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ) ;
   1.161 +    return ImplementationTable;
   1.162 +    }
   1.163 +
   1.164 +
   1.165 +