merge backout
authorChris Jones <jones.chris.g@gmail.com>
Wed, 13 Jul 2011 22:25:22 -0700
changeset 72798 f70f630c3e801b6582497a2dfdfb0b3282574dd0
parent 72796 0141c3f5b18cde4497c9fdafd37a00964e8b6bb5 (current diff)
parent 72797 c4676497cbf3550201dd527cc43660bac358f178 (diff)
child 72799 bb74b8675a47e310257feb6e7844bce1f9e68e99
push id20772
push usereakhgari@mozilla.com
push dateThu, 14 Jul 2011 16:20:50 +0000
treeherdermozilla-central@89b5fccb0514 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge backout
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -51,17 +51,16 @@
 #include "mozilla/storage.h"
 #include "mozilla/dom/Link.h"
 #include "nsDocShellCID.h"
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
 #include "nsNetUtil.h"
 #include "nsIXPConnect.h"
 #include "mozilla/Util.h"
-#include "nsContentUtils.h"
 
 // Initial size for the cache holding visited status observers.
 #define VISIT_OBSERVERS_INITIAL_CACHE_SIZE 128
 
 // Topic used to notify that work in mozIAsyncHistory::updatePlaces is done.
 #define TOPIC_UPDATEPLACES_COMPLETE "places-updatePlaces-complete"
 
 using namespace mozilla::dom;
@@ -1274,18 +1273,16 @@ History::~History()
 #endif
 }
 
 void
 History::NotifyVisited(nsIURI* aURI)
 {
   NS_ASSERTION(aURI, "Ruh-roh!  A NULL URI was passed to us!");
 
-  nsAutoScriptBlocker scriptBlocker;
-
   if (XRE_GetProcessType() == GeckoProcessType_Default) {
     mozilla::dom::ContentParent* cpp = 
       mozilla::dom::ContentParent::GetSingleton(PR_FALSE);
     if (cpp)
       (void)cpp->SendNotifyVisited(aURI);
   }
 
   // If the hash table has not been initialized, then we have nothing to notify
@@ -1296,27 +1293,24 @@ History::NotifyVisited(nsIURI* aURI)
 
   // Additionally, if we have no observers for this URI, we have nothing to
   // notify about.
   KeyClass* key = mObservers.GetEntry(aURI);
   if (!key) {
     return;
   }
 
-  // Update status of each Link node.
-  {
-    // RemoveEntry will destroy the array, this iterator should not survive it.
-    ObserverArray::ForwardIterator iter(key->array);
-    while (iter.HasMore()) {
-      Link* link = iter.GetNext();
-      link->SetLinkState(eLinkState_Visited);
-      // Verify that the observers hash doesn't mutate while looping through
-      // the links associated with this URI.
-      MOZ_ASSERT(key == mObservers.GetEntry(aURI));
-    }
+  // Walk through the array, and update each Link node.
+  const ObserverArray& observers = key->array;
+  ObserverArray::index_type len = observers.Length();
+  for (ObserverArray::index_type i = 0; i < len; i++) {
+    Link* link = observers[i];
+    link->SetLinkState(eLinkState_Visited);
+    NS_ASSERTION(len == observers.Length(),
+                 "Calling SetLinkState added or removed an observer!");
   }
 
   // All the registered nodes can now be removed for this URI.
   mObservers.RemoveEntry(aURI);
 }
 
 mozIStorageAsyncStatement*
 History::GetIsVisitedStatement()
--- a/toolkit/components/places/History.h
+++ b/toolkit/components/places/History.h
@@ -41,17 +41,17 @@
 #define mozilla_places_History_h_
 
 #include "mozilla/IHistory.h"
 #include "mozIAsyncHistory.h"
 #include "mozilla/dom/Link.h"
 #include "nsTHashtable.h"
 #include "nsString.h"
 #include "nsURIHashKey.h"
-#include "nsTObserverArray.h"
+#include "nsTArray.h"
 #include "nsDeque.h"
 #include "nsIObserver.h"
 #include "mozIStorageConnection.h"
 #include "mozilla/storage/StatementCache.h"
 
 namespace mozilla {
 namespace places {
 
@@ -162,17 +162,17 @@ private:
    */
   void Shutdown();
 
   static History* gService;
 
   // Ensures new tasks aren't started on destruction.
   bool mShuttingDown;
 
-  typedef nsTObserverArray<mozilla::dom::Link* > ObserverArray;
+  typedef nsTArray<mozilla::dom::Link* > ObserverArray;
 
   class KeyClass : public nsURIHashKey
   {
   public:
     KeyClass(const nsIURI* aURI)
     : nsURIHashKey(aURI)
     {
     }