[gnome-system-monitor/wip/procinfo2: 5/6] Consolidate MutableProcInfo into ProcInfo



commit c0a185e4d2e19232d199c40b925a7a891067bc1b
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Thu May 8 18:43:37 2014 +0200

    Consolidate MutableProcInfo into ProcInfo

 src/procinfo.cpp |    3 ++-
 src/procinfo.h   |   26 +++++++-------------------
 2 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/src/procinfo.cpp b/src/procinfo.cpp
index 9e41e63..c8c870e 100644
--- a/src/procinfo.cpp
+++ b/src/procinfo.cpp
@@ -239,7 +239,8 @@ update_info (GsmApplication *app, ProcInfo *info)
 }
 
 ProcInfo::ProcInfo(pid_t pid)
-    : tooltip(NULL),
+    : status(0),
+      tooltip(NULL),
       name(NULL),
       arguments(NULL),
       security_context(NULL),
diff --git a/src/procinfo.h b/src/procinfo.h
index a8c015a..6fc27a1 100644
--- a/src/procinfo.h
+++ b/src/procinfo.h
@@ -8,12 +8,9 @@
 
 #include <application.h>
 
-struct MutableProcInfo
+class ProcInfo
 {
-MutableProcInfo()
-: status(0)
-    { }
-
+ public:
     std::string user;
 
     gchar wchan[40];
@@ -45,20 +42,6 @@ MutableProcInfo()
     gchar *seat;
 
     std::string owner;
-};
-
-
-class ProcInfo
-: public MutableProcInfo
-{
-    /* undefined */ ProcInfo& operator=(const ProcInfo&);
-    /* undefined */ ProcInfo(const ProcInfo&);
-
-    typedef std::map<guint, std::string> UserMap;
-    /* cached username */
-    static UserMap users;
-
-  public:
 
     // TODO: use a set instead
     // sorted by pid. The map has a nice property : it is sorted
@@ -94,12 +77,17 @@ class ProcInfo
     guint           uid;
 
 // private:
+    typedef std::map<guint, std::string> UserMap;
+    /* cached username */
+    static UserMap users;
+
     // tracks cpu time per process keeps growing because if a
     // ProcInfo is deleted this does not mean that the process is
     // not going to be recreated on the next update.  For example,
     // if dependencies + (My or Active), the proclist is cleared
     // on each update.  This is a workaround
     static std::map<pid_t, guint64> cpu_times;
+
 };
 
 void update_info (GsmApplication *app, ProcInfo *info);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]