fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp
changeset 187 9f66f99ee56f
equal deleted inserted replaced
103:2717213c588a 187:9f66f99ee56f
       
     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:  Graphics-Out-Of-Memory plugin for Font and Bitmap server.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <ecom/ecom.h>
       
    19 #include <ecom/implementationproxy.h>
       
    20 #include <graphics/fbsoogmmessage.h>
       
    21 #include <w32std.h>
       
    22 #include <FBS.H>
       
    23 
       
    24 #include "fbsoogmplugin.h"
       
    25 #include "OstTraceDefinitions.h"
       
    26 #ifdef OST_TRACE_COMPILER_IN_USE
       
    27 #include "fbsoogmpluginTraces.h"
       
    28 #endif
       
    29 
       
    30 
       
    31 /**
       
    32  Called by the GOoM monitor framework in the case of low GPU memory.
       
    33 
       
    34  Note: In the case of failure, this framework method will do so silently.
       
    35 
       
    36  @param aBytesToFree The amount of GPU memory to be freed.
       
    37  */
       
    38 void CFbsOogmMonitorPlugin::FreeRam( TInt aBytesToFree, TInt aFlags )
       
    39     {
       
    40     OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_FREERAM, "> " );
       
    41 
       
    42     if ( (NULL == RFbsSession::GetSession()) )
       
    43          {
       
    44          if ( KErrNone != RFbsSession::Connect() )
       
    45              {
       
    46              OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_FREERAM, "< No FbsSession" );
       
    47 
       
    48              return;
       
    49              }
       
    50 
       
    51          }
       
    52 
       
    53     TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmLowNotification, aBytesToFree, aFlags );
       
    54     (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
       
    55 
       
    56     OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_FREERAM, "< " );
       
    57     }
       
    58 
       
    59 
       
    60 
       
    61 /**
       
    62  Called by the GOoM monitor framework in the case of normal GPU memory-usage being permissible.
       
    63 
       
    64  Note: In the case of failure, this framework method will do so silently.
       
    65  */
       
    66 void CFbsOogmMonitorPlugin::MemoryGood( TInt aFlags )
       
    67     {
       
    68     OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_MEMORYGOOD, ">" );
       
    69 
       
    70     if ( (NULL == RFbsSession::GetSession()) )
       
    71          {
       
    72         if ( KErrNone != RFbsSession::Connect() )
       
    73             {
       
    74             OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "< No FbsSession" );
       
    75 
       
    76             return;
       
    77             }
       
    78 
       
    79          }
       
    80 
       
    81     const TInt KOogmDummyIntegerArgument = 0;
       
    82     TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmOkayNotification, KOogmDummyIntegerArgument, aFlags );
       
    83     (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
       
    84 
       
    85 	OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "<" );
       
    86     }
       
    87 
       
    88 
       
    89 
       
    90 /**
       
    91 
       
    92  */
       
    93 CFbsOogmMonitorPlugin::CFbsOogmMonitorPlugin()
       
    94     {
       
    95     }
       
    96 
       
    97 
       
    98 
       
    99 /**
       
   100 
       
   101  */
       
   102 CFbsOogmMonitorPlugin::~CFbsOogmMonitorPlugin()
       
   103     {
       
   104     RFbsSession::Disconnect();
       
   105     }
       
   106 
       
   107 
       
   108 
       
   109 /**
       
   110 
       
   111  */
       
   112 void CFbsOogmMonitorPlugin::ConstructL()
       
   113     {
       
   114     CGOomMonitorPluginBase::ConstructL();
       
   115     }
       
   116 
       
   117 
       
   118 
       
   119 /**
       
   120 
       
   121  */
       
   122 TAny* CreatePlugin()
       
   123     {
       
   124     CFbsOogmMonitorPlugin* self = new CFbsOogmMonitorPlugin;
       
   125     if ( self )
       
   126         {
       
   127         TRAPD( err, self->ConstructL() );
       
   128         if ( err != KErrNone )
       
   129             {
       
   130             delete self;
       
   131             self = NULL;
       
   132             }
       
   133         }
       
   134 
       
   135     return self;
       
   136     }
       
   137 
       
   138 
       
   139 
       
   140 /**
       
   141 
       
   142  */
       
   143 const TImplementationProxy ImplementationTable[] =
       
   144     {
       
   145     { {0x2002B638}, ::CreatePlugin }
       
   146     };
       
   147 
       
   148 
       
   149 
       
   150 /**
       
   151 
       
   152  */
       
   153 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   154     {
       
   155     OstTrace0( TRACE_NORMAL, _IMPLEMENTATIONGROUPPROXY, "> ::ImplementationGroupProxy" );
       
   156     
       
   157     aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ) ;
       
   158     return ImplementationTable;
       
   159     }
       
   160 
       
   161 
       
   162