crashanalysercmd/PerfToolsSharedLibraries/Engine/SymbianSymbolLib/DbgEnginePlugin/SymbolPlugin.cs
changeset 0 818e61de6cd1
equal deleted inserted replaced
-1:000000000000 0:818e61de6cd1
       
     1 /*
       
     2 * Copyright (c) 2004-2008 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 
       
    18 using System.Collections.Generic;
       
    19 using SymbianDebugLib.Engine;
       
    20 using SymbianDebugLib.PluginAPI;
       
    21 using SymbianDebugLib.PluginAPI.Types.Symbol;
       
    22 using SymbianSymbolLib.SourceManagement.Provisioning;
       
    23 using SymbianSymbolLib.SourceManagement.Source;
       
    24 
       
    25 namespace SymbianSymbolLib.DbgEnginePlugin
       
    26 {
       
    27     internal class SymbolPlugin : DbgEngineSymbol
       
    28     {
       
    29         #region Constructors
       
    30         public SymbolPlugin( DbgEngine aEngine )
       
    31             : base( aEngine )
       
    32         {
       
    33             iSourceManager = new SymSourceManager( this );
       
    34             iProvisioningManager = new SymSourceProviderManager( this, aEngine.IdAllocator );
       
    35 		}
       
    36 		#endregion
       
    37 
       
    38         #region From DbgSymbolEngine
       
    39         public override bool IsReady
       
    40         {
       
    41             get { return true; }
       
    42         }
       
    43 
       
    44         public override string Name
       
    45         {
       
    46             get { return "DbgSymbolPlugin"; }
       
    47         }
       
    48 
       
    49         public override bool IsSupported( string aFileName, out string aType )
       
    50         {
       
    51             SymSourceProvider provider = iProvisioningManager.GetProvider( aFileName );
       
    52             //
       
    53             if ( provider != null )
       
    54             {
       
    55                 aType = provider.Name;
       
    56             }
       
    57             else
       
    58             {
       
    59                 aType = string.Empty;
       
    60             }
       
    61             //
       
    62             return provider != null;
       
    63         }
       
    64 
       
    65         public override DbgPluginPrimer CreatePrimer()
       
    66         {
       
    67             return new SymbolPrimer( this );
       
    68         }
       
    69 
       
    70         protected override DbgPluginView DoCreateView( string aName )
       
    71         {
       
    72             SymbolView ret = new SymbolView( aName, this );
       
    73             return ret;
       
    74         }
       
    75         
       
    76         protected override void DoClear()
       
    77         {
       
    78             if ( iSourceManager != null )
       
    79             {
       
    80                 iSourceManager.Dispose();
       
    81             }
       
    82             iSourceManager = new SymSourceManager( this );
       
    83         }
       
    84         #endregion
       
    85 
       
    86 		#region API
       
    87         internal void StoreSourcesThatWillBePrimed( IEnumerable<SymSource> aSourcesThatWillBePrimed )
       
    88         {
       
    89             SourceManager.AddRange( aSourcesThatWillBePrimed );
       
    90         }
       
    91         #endregion
       
    92 
       
    93 		#region Properties
       
    94         internal SymSourceManager SourceManager
       
    95         {
       
    96             get { return iSourceManager; }
       
    97         }
       
    98 
       
    99         internal SymSourceProviderManager ProvisioningManager
       
   100         {
       
   101             get { return iProvisioningManager; }
       
   102         }
       
   103         #endregion
       
   104 
       
   105         #region Internal methods
       
   106         #endregion
       
   107 
       
   108         #region From DisposableObject
       
   109         protected override void CleanupManagedResources()
       
   110         {
       
   111             try
       
   112             {
       
   113                 base.CleanupManagedResources();
       
   114             }
       
   115             finally
       
   116             {
       
   117                 iProvisioningManager.Dispose();
       
   118                 iSourceManager.Dispose();
       
   119             }
       
   120         }
       
   121         #endregion
       
   122 
       
   123         #region Data members
       
   124         private SymSourceManager iSourceManager;
       
   125         private readonly SymSourceProviderManager iProvisioningManager;
       
   126         #endregion
       
   127     }
       
   128 }