diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2020-01-14 18:44:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-14 18:44:40 +0300 |
commit | f4d03c140c03f8999c1599b547f659c9644be931 (patch) | |
tree | fb3d3a45ea5a86fe1e8abe15165623a0c69e3042 | |
parent | 4145653a1ff4ad1de6eb7431c55bf168e1b4ec99 (diff) | |
parent | 49a0cd4b98a8283c3b05c1e89b8b4485d66aa89b (diff) |
Merge pull request #9458 from mono/jstedfast-obsolete-counter-inc-dec
[Core] Stop using obsolete Counter++/-- and use Inc(1) or Dec(1) instead
14 files changed, 36 insertions, 36 deletions
diff --git a/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs b/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs index 8fa40ae4cb..4965f364d5 100644 --- a/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs +++ b/main/src/addins/MonoDevelop.Autotools/CustomMakefile.cs @@ -262,7 +262,7 @@ namespace MonoDevelop.Autotools using (StreamWriter sw = new StreamWriter (fileName)) sw.Write (content); - UpdatedMakefiles++; + UpdatedMakefiles.Inc (1); } void ThrowMakefileVarNotFound (string var) diff --git a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs index 3bdfd4a8b1..fa9dba2031 100644 --- a/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs +++ b/main/src/addins/MonoDevelop.GtkCore/MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs @@ -71,7 +71,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder { this.fileName = fileName; this.project = project; - Counters.GuiProjectsLoaded++; + Counters.GuiProjectsLoaded.Inc (1); GuiBuilderService.NotifyGuiProjectLoaded (); } @@ -96,7 +96,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder hasError = true; } - Counters.SteticProjectsLoaded++; + Counters.SteticProjectsLoaded.Inc (1); gproject.ResourceProvider = GtkDesignInfo.FromProject (project).ResourceProvider; gproject.WidgetAdded += OnAddWidget; gproject.WidgetRemoved += OnRemoveWidget; @@ -125,8 +125,8 @@ namespace MonoDevelop.GtkCore.GuiBuilder if (gproject == null) return; - Counters.SteticProjectsLoaded--; - + Counters.SteticProjectsLoaded.Dec (1); + if (Unloaded != null) Unloaded (this, EventArgs.Empty); if (formInfos != null) { @@ -252,7 +252,7 @@ namespace MonoDevelop.GtkCore.GuiBuilder if (disposed) return; GuiBuilderService.NotifyGuiProjectUnloaded (); - Counters.GuiProjectsLoaded--; + Counters.GuiProjectsLoaded.Dec (1); disposed = true; if (watcher != null) watcher.Dispose (); diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs index 365927bafe..713146e524 100644 --- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs +++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs @@ -195,7 +195,7 @@ namespace MonoDevelop.SourceEditor private SourceEditorView (DocumentAndLoaded doc)
{
- Counters.LoadedEditors++; + Counters.LoadedEditors.Inc (1); breakpoints = DebuggingService.Breakpoints; widget = new SourceEditorWidget (this, doc.Document);
@@ -1056,7 +1056,7 @@ namespace MonoDevelop.SourceEditor StoreSettings (); - Counters.LoadedEditors--; + Counters.LoadedEditors.Dec (1); /* if (messageBubbleHighlightPopupWindow != null) messageBubbleHighlightPopupWindow.Destroy ();*/ diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessHostController.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessHostController.cs index 536d9c3dd4..5b6df84f51 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessHostController.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessHostController.cs @@ -131,7 +131,7 @@ namespace MonoDevelop.Core.Execution cmd.DebugMode = isDebugMode; OperationConsole cons = console ?? new ProcessHostConsole (); var p = process = executionHandlerFactory.Execute (cmd, cons); - Counters.ExternalHostProcesses++; + Counters.ExternalHostProcesses.Inc (1); process.Task.ContinueWith ((t) => ProcessExited (p)); @@ -159,8 +159,8 @@ namespace MonoDevelop.Core.Execution { lock (this) { - Counters.ExternalHostProcesses--; - + Counters.ExternalHostProcesses.Dec (1); + // Remove all callbacks from existing objects foreach (object ob in remoteObjects) RemotingService.UnregisterMethodCallback (ob, "Dispose"); @@ -204,7 +204,7 @@ namespace MonoDevelop.Core.Execution RemotingService.RegisterMethodCallback (obj, "Dispose", RemoteProcessObjectDisposing, null); RemotingService.RegisterMethodCallback (obj, "Shutdown", RemoteProcessObjectShuttingDown, null); remoteObjects.Add (obj); - Counters.ExternalObjects++; + Counters.ExternalObjects.Inc (1); return obj; } catch { ReleaseInstance (null); @@ -234,7 +234,7 @@ namespace MonoDevelop.Core.Execution RemotingService.RegisterMethodCallback (obj, "Dispose", RemoteProcessObjectDisposing, null); RemotingService.RegisterMethodCallback (obj, "Shutdown", RemoteProcessObjectShuttingDown, null); remoteObjects.Add (obj); - Counters.ExternalObjects++; + Counters.ExternalObjects.Inc (1); return obj; } catch { ReleaseInstance (null); @@ -272,7 +272,7 @@ namespace MonoDevelop.Core.Execution public void ReleaseInstance (object proc, int shutdownTimeout) { - Counters.ExternalObjects--; + Counters.ExternalObjects.Dec (1); if (processHost == null) return; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs index ca6db5972a..6e39a2368d 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs @@ -156,7 +156,7 @@ namespace MonoDevelop.Core.Execution // p.Exited += exited; // p.EnableRaisingEvents = true; - Counters.ProcessesStarted++; + Counters.ProcessesStarted.Inc (1); p.Start (); if (exited != null) @@ -212,7 +212,7 @@ namespace MonoDevelop.Core.Execution if (p != null) { if (exited != null) p.Task.ContinueWith (t => exited (p, EventArgs.Empty), Runtime.MainTaskScheduler); - Counters.ProcessesStarted++; + Counters.ProcessesStarted.Inc (1); return p; } else { LoggingService.LogError ("Could not create external console for command: " + command + " " + arguments); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs index 4158d36ccf..4aca642c0a 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs @@ -805,9 +805,9 @@ namespace MonoDevelop.Core { foreach (FileEventInfo fi in args) { if (fi.IsDirectory) - Counters.DirectoriesCreated++; + Counters.DirectoriesCreated.Inc (1); else - Counters.FilesCreated++; + Counters.FilesCreated.Inc (1); } eventQueue.RaiseEvent (EventDataKind.Created, args); @@ -830,9 +830,9 @@ namespace MonoDevelop.Core { foreach (FileEventInfo fi in args) { if (fi.IsDirectory) - Counters.DirectoriesRenamed++; + Counters.DirectoriesRenamed.Inc (1); else - Counters.FilesRenamed++; + Counters.FilesRenamed.Inc (1); } eventQueue.RaiseEvent (EventDataKind.Renamed, args); @@ -843,9 +843,9 @@ namespace MonoDevelop.Core { foreach (FileEventInfo fi in args) { if (fi.IsDirectory) - Counters.DirectoriesRemoved++; + Counters.DirectoriesRemoved.Inc (1); else - Counters.FilesRemoved++; + Counters.FilesRemoved.Inc (1); } eventQueue.RaiseEvent (EventDataKind.Removed, args); @@ -854,7 +854,7 @@ namespace MonoDevelop.Core public static event EventHandler<FileEventArgs> FileChanged; static void OnFileChanged (FileEventArgs args) { - Counters.FileChangeNotifications++; + Counters.FileChangeNotifications.Inc (1); eventQueue.RaiseEvent (EventDataKind.Changed, args); } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs index 4e87f0af31..4947097439 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/Solution.cs @@ -80,7 +80,7 @@ namespace MonoDevelop.Projects internal Solution (bool loading) { loadingFromConstructor = loading; - Counters.SolutionsLoaded++; + Counters.SolutionsLoaded.Inc (1); configurations = new SolutionConfigurationCollection (this); runConfigurations = new MultiItemSolutionRunConfigurationCollection (this); format = MSBuildFileFormat.DefaultFormat; @@ -592,7 +592,7 @@ namespace MonoDevelop.Projects // Dispose the root folder after we dispose the base item, as we need the root folder // to contain the items when unregistering from the file watcher service. RootFolder.Dispose (); - Counters.SolutionsLoaded--; + Counters.SolutionsLoaded.Dec (1); } internal bool IsSolutionItemEnabled (string solutionItemPath) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs index d3296fdee1..fcbc1dd7a7 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/SolutionItem.cs @@ -85,7 +85,7 @@ namespace MonoDevelop.Projects configurations = new SolutionItemConfigurationCollection (this); configurations.ConfigurationAdded += OnConfigurationAddedToCollection; configurations.ConfigurationRemoved += OnConfigurationRemovedFromCollection; - Counters.ItemsLoaded++; + Counters.ItemsLoaded.Inc (1); fileStatusTracker = new FileStatusTracker<SolutionItemEventArgs> (this, OnReloadRequired, new SolutionItemEventArgs (this)); } @@ -123,7 +123,7 @@ namespace MonoDevelop.Projects fileStatusTracker.Dispose (); base.OnDispose (); - Counters.ItemsLoaded--; + Counters.ItemsLoaded.Dec (1); // items = null; // wildcardItems = null; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs index ff00434baf..b773ca4a4e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs @@ -60,7 +60,7 @@ namespace MonoDevelop.Ide.BuildOutputView { this.buildOutput = buildOutput; DocumentTitle = $"{GettextCatalog.GetString ("Build Output")} {DateTime.Now.ToString ("h:mm tt yyyy-MM-dd")}.binlog"; - Counters.OpenedFromIDE++; + Counters.OpenedFromIDE.Inc (1); } protected override async Task OnInitialize (ModelDescriptor modelDescriptor, Properties status) @@ -70,7 +70,7 @@ namespace MonoDevelop.Ide.BuildOutputView if (modelDescriptor is FileDescriptor file) { FilePath = file.FilePath; loadedFromFile = true; - Counters.OpenedFromFile++; + Counters.OpenedFromFile.Inc (1); } } @@ -206,7 +206,7 @@ namespace MonoDevelop.Ide.BuildOutputView [CommandHandler (FileCommands.Save)] protected override Task OnSave () { - Counters.SavedToFile++; + Counters.SavedToFile.Inc (1); return control.SaveAs (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs index 27a2ee4598..77a8ba0e26 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs @@ -135,7 +135,7 @@ namespace MonoDevelop.Ide.Codons protected virtual PadContent CreatePad () { - Counters.PadsLoaded++; + Counters.PadsLoaded.Inc (1); return (PadContent) Addin.CreateInstance (ClassName, true); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs index 5d5adc3915..6000fa4153 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs @@ -111,7 +111,7 @@ namespace MonoDevelop.Ide.Editor if (File.Exists (autosaveFileName)) File.Delete (autosaveFileName); content.WriteTextTo (autosaveFileName); - Counters.AutoSavedFiles++; + Counters.AutoSavedFiles.Inc (1); } catch (Exception e) { LoggingService.LogError ("Error in auto save while creating: " + fileName +". Disableing auto save.", e); DisableAutoSave (); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs index c826300f8a..aac3a29b8f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs @@ -1041,7 +1041,7 @@ namespace MonoDevelop.Ide.Gui.Pads SetInitialOutputViewSize (control.Allocation.Width); if (visible) { - Counters.BuildLogShown++; + Counters.BuildLogShown.Inc (1); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs index 4dad8a2ecb..253d1f5483 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs @@ -470,7 +470,7 @@ namespace MonoDevelop.Ide.Gui PadWindow win = (PadWindow) GetPadWindow (codon); if (win != null) { win.NotifyDestroyed (); - Counters.PadsLoaded--; + Counters.PadsLoaded.Dec (1); padCodons.Remove (win); } if (item != null) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs index 72fc681f2f..4d504a8668 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs @@ -236,7 +236,7 @@ namespace MonoDevelop.Ide.Gui internal Document (DocumentManager documentManager, IShell shell, DocumentController controller, DocumentControllerDescription controllerDescription, IWorkbenchWindow window) { - Counters.OpenDocuments++; + Counters.OpenDocuments.Inc (1); this.shell = shell; this.documentManager = documentManager; @@ -578,7 +578,7 @@ namespace MonoDevelop.Ide.Gui shell.CloseView (window, true); - Counters.OpenDocuments--; + Counters.OpenDocuments.Dec (1); Dispose (); |