Limit dash docs to 50

We has poor performance if we try to allocate hundreds of actors;
a bit more ideally, we'd keep pulling as much as we can, but really
no one should have more than 50 in the list as is now except on
unreasonably large screen sizes.

In the future we should change this to be pull-on-demand thing
in a chunked fashion.

https://bugzilla.gnome.org/show_bug.cgi?id=603522
This commit is contained in:
Colin Walters 2009-12-07 21:48:31 -05:00
parent 949f67469c
commit a8d18ac18a

View File

@ -16,6 +16,7 @@ const DND = imports.ui.dnd;
const GenericDisplay = imports.ui.genericDisplay; const GenericDisplay = imports.ui.genericDisplay;
const Main = imports.ui.main; const Main = imports.ui.main;
const MAX_DASH_DOCS = 50;
const DASH_DOCS_ICON_SIZE = 16; const DASH_DOCS_ICON_SIZE = 16;
const DEFAULT_SPACING = 4; const DEFAULT_SPACING = 4;
@ -453,7 +454,7 @@ DashDocDisplay.prototype = {
// Should be kept alive by the _actorsByUri // Should be kept alive by the _actorsByUri
this.actor.remove_all(); this.actor.remove_all();
let docs = this._docManager.getTimestampOrderedInfos(); let docs = this._docManager.getTimestampOrderedInfos();
for (let i = 0; i < docs.length; i++) { for (let i = 0; i < docs.length && i < MAX_DASH_DOCS; i++) {
let doc = docs[i]; let doc = docs[i];
let display = this._actorsByUri[doc.uri]; let display = this._actorsByUri[doc.uri];
if (display) { if (display) {