зеркало из https://github.com/mozilla/gecko-dev.git
Fix bug 193347. r/sr=alecf. a=dbaron. Remove autocomplete learning and data collection code from nsGlobalHistory.cpp now that it is no longer needed.
This commit is contained in:
Родитель
7d03818c4d
Коммит
8180f7e5ba
|
@ -4222,7 +4222,7 @@ nsDocShell::OnStateChange(nsIWebProgress * aProgress, nsIRequest * aRequest,
|
||||||
// Add the original url to global History so that
|
// Add the original url to global History so that
|
||||||
// visited url color changes happen.
|
// visited url color changes happen.
|
||||||
if (uri)
|
if (uri)
|
||||||
AddToGlobalHistory(channel, uri, PR_TRUE);
|
AddToGlobalHistory(uri, PR_TRUE);
|
||||||
} // channel
|
} // channel
|
||||||
} // aProgress
|
} // aProgress
|
||||||
}
|
}
|
||||||
|
@ -5878,7 +5878,7 @@ nsDocShell::OnNewURI(nsIURI * aURI, nsIChannel * aChannel,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Global history
|
// Update Global history
|
||||||
AddToGlobalHistory(aChannel, aURI, IsFrame());
|
AddToGlobalHistory(aURI, IsFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this was a history load, update the index in
|
// If this was a history load, update the index in
|
||||||
|
@ -6417,9 +6417,8 @@ NS_IMETHODIMP nsDocShell::MakeEditable(PRBool inWaitForUriLoad)
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDocShell::AddToGlobalHistory(nsIChannel* aChannel, nsIURI * aURI, PRBool aHidden)
|
nsDocShell::AddToGlobalHistory(nsIURI * aURI, PRBool aHidden)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
|
||||||
// first check if we should be adding it
|
// first check if we should be adding it
|
||||||
PRBool updateHistory;
|
PRBool updateHistory;
|
||||||
ShouldAddToGlobalHistory(aURI, &updateHistory);
|
ShouldAddToGlobalHistory(aURI, &updateHistory);
|
||||||
|
@ -6432,26 +6431,6 @@ nsDocShell::AddToGlobalHistory(nsIChannel* aChannel, nsIURI * aURI, PRBool aHidd
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(mGlobalHistory->AddPage(spec.get()), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(mGlobalHistory->AddPage(spec.get()), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(aChannel, &rv));
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
nsCOMPtr<nsIURI> referrer;
|
|
||||||
rv = httpChannel->GetReferrer(getter_AddRefs(referrer));
|
|
||||||
if (NS_SUCCEEDED(rv) && referrer) {
|
|
||||||
nsCAutoString referrerSpec;
|
|
||||||
rv = referrer->GetSpec(referrerSpec);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
nsCOMPtr<nsIBrowserHistory> browserHistory =
|
|
||||||
do_QueryInterface(mGlobalHistory);
|
|
||||||
// In embedding environments, the "lite" global history
|
|
||||||
// implementation might not implement nsIBrowserHistory.
|
|
||||||
if (browserHistory) {
|
|
||||||
browserHistory->OutputReferrerURL(spec.get(),
|
|
||||||
referrerSpec.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is a redirect, so hide the page from
|
// this is a redirect, so hide the page from
|
||||||
// being enumerated in history
|
// being enumerated in history
|
||||||
if (aHidden) {
|
if (aHidden) {
|
||||||
|
|
|
@ -235,7 +235,7 @@ protected:
|
||||||
|
|
||||||
// Global History
|
// Global History
|
||||||
nsresult ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd);
|
nsresult ShouldAddToGlobalHistory(nsIURI * aURI, PRBool * aShouldAdd);
|
||||||
nsresult AddToGlobalHistory(nsIChannel* aChannel, nsIURI * aURI, PRBool aHidden);
|
nsresult AddToGlobalHistory(nsIURI * aURI, PRBool );
|
||||||
|
|
||||||
// Helper Routines
|
// Helper Routines
|
||||||
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
NS_IMETHOD GetPromptAndStringBundle(nsIPrompt ** aPrompt,
|
||||||
|
|
|
@ -117,23 +117,6 @@ interface nsIBrowserHistory : nsISupports
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void markPageAsTyped(in string url);
|
void markPageAsTyped(in string url);
|
||||||
|
|
||||||
/**
|
|
||||||
* outputReferrerURL
|
|
||||||
* Prints out referrer information for a url to a
|
|
||||||
* data file if browser.history.url.datacapture.mode is set
|
|
||||||
* to 1 or 2 (see the comment in nsGlobalHistory.cpp for
|
|
||||||
* more details).
|
|
||||||
*
|
|
||||||
* This method is a big hack and only temporary. Please do NOT use
|
|
||||||
* it in your code. It will be removed after the data
|
|
||||||
* collection phase of the project described in bug 182366 is
|
|
||||||
* over.
|
|
||||||
*
|
|
||||||
* @param aURL a url in global history
|
|
||||||
* @param aReferrer the referrer url to aURL
|
|
||||||
*/
|
|
||||||
void outputReferrerURL(in string aURL, in string aReferrer);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
%{ C++
|
%{ C++
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -108,56 +108,6 @@ class searchTerm;
|
||||||
// Size of visit count boost to give to urls which are sites or paths
|
// Size of visit count boost to give to urls which are sites or paths
|
||||||
#define AUTOCOMPLETE_NONPAGE_VISIT_COUNT_BOOST 5
|
#define AUTOCOMPLETE_NONPAGE_VISIT_COUNT_BOOST 5
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// Perceptron definitions
|
|
||||||
// XXX The class definitions need to go in a separate header file
|
|
||||||
|
|
||||||
class nsPerceptron
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
nsPerceptron();
|
|
||||||
public:
|
|
||||||
nsPerceptron(PRInt32 aNumFeatures);
|
|
||||||
virtual ~nsPerceptron()
|
|
||||||
{
|
|
||||||
SaveWeights();
|
|
||||||
if (mWeights) {
|
|
||||||
delete [] mWeights;
|
|
||||||
}
|
|
||||||
mNumWeights = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void Train(PRFloat64* aInputs, PRInt32 aNumInputs, PRFloat64 aTargetOutput);
|
|
||||||
virtual void Test (PRFloat64* aInputs, PRInt32 aNumInputs, PRFloat64* aOutput);
|
|
||||||
void SaveWeights();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void LoadWeights();
|
|
||||||
|
|
||||||
PRFloat64* mWeights; // array of weights
|
|
||||||
PRInt32 mNumWeights;
|
|
||||||
};
|
|
||||||
|
|
||||||
class nsSigmoidPerceptron : public nsPerceptron
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
nsSigmoidPerceptron();
|
|
||||||
public:
|
|
||||||
nsSigmoidPerceptron(PRInt32 aNumFeatures);
|
|
||||||
virtual ~nsSigmoidPerceptron() {}
|
|
||||||
|
|
||||||
virtual void Train(PRFloat64* aInputs, PRInt32 aNumInputs, PRFloat64 aTargetOutput);
|
|
||||||
virtual void Test(PRFloat64* aInputs, PRInt32 aNumInputs, PRFloat64* aOutput);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PRFloat64 Sigmoid(PRFloat64 aNum);
|
|
||||||
};
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// nsGlobalHistory
|
// nsGlobalHistory
|
||||||
|
@ -319,19 +269,6 @@ protected:
|
||||||
nsresult NotifyUnassert(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aValue);
|
nsresult NotifyUnassert(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aValue);
|
||||||
nsresult NotifyChange(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aOldValue, nsIRDFNode* aNewValue);
|
nsresult NotifyChange(nsIRDFResource* aSource, nsIRDFResource* aProperty, nsIRDFNode* aOldValue, nsIRDFNode* aNewValue);
|
||||||
|
|
||||||
// Autocomplete learning related
|
|
||||||
PRInt32 mDataCaptureMode;
|
|
||||||
PRInt32 mLearningMode;
|
|
||||||
// The learning engine used to learn a user's autocomplete behavior
|
|
||||||
nsSigmoidPerceptron* mAutoCompleteLearner;
|
|
||||||
PRFloat64* mACFeatures;
|
|
||||||
nsresult FillInputFeatures(nsAString &aUrl, PRFloat64 *aFeatures);
|
|
||||||
|
|
||||||
// URL data capture related
|
|
||||||
FILE* mURLDataFile;
|
|
||||||
nsresult WriteURLData(nsAString& aURL, PRFloat64* aURLFeatures);
|
|
||||||
nsresult AssignUniqueURLID(nsIMdbRow *aRow, PRInt64 *aID);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// row-oriented stuff
|
// row-oriented stuff
|
||||||
//
|
//
|
||||||
|
@ -356,15 +293,6 @@ protected:
|
||||||
mdb_column kToken_HiddenColumn;
|
mdb_column kToken_HiddenColumn;
|
||||||
mdb_column kToken_TypedColumn;
|
mdb_column kToken_TypedColumn;
|
||||||
|
|
||||||
// Frequency-Recency metrics for url
|
|
||||||
mdb_column kToken_FRFastDecayColumn;
|
|
||||||
mdb_column kToken_FRSlowDecayColumn;
|
|
||||||
|
|
||||||
// Unique ID of url. Needed to identify urls output to
|
|
||||||
// mURLDataFile when the data capture mode doesn't allow the
|
|
||||||
// url path to be output
|
|
||||||
mdb_column kToken_URLIDColumn;
|
|
||||||
|
|
||||||
// meta-data tokens
|
// meta-data tokens
|
||||||
mdb_column kToken_LastPageVisited;
|
mdb_column kToken_LastPageVisited;
|
||||||
|
|
||||||
|
@ -374,7 +302,6 @@ protected:
|
||||||
nsresult AddPageToDatabase(const char *aURL,
|
nsresult AddPageToDatabase(const char *aURL,
|
||||||
PRInt64 aDate);
|
PRInt64 aDate);
|
||||||
nsresult AddExistingPageToDatabase(nsIMdbRow *row,
|
nsresult AddExistingPageToDatabase(nsIMdbRow *row,
|
||||||
const char *aURL,
|
|
||||||
PRInt64 aDate,
|
PRInt64 aDate,
|
||||||
PRInt64 *aOldDate,
|
PRInt64 *aOldDate,
|
||||||
PRInt32 *aOldCount);
|
PRInt32 *aOldCount);
|
||||||
|
@ -388,18 +315,13 @@ protected:
|
||||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRInt32 aValue);
|
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRInt32 aValue);
|
||||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const char *aValue);
|
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const char *aValue);
|
||||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRUnichar *aValue);
|
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, const PRUnichar *aValue);
|
||||||
nsresult SetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRFloat64 aValue);
|
|
||||||
|
|
||||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString& aResult);
|
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsAString& aResult);
|
||||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString& aResult);
|
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, nsACString& aResult);
|
||||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt64* aResult);
|
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt64* aResult);
|
||||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32* aResult);
|
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRInt32* aResult);
|
||||||
nsresult GetRowValue(nsIMdbRow *aRow, mdb_column aCol, PRFloat64* aResult);
|
|
||||||
|
|
||||||
nsresult FindRow(mdb_column aCol, const char *aURL, nsIMdbRow **aResult);
|
nsresult FindRow(mdb_column aCol, const char *aURL, nsIMdbRow **aResult);
|
||||||
nsresult FindRow(mdb_column aCol, PRInt64 aValue, nsIMdbRow **aResult);
|
|
||||||
nsresult FindRowAndID(mdb_column aCol, const char *aURL,
|
|
||||||
nsIMdbRow **aResult, PRInt64 *aRowID);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// misc unrelated stuff
|
// misc unrelated stuff
|
||||||
|
@ -424,9 +346,6 @@ protected:
|
||||||
static nsIRDFResource* kNC_URL; // XXX do we need?
|
static nsIRDFResource* kNC_URL; // XXX do we need?
|
||||||
static nsIRDFResource* kNC_HistoryRoot;
|
static nsIRDFResource* kNC_HistoryRoot;
|
||||||
static nsIRDFResource* kNC_HistoryByDate;
|
static nsIRDFResource* kNC_HistoryByDate;
|
||||||
static nsIRDFResource* kNC_BookmarkAddDate;
|
|
||||||
static nsIRDFResource* kNC_Bookmark;
|
|
||||||
static nsIRDFResource* kRDF_Type;
|
|
||||||
|
|
||||||
static nsIMdbFactory* gMdbFactory;
|
static nsIMdbFactory* gMdbFactory;
|
||||||
static nsIPrefBranch* gPrefBranch;
|
static nsIPrefBranch* gPrefBranch;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче