[nemiver/better-variable-format: 10/10] Avoid needless work when selecting a frame



commit 69fc78c2ced3a7d42bcecda06672463fdbf7df60
Author: Dodji Seketeli <dodji seketeli org>
Date:   Sat Feb 26 16:11:34 2011 +0100

    Avoid needless work when selecting a frame
    
    	* src/dbgengine/nmv-i-debugger.h (IDebugger::Frame::operator==):
    	New equality operator.
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc
    	(DBGPerspective::on_frame_selected_signal): Return early if we
    	selecting the same frame as the current one.

 src/dbgengine/nmv-i-debugger.h                  |   14 ++++++++++++--
 src/persp/dbgperspective/nmv-dbg-perspective.cc |    6 +++++-
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/dbgengine/nmv-i-debugger.h b/src/dbgengine/nmv-i-debugger.h
index 2b5a845..489b460 100644
--- a/src/dbgengine/nmv-i-debugger.h
+++ b/src/dbgengine/nmv-i-debugger.h
@@ -272,10 +272,20 @@ public:
     public:
 
         Frame () :
-            m_level (0),
+        m_level (0),
             m_line (0)
-        {}
+            {
+            }
+
+        /// \operators
+        /// @{
 
+        bool operator== (const Frame &a)
+        {
+            return (address () == a.address ());
+        }
+
+        /// @}
         /// \name accessors
 
         /// @{
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 6086f23..df2edf7 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -2626,7 +2626,11 @@ DBGPerspective::on_frame_selected_signal (int /* a_index */,
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-    NEMIVER_TRY
+    if (m_priv->current_frame == a_frame)
+        return;
+
+    NEMIVER_TRY;
+
 
     m_priv->current_frame = a_frame;
 



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