зеркало из https://github.com/mozilla/gecko-dev.git
Routine merge of double branches.
This commit is contained in:
Коммит
dcd1221ca9
|
@ -65,33 +65,33 @@ Function.prototype.async = Async.sugar;
|
||||||
* Well not yet, but it will :)
|
* Well not yet, but it will :)
|
||||||
*/
|
*/
|
||||||
function Tracker() {
|
function Tracker() {
|
||||||
this._init();
|
this._init();
|
||||||
}
|
}
|
||||||
Tracker.prototype = {
|
Tracker.prototype = {
|
||||||
_logName: "Tracker",
|
_logName: "Tracker",
|
||||||
_score: 0,
|
_score: 0,
|
||||||
|
|
||||||
_init: function T__init() {
|
_init: function T__init() {
|
||||||
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||||
this._score = 0;
|
this._score = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Should be called by service periodically
|
/* Should be called by service periodically
|
||||||
* before deciding which engines to sync
|
* before deciding which engines to sync
|
||||||
*/
|
*/
|
||||||
get score() {
|
get score() {
|
||||||
if (this._score >= 100)
|
if (this._score >= 100)
|
||||||
return 100;
|
return 100;
|
||||||
else
|
else
|
||||||
return this._score;
|
return this._score;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Should be called by service everytime a sync
|
/* Should be called by service everytime a sync
|
||||||
* has been done for an engine
|
* has been done for an engine
|
||||||
*/
|
*/
|
||||||
resetScore: function T_resetScore() {
|
resetScore: function T_resetScore() {
|
||||||
this._score = 0;
|
this._score = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -138,7 +138,9 @@ BookmarksTracker.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function BMT__init() {
|
_init: function BMT__init() {
|
||||||
super._init();
|
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||||
|
this._score = 0;
|
||||||
|
|
||||||
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
|
||||||
getService(Ci.nsINavBookmarksService).
|
getService(Ci.nsINavBookmarksService).
|
||||||
addObserver(this, false);
|
addObserver(this, false);
|
||||||
|
@ -185,7 +187,9 @@ HistoryTracker.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function HT__init() {
|
_init: function HT__init() {
|
||||||
super._init();
|
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||||
|
this._score = 0;
|
||||||
|
|
||||||
Cc["@mozilla.org/browser/nav-history-service;1"].
|
Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||||
getService(Ci.nsINavHistoryService).
|
getService(Ci.nsINavHistoryService).
|
||||||
addObserver(this, false);
|
addObserver(this, false);
|
||||||
|
@ -234,7 +238,7 @@ FormsTracker.prototype = {
|
||||||
var count = stmnt.getInt32(0);
|
var count = stmnt.getInt32(0);
|
||||||
stmnt.reset();
|
stmnt.reset();
|
||||||
|
|
||||||
this._score = abs(this._rowCount - count) * 2;
|
this._score = Math.abs(this._rowCount - count) * 2;
|
||||||
|
|
||||||
if (this._score >= 100)
|
if (this._score >= 100)
|
||||||
return 100;
|
return 100;
|
||||||
|
@ -247,12 +251,12 @@ FormsTracker.prototype = {
|
||||||
stmnt.executeStep();
|
stmnt.executeStep();
|
||||||
this._rowCount = stmnt.getInt32(0);
|
this._rowCount = stmnt.getInt32(0);
|
||||||
stmnt.reset();
|
stmnt.reset();
|
||||||
|
this._score = 0;
|
||||||
super.resetScore();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_init: function FormsTracker__init() {
|
_init: function FormsTracker__init() {
|
||||||
super._init();
|
this._log = Log4Moz.Service.getLogger("Service." + this._logName);
|
||||||
|
this._score = 0;
|
||||||
|
|
||||||
var stmnt = this._formDB.createStatement("SELECT COUNT(fieldname) FROM moz_formhistory");
|
var stmnt = this._formDB.createStatement("SELECT COUNT(fieldname) FROM moz_formhistory");
|
||||||
stmnt.executeStep();
|
stmnt.executeStep();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче