Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: obsolete/Microsoft.VisualStudio.Project/Automation/AutomationScope.cs

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: obsolete/Microsoft.VisualStudio.Project/Automation/AutomationScope.cs
diff --git a/obsolete/Microsoft.VisualStudio.Project/Automation/AutomationScope.cs b/obsolete/Microsoft.VisualStudio.Project/Automation/AutomationScope.cs
deleted file mode 100644
index d400694752f8cfdc4977838fe43cd66fd1f56293..0000000000000000000000000000000000000000
--- a/obsolete/Microsoft.VisualStudio.Project/Automation/AutomationScope.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-/// Copyright (c) Microsoft Corporation. All rights reserved.
-
-using System;
-using Microsoft.VisualStudio.Shell.Interop;
-using ErrorHandler = Microsoft.VisualStudio.ErrorHandler;
-
-namespace Microsoft.VisualStudio.Project.Automation
-{
- /// <summary>
- /// Helper class that handle the scope of an automation function.
- /// It should be used inside a "using" directive to define the scope of the
- /// automation function and make sure that the ExitAutomation method is called.
- /// </summary>
- internal class AutomationScope : IDisposable
- {
- private IVsExtensibility3 extensibility;
- private bool inAutomation;
- private static volatile object Mutex;
- private bool isDisposed;
-
- /// <summary>
- /// Initializes the <see cref="AutomationScope"/> class.
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1810:InitializeReferenceTypeStaticFieldsInline")]
- static AutomationScope()
- {
- Mutex = new object();
- }
-
- /// <summary>
- /// Defines the beginning of the scope of an automation function. This constuctor
- /// calls EnterAutomationFunction to signal the Shell that the current function is
- /// changing the status of the automation objects.
- /// </summary>
- public AutomationScope(IServiceProvider provider)
- {
- if(null == provider)
- {
- throw new ArgumentNullException("provider");
- }
- extensibility = provider.GetService(typeof(EnvDTE.IVsExtensibility)) as IVsExtensibility3;
- if(null == extensibility)
- {
- throw new InvalidOperationException();
- }
- ErrorHandler.ThrowOnFailure(extensibility.EnterAutomationFunction());
- inAutomation = true;
- }
-
- /// <summary>
- /// Ends the scope of the automation function. This function is also called by the
- /// Dispose method.
- /// </summary>
- public void ExitAutomation()
- {
- if(inAutomation)
- {
- ErrorHandler.ThrowOnFailure(extensibility.ExitAutomationFunction());
- inAutomation = false;
- }
- }
-
- /// <summary>
- /// Gets the IVsExtensibility3 interface used in the automation function.
- /// </summary>
- public IVsExtensibility3 Extensibility
- {
- get { return extensibility; }
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- public void Dispose()
- {
- this.Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- #region IDisposable Members
- private void Dispose(bool disposing)
- {
- if(!this.isDisposed)
- {
- lock(Mutex)
- {
- if(disposing)
- {
- ExitAutomation();
- }
-
- this.isDisposed = true;
- }
- }
- }
- #endregion
- }
-}

Powered by Google App Engine
This is Rietveld 408576698