mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Fix bug # 178368: reduce search graph footprint re: HTML chunks. r=sgehani sr=jag
This commit is contained in:
parent
185d03fd80
commit
46c06897f0
@ -346,10 +346,9 @@ searchModePrefCallback(const char *pref, void *aClosure)
|
|||||||
|
|
||||||
if (searchDS->prefs)
|
if (searchDS->prefs)
|
||||||
{
|
{
|
||||||
PRInt32 searchMode=0;
|
searchDS->prefs->GetIntPref(pref, &searchDS->gBrowserSearchMode);
|
||||||
searchDS->prefs->GetIntPref(pref, &searchMode);
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("searchModePrefCallback: '%s' = %d\n", pref, searchMode);
|
printf("searchModePrefCallback: '%s' = %d\n", pref, searchDS->gBrowserSearchMode);
|
||||||
#endif
|
#endif
|
||||||
searchDS->Assert(searchDS->kNC_LastSearchRoot, searchDS->kNC_LastSearchMode, searchDS->kTrueLiteral, PR_TRUE);
|
searchDS->Assert(searchDS->kNC_LastSearchRoot, searchDS->kNC_LastSearchMode, searchDS->kTrueLiteral, PR_TRUE);
|
||||||
}
|
}
|
||||||
@ -359,11 +358,12 @@ searchModePrefCallback(const char *pref, void *aClosure)
|
|||||||
static nsIRDFService *gRDFService = nsnull;
|
static nsIRDFService *gRDFService = nsnull;
|
||||||
static nsIRDFContainerUtils *gRDFC = nsnull;
|
static nsIRDFContainerUtils *gRDFC = nsnull;
|
||||||
PRInt32 InternetSearchDataSource::gRefCnt = 0;
|
PRInt32 InternetSearchDataSource::gRefCnt = 0;
|
||||||
|
PRInt32 InternetSearchDataSource::gBrowserSearchMode = 0;
|
||||||
nsIRDFDataSource *InternetSearchDataSource::mInner = nsnull;
|
nsIRDFDataSource *InternetSearchDataSource::mInner = nsnull;
|
||||||
nsCOMPtr<nsISupportsArray> InternetSearchDataSource::mUpdateArray;
|
nsCOMPtr<nsISupportsArray> InternetSearchDataSource::mUpdateArray;
|
||||||
nsCOMPtr<nsIRDFDataSource> InternetSearchDataSource::mLocalstore;
|
nsCOMPtr<nsIRDFDataSource> InternetSearchDataSource::mLocalstore;
|
||||||
nsCOMPtr<nsIRDFDataSource> InternetSearchDataSource::categoryDataSource;
|
nsCOMPtr<nsIRDFDataSource> InternetSearchDataSource::categoryDataSource;
|
||||||
PRBool InternetSearchDataSource::mEngineListBuilt;
|
PRBool InternetSearchDataSource::gEngineListBuilt = PR_FALSE;
|
||||||
nsCOMPtr<nsILoadGroup> InternetSearchDataSource::mBackgroundLoadGroup;
|
nsCOMPtr<nsILoadGroup> InternetSearchDataSource::mBackgroundLoadGroup;
|
||||||
nsCOMPtr<nsILoadGroup> InternetSearchDataSource::mLoadGroup;
|
nsCOMPtr<nsILoadGroup> InternetSearchDataSource::mLoadGroup;
|
||||||
nsCOMPtr<nsIPref> InternetSearchDataSource::prefs;
|
nsCOMPtr<nsIPref> InternetSearchDataSource::prefs;
|
||||||
@ -494,6 +494,7 @@ InternetSearchDataSource::InternetSearchDataSource(void)
|
|||||||
if (NS_SUCCEEDED(rv) && (prefs))
|
if (NS_SUCCEEDED(rv) && (prefs))
|
||||||
{
|
{
|
||||||
prefs->RegisterCallback("browser.search.mode", searchModePrefCallback, this);
|
prefs->RegisterCallback("browser.search.mode", searchModePrefCallback, this);
|
||||||
|
prefs->GetIntPref("browser.search.mode", &gBrowserSearchMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -933,7 +934,7 @@ InternetSearchDataSource::Init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mEngineListBuilt = PR_FALSE;
|
gEngineListBuilt = PR_FALSE;
|
||||||
|
|
||||||
// Register as a profile change obsevrer
|
// Register as a profile change obsevrer
|
||||||
nsCOMPtr<nsIObserverService> observerService =
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
@ -953,9 +954,9 @@ InternetSearchDataSource::DeferredInit()
|
|||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (mEngineListBuilt == PR_FALSE)
|
if (gEngineListBuilt == PR_FALSE)
|
||||||
{
|
{
|
||||||
mEngineListBuilt = PR_TRUE;
|
gEngineListBuilt = PR_TRUE;
|
||||||
|
|
||||||
// get available search engines
|
// get available search engines
|
||||||
nsCOMPtr<nsIFile> nativeDir;
|
nsCOMPtr<nsIFile> nativeDir;
|
||||||
@ -1225,7 +1226,7 @@ InternetSearchDataSource::GetTargets(nsIRDFResource *source,
|
|||||||
{
|
{
|
||||||
// defer search engine discovery until needed; small startup time improvement
|
// defer search engine discovery until needed; small startup time improvement
|
||||||
if (((source == kNC_SearchEngineRoot) || isSearchURI(source)) && (property == kNC_Child)
|
if (((source == kNC_SearchEngineRoot) || isSearchURI(source)) && (property == kNC_Child)
|
||||||
&& (mEngineListBuilt == PR_FALSE))
|
&& (gEngineListBuilt == PR_FALSE))
|
||||||
{
|
{
|
||||||
DeferredInit();
|
DeferredInit();
|
||||||
}
|
}
|
||||||
@ -2505,7 +2506,7 @@ InternetSearchDataSource::GetInternetSearchURL(const char *searchEngineURI,
|
|||||||
*resultURL = nsnull;
|
*resultURL = nsnull;
|
||||||
|
|
||||||
// if we haven't already, load in the engines
|
// if we haven't already, load in the engines
|
||||||
if (mEngineListBuilt == PR_FALSE) DeferredInit();
|
if (gEngineListBuilt == PR_FALSE) DeferredInit();
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIRDFResource> engine;
|
nsCOMPtr<nsIRDFResource> engine;
|
||||||
@ -2650,7 +2651,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
|
|||||||
shortURL.Truncate(optionsOffset);
|
shortURL.Truncate(optionsOffset);
|
||||||
|
|
||||||
// if we haven't already, load in the engines
|
// if we haven't already, load in the engines
|
||||||
if (mEngineListBuilt == PR_FALSE) DeferredInit();
|
if (gEngineListBuilt == PR_FALSE) DeferredInit();
|
||||||
|
|
||||||
// look in available engines to see if any of them appear
|
// look in available engines to see if any of them appear
|
||||||
// to match this url (minus the GET options)
|
// to match this url (minus the GET options)
|
||||||
@ -5079,7 +5080,7 @@ InternetSearchDataSource::webSearchFinalize(nsIChannel* channel, nsIInternetSear
|
|||||||
const PRUnichar *uniBuf = nsnull;
|
const PRUnichar *uniBuf = nsnull;
|
||||||
if (NS_SUCCEEDED(rv = context->GetBufferConst(&uniBuf)) && (uniBuf))
|
if (NS_SUCCEEDED(rv = context->GetBufferConst(&uniBuf)) && (uniBuf))
|
||||||
{
|
{
|
||||||
if (mParent)
|
if (mParent && (gBrowserSearchMode>0))
|
||||||
{
|
{
|
||||||
// save HTML result page for this engine
|
// save HTML result page for this engine
|
||||||
nsCOMPtr<nsIRDFLiteral> htmlLiteral;
|
nsCOMPtr<nsIRDFLiteral> htmlLiteral;
|
||||||
@ -5489,7 +5490,7 @@ InternetSearchDataSource::ParseHTML(nsIURI *aURL, nsIRDFResource *mParent,
|
|||||||
|
|
||||||
// set HTML response chunk
|
// set HTML response chunk
|
||||||
const PRUnichar *htmlResponseUni = resultItem.get();
|
const PRUnichar *htmlResponseUni = resultItem.get();
|
||||||
if (htmlResponseUni)
|
if (htmlResponseUni && (gBrowserSearchMode>0))
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIRDFLiteral> htmlResponseLiteral;
|
nsCOMPtr<nsIRDFLiteral> htmlResponseLiteral;
|
||||||
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(htmlResponseUni, getter_AddRefs(htmlResponseLiteral))))
|
if (NS_SUCCEEDED(rv = gRDFService->GetLiteral(htmlResponseUni, getter_AddRefs(htmlResponseLiteral))))
|
||||||
|
@ -61,7 +61,8 @@ class InternetSearchDataSource : public nsIInternetSearchService,
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static PRInt32 gRefCnt;
|
static PRInt32 gRefCnt;
|
||||||
static PRBool mEngineListBuilt;
|
static PRInt32 gBrowserSearchMode;
|
||||||
|
static PRBool gEngineListBuilt;
|
||||||
|
|
||||||
// pseudo-constants
|
// pseudo-constants
|
||||||
static nsIRDFResource *kNC_SearchResult;
|
static nsIRDFResource *kNC_SearchResult;
|
||||||
|
Loading…
Reference in New Issue
Block a user