[haiku-commits] r34104 - haiku/trunk/src/kits/tracker

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 18 Nov 2009 09:54:44 +0100 (CET)

Author: stippi
Date: 2009-11-18 09:54:44 +0100 (Wed, 18 Nov 2009)
New Revision: 34104
Changeset: http://dev.haiku-os.org/changeset/34104/haiku

Modified:
   haiku/trunk/src/kits/tracker/FSUtils.cpp
   haiku/trunk/src/kits/tracker/StatusWindow.cpp
   haiku/trunk/src/kits/tracker/StatusWindow.h
Log:
The usage of BStatusWindow::HasStatus() was really bogus. First of all
HasStatus() and UpdateStatus() were not run in the same lock, so the job
view could be gone anyway. And secondly, both methods iterate over all status
items to find the one with the correct thread. Doh, if we don't have enough
work to do, lets make some! Of course this was not critical in any case...


Modified: haiku/trunk/src/kits/tracker/FSUtils.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/FSUtils.cpp    2009-11-17 22:07:03 UTC (rev 
34103)
+++ haiku/trunk/src/kits/tracker/FSUtils.cpp    2009-11-18 08:54:44 UTC (rev 
34104)
@@ -199,9 +199,8 @@
 TrackerCopyLoopControl::UpdateStatus(const char *name, entry_ref, int32 count,
        bool optional)
 {
-       if (gStatusWindow && gStatusWindow->HasStatus(fThread))
-               gStatusWindow->UpdateStatus(fThread, const_cast<char *>(name),
-                       count, optional);
+       if (gStatusWindow)
+               gStatusWindow->UpdateStatus(fThread, name, count, optional);
 }
 
 
@@ -817,7 +816,7 @@
 
                                // update the status because item got skipped 
and the status
                                // will not get updated by the move call
-                               if (gStatusWindow && 
gStatusWindow->HasStatus(thread))
+                               if (gStatusWindow)
                                        gStatusWindow->UpdateStatus(thread, 
srcRef->name, 1);
 
                                continue;
@@ -1478,7 +1477,7 @@
                        // size is irrelevant when simply moving to a new folder
 
                        thread_id thread = find_thread(NULL);
-                       if (gStatusWindow && gStatusWindow->HasStatus(thread))
+                       if (gStatusWindow)
                                gStatusWindow->UpdateStatus(thread, ref.name, 
1);
                        if (entry->IsDirectory())
                                return RecursiveMove(entry, destDir);

Modified: haiku/trunk/src/kits/tracker/StatusWindow.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/StatusWindow.cpp       2009-11-17 22:07:03 UTC 
(rev 34103)
+++ haiku/trunk/src/kits/tracker/StatusWindow.cpp       2009-11-18 08:54:44 UTC 
(rev 34104)
@@ -302,23 +302,6 @@
 
 
 bool
-BStatusWindow::HasStatus(thread_id thread)
-{
-       AutoLock<BWindow> lock(this);
-
-       int32 numItems = fViewList.CountItems();
-       for (int32 index = 0; index < numItems; index++) {
-               BStatusView* view = fViewList.ItemAt(index);
-               if (view->Thread() == thread)
-                       return true;
-
-       }
-
-       return false;
-}
-
-
-bool
 BStatusWindow::CheckCanceledOrPaused(thread_id thread)
 {
        bool wasCanceled = false;

Modified: haiku/trunk/src/kits/tracker/StatusWindow.h
===================================================================
--- haiku/trunk/src/kits/tracker/StatusWindow.h 2009-11-17 22:07:03 UTC (rev 
34103)
+++ haiku/trunk/src/kits/tracker/StatusWindow.h 2009-11-18 08:54:44 UTC (rev 
34104)
@@ -77,7 +77,6 @@
                                                                        // will 
only be updated if 0.2 seconds
                                                                        // 
elapsed since the last update
                        void                            
RemoveStatusItem(thread_id);
-                       bool                            HasStatus(thread_id);
 
                        bool                            
CheckCanceledOrPaused(thread_id);
 
@@ -171,7 +170,7 @@
 }
 
 
-extern BStatusWindow *gStatusWindow;
+extern BStatusWindow* gStatusWindow;
 
 
 } // namespace BPrivate


Other related posts:

  • » [haiku-commits] r34104 - haiku/trunk/src/kits/tracker - superstippi