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

Unified Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs

Issue 10836143: Refactored the VS add-in (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 4 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: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs
diff --git a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs
new file mode 100644
index 0000000000000000000000000000000000000000..2ad73e888ab1d6fd5eb2b39499d4b34f75cb7500
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/PluginDebuggerVS.cs
@@ -0,0 +1,66 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+namespace NativeClientVSAddIn
+{
+ using System;
+
+ using EnvDTE80;
+
+ /// <summary>
+ /// This class handles the details of finding a pepper plugin and attaching to it.
+ /// </summary>
+ public class PluginDebuggerVS : PluginDebuggerBase
+ {
+ /// <summary>
+ /// Path to the actual plug-in assembly.
+ /// </summary>
+ private string pluginAssembly_;
+
+ /// <summary>
+ /// Constructs the PluginDebuggerHelper.
+ /// </summary>
+ /// <param name="dte">Automation object from Visual Studio.</param>
+ /// <param name="properties">PropertyManager pointing to a valid project/platform.</param>
+ public PluginDebuggerVS(DTE2 dte, PropertyManager properties)
+ : base(dte, properties)
+ {
+ pluginAssembly_ = properties.PluginAssembly;
+ PluginFoundEvent += new EventHandler<PluginFoundEventArgs>(Attach);
+ }
+
+ /// <summary>
+ /// Called to check if a process is a valid pepper plugin to attach to.
+ /// </summary>
+ /// <param name="proc">Contains information about the process in question.</param>
+ /// <param name="mainChromeFlags">Flags on the main Chrome process.</param>
+ /// <returns>True if we should attach to the process.</returns>
+ protected override bool IsPluginProcess(ProcessInfo proc, string mainChromeFlags)
+ {
+ StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase;
+ string identifierFlagTarget =
+ string.Format(Strings.PepperProcessPluginFlagFormat, pluginAssembly_);
+ return proc.Name.Equals(Strings.ChromeProcessName, ignoreCase) &&
+ proc.CommandLine.Contains(Strings.ChromeRendererFlag, ignoreCase) &&
+ proc.CommandLine.Contains(identifierFlagTarget, ignoreCase);
+ }
+
+ /// <summary>
+ /// Attaches the Visual Studio debugger to the given process ID.
+ /// </summary>
+ /// <param name="src">The parameter is not used.</param>
+ /// <param name="args">Contains the process ID to attach to.</param>
+ private void Attach(object src, PluginFoundEventArgs args)
+ {
+ foreach (EnvDTE.Process proc in Dte.Debugger.LocalProcesses)
+ {
+ if (proc.ProcessID == args.ProcessID)
+ {
+ proc.Attach();
+ break;
+ }
+ }
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698