Commit 2145acc9 authored by primiano's avatar primiano Committed by Commit bot

[memory-inspector] Fix zygote wrapper script and UI scrolling

This is a minor fix to the Zygote wrapper script (for full profiles).
Furthermore, this adds a workaround to a recent regression of the
Google Data Table UI (https://goo.gl/TXr3vL) which was causing the
Memory Inspector UI to forget its scroll position every couple of
seconds.

BUG=

Review URL: https://codereview.chromium.org/1138523003

Cr-Commit-Position: refs/heads/master@{#329666}
parent d891c769
...@@ -234,7 +234,7 @@ class AndroidDevice(backends.Device): ...@@ -234,7 +234,7 @@ class AndroidDevice(backends.Device):
wrapper_file.write('#!/system/bin/sh\n' wrapper_file.write('#!/system/bin/sh\n'
'LD_PRELOAD="libheap_profiler.so:$LD_PRELOAD" ' 'LD_PRELOAD="libheap_profiler.so:$LD_PRELOAD" '
'exec %s.real "$@"\n' % app_process) 'exec %s.real "$@"\n' % app_process)
wrapper_file.close() wrapper_file.flush()
self.adb.Push(wrapper_file.name, app_process) self.adb.Push(wrapper_file.name, app_process)
self.adb.Shell(['chown', 'root.shell', app_process]) self.adb.Shell(['chown', 'root.shell', app_process])
self.adb.Shell(['chmod', '755', app_process]) self.adb.Shell(['chmod', '755', app_process])
......
...@@ -46,6 +46,8 @@ this.onDomReady_ = function() { ...@@ -46,6 +46,8 @@ this.onDomReady_ = function() {
this.psTable_ = new google.visualization.Table($('#ps-table')[0]); this.psTable_ = new google.visualization.Table($('#ps-table')[0]);
google.visualization.events.addListener( google.visualization.events.addListener(
this.psTable_, 'select', this.onPsTableRowSelect_.bind(this)); this.psTable_, 'select', this.onPsTableRowSelect_.bind(this));
google.visualization.events.addListener(
this.psTable_, 'ready', this.onPsTableRedrawn_.bind(this));
$('#ps-table').on('dblclick', this.snapshotSelectedProcess_.bind(this)); $('#ps-table').on('dblclick', this.snapshotSelectedProcess_.bind(this));
// Create the device stats charts. // Create the device stats charts.
...@@ -199,6 +201,10 @@ this.onPsTableRowSelect_ = function() { ...@@ -199,6 +201,10 @@ this.onPsTableRowSelect_ = function() {
this.startSelectedProcessStats(); this.startSelectedProcessStats();
}; };
this.onPsTableRedrawn_ = function() {
rootUi.restoreScrollPosition();
};
this.onPsAjaxResponse_ = function(data) { this.onPsAjaxResponse_ = function(data) {
this.psTableData_ = new google.visualization.DataTable(data); this.psTableData_ = new google.visualization.DataTable(data);
this.redrawPsTable_(); this.redrawPsTable_();
...@@ -210,6 +216,7 @@ this.redrawPsTable_ = function(data) { ...@@ -210,6 +216,7 @@ this.redrawPsTable_ = function(data) {
// Redraw table preserving sorting info. // Redraw table preserving sorting info.
var sort = this.psTable_.getSortInfo() || {column: -1, ascending: false}; var sort = this.psTable_.getSortInfo() || {column: -1, ascending: false};
rootUi.saveScrollPosition();
this.psTable_.draw(this.psTableData_, {sortColumn: sort.column, this.psTable_.draw(this.psTableData_, {sortColumn: sort.column,
sortAscending: sort.ascending}); sortAscending: sort.ascending});
}; };
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
rootUi = new (function() { rootUi = new (function() {
this.savedScrollTop_ = 0;
this.onDomReady_ = function() { this.onDomReady_ = function() {
$('#js_loading_banner').hide(); $('#js_loading_banner').hide();
$('#tabs').tabs({activate: this.onTabChange_.bind(this)}); $('#tabs').tabs({activate: this.onTabChange_.bind(this)});
...@@ -84,6 +86,15 @@ this.onServerUnreachableOrTimeout = function() { ...@@ -84,6 +86,15 @@ this.onServerUnreachableOrTimeout = function() {
'It probably crashed, Check the terminal output.'); 'It probably crashed, Check the terminal output.');
}; };
// Sad hack required to work around a Google Table bug (goo.gl/TXr3vL).
this.saveScrollPosition = function() {
this.savedScrollTop_ = $('#wrapper').scrollTop();
};
this.restoreScrollPosition = function() {
$('#wrapper').scrollTop(this.savedScrollTop_);
};
$(document).ready(this.onDomReady_.bind(this)); $(document).ready(this.onDomReady_.bind(this));
})(); })();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment