Bug 78510. Maintain a per-document hashmap from URI-spec-hash to set of pointers to content elements that are links to those URIs whose state has been queried by the style system. Use this map to efficiently mark visited any links to URIs which get visited. r+sr=dbaron, with input from bryner and bzbarsky, a=jesup with support from dbaron. May impact Tp and other metrics, be careful out there.

This commit is contained in:
roc+@cs.cmu.edu
2005-08-10 20:21:44 +00:00
parent 5b71278514
commit 116c7af9d3
19 changed files with 501 additions and 57 deletions

View File

@@ -66,6 +66,7 @@
#include "nsIWebBrowserChrome.h"
#include "nsPoint.h"
#include "nsGfxCIID.h"
#include "nsIObserverService.h"
#include "nsIPrompt.h"
#include "nsIAuthPrompt.h"
#include "nsTextFormatter.h"
@@ -7831,13 +7832,27 @@ NS_IMETHODIMP nsDocShell::MakeEditable(PRBool inWaitForUriLoad)
nsresult
nsDocShell::AddToGlobalHistory(nsIURI * aURI, PRBool aRedirect, nsIURI * aReferrer)
{
if (mItemType != typeContent)
if (mItemType != typeContent || !mGlobalHistory)
return NS_OK;
if (!mGlobalHistory)
return NS_OK;
PRBool visited;
nsresult rv = mGlobalHistory->IsVisited(aURI, &visited);
if (NS_FAILED(rv))
return rv;
rv = mGlobalHistory->AddURI(aURI, aRedirect, !IsFrame(), aReferrer);
if (NS_FAILED(rv))
return rv;
return mGlobalHistory->AddURI(aURI, aRedirect, !IsFrame(), aReferrer);
if (!visited) {
nsCOMPtr<nsIObserverService> obsService =
do_GetService("@mozilla.org/observer-service;1");
if (obsService) {
obsService->NotifyObservers(aURI, NS_LINK_VISITED_EVENT_TOPIC, nsnull);
}
}
return NS_OK;
}
//*****************************************************************************