crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianDebugLib/Engine/DbgPluginManager.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2009 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 using System;
       
    18 using System.Collections.Generic;
       
    19 using System.Text;
       
    20 using SymbianUtils;
       
    21 using SymbianDebugLib.Engine;
       
    22 using SymbianDebugLib.PluginAPI.Types;
       
    23 using SymbianDebugLib.PluginAPI.Types.Code;
       
    24 using SymbianDebugLib.PluginAPI.Types.Trace;
       
    25 using SymbianDebugLib.PluginAPI.Types.Symbol;
       
    26 using SymbianDebugLib.PluginAPI.Types.KeyBindings;
       
    27 using SymbianDebugLib.PluginAPI.Types.MetaDataConfig;
       
    28 
       
    29 namespace SymbianDebugLib.Engine
       
    30 {
       
    31     internal class DbgPluginManager : DisposableObject
       
    32     {
       
    33         #region Constructors
       
    34         public DbgPluginManager( DbgEngine aEngine )
       
    35         {
       
    36             iEngine = aEngine;
       
    37             //
       
    38             FindImplementations();
       
    39         }
       
    40         #endregion
       
    41 
       
    42         #region API
       
    43         #endregion
       
    44 
       
    45         #region Properties
       
    46         public DbgEngineCode Code
       
    47         {
       
    48             get { return iCode; }
       
    49         }
       
    50 
       
    51         public DbgEngineSymbol Symbols
       
    52         {
       
    53             get { return iSymbols; } 
       
    54         }
       
    55 
       
    56         public DbgEngineKeyBindings KeyBindings
       
    57         {
       
    58             get { return iKeyBindings; }
       
    59         }
       
    60 
       
    61         public DbgEngineTrace TraceDictionaries
       
    62         {
       
    63             get { return iTraceDictionaries; }
       
    64         }
       
    65 
       
    66         public DbgEngineMetaDataConfig MetaDataConfig
       
    67         {
       
    68             get { return iMetaDataConfig; }
       
    69         }
       
    70         #endregion
       
    71 
       
    72         #region Internal methods
       
    73         private void FindImplementations()
       
    74         {
       
    75             FindImplementationCode();
       
    76             FindImplementationTraces();
       
    77             FindImplementationSymbols();
       
    78             FindImplementationKeyBindings();
       
    79             FindImplementationMetaDataConfig();
       
    80         }
       
    81 
       
    82         private void FindImplementationSymbols()
       
    83         {
       
    84             iSymbols = DbgEngineSymbol.New( iEngine );
       
    85             System.Diagnostics.Debug.Assert( iSymbols != null );
       
    86         }
       
    87 
       
    88         private void FindImplementationCode()
       
    89         {
       
    90             iCode = DbgEngineCode.New( iEngine );
       
    91             System.Diagnostics.Debug.Assert( iCode != null );
       
    92         }
       
    93 
       
    94         private void FindImplementationTraces()
       
    95         {
       
    96             iTraceDictionaries = DbgEngineTrace.New( iEngine );
       
    97             System.Diagnostics.Debug.Assert( iTraceDictionaries != null );
       
    98         }
       
    99 
       
   100         private void FindImplementationMetaDataConfig()
       
   101         {
       
   102             iMetaDataConfig = DbgEngineMetaDataConfig.New( iEngine );
       
   103             System.Diagnostics.Debug.Assert( iMetaDataConfig != null );
       
   104         }
       
   105 
       
   106         private void FindImplementationKeyBindings()
       
   107         {
       
   108             iKeyBindings = DbgEngineKeyBindings.New( iEngine );
       
   109             System.Diagnostics.Debug.Assert( iKeyBindings != null );
       
   110         }
       
   111         #endregion
       
   112 
       
   113         #region From DisposableObject
       
   114         protected override void CleanupManagedResources()
       
   115         {
       
   116             try
       
   117             {
       
   118                 base.CleanupManagedResources();
       
   119             }
       
   120             finally
       
   121             {
       
   122                 if ( iSymbols != null )
       
   123                 {
       
   124                     iSymbols.Dispose();
       
   125                     iSymbols = null;
       
   126                 }
       
   127                 if ( iCode != null )
       
   128                 {
       
   129                     iCode.Dispose();
       
   130                     iCode = null;
       
   131                 }
       
   132                 if ( iTraceDictionaries != null )
       
   133                 {
       
   134                     iTraceDictionaries.Dispose();
       
   135                     iTraceDictionaries = null;
       
   136                 }
       
   137                 if ( iKeyBindings != null )
       
   138                 {
       
   139                     iKeyBindings.Dispose();
       
   140                     iKeyBindings = null;
       
   141                 }
       
   142                 if ( iMetaDataConfig != null )
       
   143                 {
       
   144                     iMetaDataConfig.Dispose();
       
   145                     iMetaDataConfig = null;
       
   146                 }
       
   147             }
       
   148         }
       
   149         #endregion
       
   150 
       
   151         #region Data members
       
   152         private readonly DbgEngine iEngine;
       
   153         private DbgEngineCode iCode;
       
   154         private DbgEngineSymbol iSymbols;
       
   155         private DbgEngineTrace iTraceDictionaries;
       
   156         private DbgEngineKeyBindings iKeyBindings;
       
   157         private DbgEngineMetaDataConfig iMetaDataConfig;
       
   158         #endregion
       
   159     }
       
   160 }