lookingGlass: Remove Memory tab and add a gc Icon to toolbar
With js24 it won't be possible to access gjs memory stats from C code. https://bugzilla.gnome.org/show_bug.cgi?id=711052
This commit is contained in:
parent
7296bedd8e
commit
b929320d4c
@ -629,55 +629,6 @@ const Inspector = new Lang.Class({
|
|||||||
|
|
||||||
Signals.addSignalMethods(Inspector.prototype);
|
Signals.addSignalMethods(Inspector.prototype);
|
||||||
|
|
||||||
const Memory = new Lang.Class({
|
|
||||||
Name: 'Memory',
|
|
||||||
|
|
||||||
_init: function() {
|
|
||||||
this.actor = new St.BoxLayout({ vertical: true });
|
|
||||||
this._glibc_uordblks = new St.Label();
|
|
||||||
this.actor.add(this._glibc_uordblks);
|
|
||||||
|
|
||||||
this._js_bytes = new St.Label();
|
|
||||||
this.actor.add(this._js_bytes);
|
|
||||||
|
|
||||||
this._gjs_boxed = new St.Label();
|
|
||||||
this.actor.add(this._gjs_boxed);
|
|
||||||
|
|
||||||
this._gjs_gobject = new St.Label();
|
|
||||||
this.actor.add(this._gjs_gobject);
|
|
||||||
|
|
||||||
this._gjs_function = new St.Label();
|
|
||||||
this.actor.add(this._gjs_function);
|
|
||||||
|
|
||||||
this._gjs_closure = new St.Label();
|
|
||||||
this.actor.add(this._gjs_closure);
|
|
||||||
|
|
||||||
this._last_gc_seconds_ago = new St.Label();
|
|
||||||
this.actor.add(this._last_gc_seconds_ago);
|
|
||||||
|
|
||||||
this._gcbutton = new St.Button({ label: 'Full GC',
|
|
||||||
style_class: 'lg-obj-inspector-button' });
|
|
||||||
this._gcbutton.connect('clicked', Lang.bind(this, function () { System.gc(); this._renderText(); }));
|
|
||||||
this.actor.add(this._gcbutton, { x_align: St.Align.START,
|
|
||||||
x_fill: false });
|
|
||||||
|
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this, this._renderText));
|
|
||||||
},
|
|
||||||
|
|
||||||
_renderText: function() {
|
|
||||||
if (!this.actor.mapped)
|
|
||||||
return;
|
|
||||||
let memInfo = global.get_memory_info();
|
|
||||||
this._glibc_uordblks.text = 'glibc_uordblks: ' + memInfo.glibc_uordblks;
|
|
||||||
this._js_bytes.text = 'js bytes: ' + memInfo.js_bytes;
|
|
||||||
this._gjs_boxed.text = 'gjs_boxed: ' + memInfo.gjs_boxed;
|
|
||||||
this._gjs_gobject.text = 'gjs_gobject: ' + memInfo.gjs_gobject;
|
|
||||||
this._gjs_function.text = 'gjs_function: ' + memInfo.gjs_function;
|
|
||||||
this._gjs_closure.text = 'gjs_closure: ' + memInfo.gjs_closure;
|
|
||||||
this._last_gc_seconds_ago.text = 'last_gc_seconds_ago: ' + memInfo.last_gc_seconds_ago;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const Extensions = new Lang.Class({
|
const Extensions = new Lang.Class({
|
||||||
Name: 'Extensions',
|
Name: 'Extensions',
|
||||||
|
|
||||||
@ -880,6 +831,19 @@ const LookingGlass = new Lang.Class({
|
|||||||
return true;
|
return true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
let gcIcon = new St.Icon({ icon_name: 'gnome-fs-trash-full',
|
||||||
|
icon_size: 24 });
|
||||||
|
toolbar.add_actor(gcIcon);
|
||||||
|
gcIcon.reactive = true;
|
||||||
|
gcIcon.connect('button-press-event', Lang.bind(this, function () {
|
||||||
|
gcIcon.icon_name = 'gnome-fs-trash-empty';
|
||||||
|
System.gc();
|
||||||
|
this._timeoutId = Mainloop.timeout_add(500, Lang.bind(this, function () {
|
||||||
|
gcIcon.icon_name = 'gnome-fs-trash-full';
|
||||||
|
Mainloop.source_remove(this._timeoutId);
|
||||||
|
}));
|
||||||
|
}));
|
||||||
|
|
||||||
let notebook = new Notebook();
|
let notebook = new Notebook();
|
||||||
this._notebook = notebook;
|
this._notebook = notebook;
|
||||||
this.actor.add(notebook.actor, { expand: true });
|
this.actor.add(notebook.actor, { expand: true });
|
||||||
@ -907,9 +871,6 @@ const LookingGlass = new Lang.Class({
|
|||||||
this._windowList = new WindowList(this);
|
this._windowList = new WindowList(this);
|
||||||
notebook.appendPage('Windows', this._windowList.actor);
|
notebook.appendPage('Windows', this._windowList.actor);
|
||||||
|
|
||||||
this._memory = new Memory();
|
|
||||||
notebook.appendPage('Memory', this._memory.actor);
|
|
||||||
|
|
||||||
this._extensions = new Extensions(this);
|
this._extensions = new Extensions(this);
|
||||||
notebook.appendPage('Extensions', this._extensions.actor);
|
notebook.appendPage('Extensions', this._extensions.actor);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user