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

Side by Side Diff: experimental/visual_studio_plugin/src/NaClVsx.Package/DebugSupport/NaClPort.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 unified diff | Download patch
OLDNEW
(Empty)
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Linq;
5 using System.Net;
6 using System.Text;
7 using Google.MsAd7.BaseImpl;
8 using Google.NaClVsx.ProjectSupport;
9 using Microsoft.VisualStudio;
10 using Microsoft.VisualStudio.Debugger.Interop;
11
12 namespace Google.NaClVsx.DebugSupport
13 {
14 public class NaClPort : Port
15 {
16 public NaClPort(IDebugPortSupplier2 supplier, IDebugPortRequest2 request, st ring connectionString)
17 : base(supplier, request, System.Guid.NewGuid()) {
18 connectionString_ = connectionString;
19 }
20
21 public string ConnectionString {
22 get { return connectionString_; }
23 }
24
25 void Refresh()
26 {
27 // currently we're assuming that there is only one
28 // (IP) port in use, and it's specified in the
29 // connection string.
30 // TODO(Noel): generalize to work with multiple ports
31 // once we have some way of enumerating which processes
32 // are listening.
33 if (processes_.Count > 0) return;
34 string[] addressComponents = connectionString_.Split(':');
35 if (addressComponents.Length < 2)
36 {
37 throw new ArgumentException("Connection string must be of the format <ho stname>:<port>");
38 }
39
40 int port = Convert.ToInt32(addressComponents[1]);
41 var imagePath = NaClProjectConfig.GetLastNexe();
42 processes_.Add(new NaClDebugProcess(this, connectionString_, port, imagePa th));
43 }
44
45 #region Overrides of Port
46
47 protected override IEnumerable<DebugProcess> GetProcesses() {
48 Refresh();
49 return processes_;
50 }
51
52 protected override DebugProcess CreateProcessInternal(ProcessStartInfo psi) {
53 DebugProcess result = null;
54 using (var proc = Process.Start(psi)) {
55 if (proc == null) {
56 throw new InvalidOperationException(
57 string.Format("Can't launch {0}", psi.FileName));
58 }
59
60 result = new NaClDebugProcess(
61 this, connectionString_, proc.Id, psi.FileName);
62 }
63
64 processes_.Add(result);
65 return result;
66 }
67
68 #endregion
69
70 private readonly string connectionString_;
71 private readonly List<DebugProcess> processes_ = new List<DebugProcess>();
72 }
73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698