os/graphics/fbs/fontandbitmapserver/sfbs/fbsoogmplugin.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:  Graphics-Out-Of-Memory plugin for Font and Bitmap server.
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
#include <ecom/ecom.h>
sl@0
    19
#include <ecom/implementationproxy.h>
sl@0
    20
#include <graphics/fbsoogmmessage.h>
sl@0
    21
#include <w32std.h>
sl@0
    22
#include <FBS.H>
sl@0
    23
sl@0
    24
#include "fbsoogmplugin.h"
sl@0
    25
#include "OstTraceDefinitions.h"
sl@0
    26
#ifdef OST_TRACE_COMPILER_IN_USE
sl@0
    27
#include "fbsoogmpluginTraces.h"
sl@0
    28
#endif
sl@0
    29
sl@0
    30
sl@0
    31
/**
sl@0
    32
 Called by the GOoM monitor framework in the case of low GPU memory.
sl@0
    33
sl@0
    34
 Note: In the case of failure, this framework method will do so silently.
sl@0
    35
sl@0
    36
 @param aBytesToFree The amount of GPU memory to be freed.
sl@0
    37
 */
sl@0
    38
void CFbsOogmMonitorPlugin::FreeRam( TInt aBytesToFree, TInt aFlags )
sl@0
    39
    {
sl@0
    40
    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_FREERAM, "> " );
sl@0
    41
sl@0
    42
    if ( (NULL == RFbsSession::GetSession()) )
sl@0
    43
         {
sl@0
    44
         if ( KErrNone != RFbsSession::Connect() )
sl@0
    45
             {
sl@0
    46
             OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_FREERAM, "< No FbsSession" );
sl@0
    47
sl@0
    48
             return;
sl@0
    49
             }
sl@0
    50
sl@0
    51
         }
sl@0
    52
sl@0
    53
    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmLowNotification, aBytesToFree, aFlags );
sl@0
    54
    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
sl@0
    55
sl@0
    56
    OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_FREERAM, "< " );
sl@0
    57
    }
sl@0
    58
sl@0
    59
sl@0
    60
sl@0
    61
/**
sl@0
    62
 Called by the GOoM monitor framework in the case of normal GPU memory-usage being permissible.
sl@0
    63
sl@0
    64
 Note: In the case of failure, this framework method will do so silently.
sl@0
    65
 */
sl@0
    66
void CFbsOogmMonitorPlugin::MemoryGood( TInt aFlags )
sl@0
    67
    {
sl@0
    68
    OstTrace0( TRACE_NORMAL, CFBSOOGMMONITORPLUGIN_MEMORYGOOD, ">" );
sl@0
    69
sl@0
    70
    if ( (NULL == RFbsSession::GetSession()) )
sl@0
    71
         {
sl@0
    72
        if ( KErrNone != RFbsSession::Connect() )
sl@0
    73
            {
sl@0
    74
            OstTrace0( TRACE_NORMAL, DUP2_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "< No FbsSession" );
sl@0
    75
sl@0
    76
            return;
sl@0
    77
            }
sl@0
    78
sl@0
    79
         }
sl@0
    80
sl@0
    81
    const TInt KOogmDummyIntegerArgument = 0;
sl@0
    82
    TFbsOogmMessage oogmMessage( TFbsOogmMessage::EFbsOogmOkayNotification, KOogmDummyIntegerArgument, aFlags );
sl@0
    83
    (void)RFbsSession::GetSession()->ConveyOogmMessage( oogmMessage );
sl@0
    84
sl@0
    85
	OstTrace0( TRACE_NORMAL, DUP1_CFBSOOGMMONITORPLUGIN_MEMORYGOOD, "<" );
sl@0
    86
    }
sl@0
    87
sl@0
    88
sl@0
    89
sl@0
    90
/**
sl@0
    91
sl@0
    92
 */
sl@0
    93
CFbsOogmMonitorPlugin::CFbsOogmMonitorPlugin()
sl@0
    94
    {
sl@0
    95
    }
sl@0
    96
sl@0
    97
sl@0
    98
sl@0
    99
/**
sl@0
   100
sl@0
   101
 */
sl@0
   102
CFbsOogmMonitorPlugin::~CFbsOogmMonitorPlugin()
sl@0
   103
    {
sl@0
   104
    RFbsSession::Disconnect();
sl@0
   105
    }
sl@0
   106
sl@0
   107
sl@0
   108
sl@0
   109
/**
sl@0
   110
sl@0
   111
 */
sl@0
   112
void CFbsOogmMonitorPlugin::ConstructL()
sl@0
   113
    {
sl@0
   114
    CGOomMonitorPluginBase::ConstructL();
sl@0
   115
    }
sl@0
   116
sl@0
   117
sl@0
   118
sl@0
   119
/**
sl@0
   120
sl@0
   121
 */
sl@0
   122
TAny* CreatePlugin()
sl@0
   123
    {
sl@0
   124
    CFbsOogmMonitorPlugin* self = new CFbsOogmMonitorPlugin;
sl@0
   125
    if ( self )
sl@0
   126
        {
sl@0
   127
        TRAPD( err, self->ConstructL() );
sl@0
   128
        if ( err != KErrNone )
sl@0
   129
            {
sl@0
   130
            delete self;
sl@0
   131
            self = NULL;
sl@0
   132
            }
sl@0
   133
        }
sl@0
   134
sl@0
   135
    return self;
sl@0
   136
    }
sl@0
   137
sl@0
   138
sl@0
   139
sl@0
   140
/**
sl@0
   141
sl@0
   142
 */
sl@0
   143
const TImplementationProxy ImplementationTable[] =
sl@0
   144
    {
sl@0
   145
    { {0x2002B638}, ::CreatePlugin }
sl@0
   146
    };
sl@0
   147
sl@0
   148
sl@0
   149
sl@0
   150
/**
sl@0
   151
sl@0
   152
 */
sl@0
   153
EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
sl@0
   154
    {
sl@0
   155
    OstTrace0( TRACE_NORMAL, _IMPLEMENTATIONGROUPPROXY, "> ::ImplementationGroupProxy" );
sl@0
   156
    
sl@0
   157
    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy ) ;
sl@0
   158
    return ImplementationTable;
sl@0
   159
    }
sl@0
   160
sl@0
   161
sl@0
   162