| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 var g_browserBridge; | 5 var g_browserBridge; | 
| 6 var g_mainView; | 6 var g_mainView; | 
| 7 | 7 | 
| 8 // TODO(eroman): The handling of "max" across snapshots is not correct. | 8 // TODO(eroman): The handling of "max" across snapshots is not correct. | 
| 9 // For starters the browser needs to be aware to generate new maximums. | 9 // For starters the browser needs to be aware to generate new maximums. | 
| 10 // Secondly, we need to take into account the "max" of intermediary snapshots, | 10 // Secondly, we need to take into account the "max" of intermediary snapshots, | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 35 | 35 | 
| 36   BrowserBridge.prototype = { | 36   BrowserBridge.prototype = { | 
| 37     //-------------------------------------------------------------------------- | 37     //-------------------------------------------------------------------------- | 
| 38     // Messages sent to the browser | 38     // Messages sent to the browser | 
| 39     //-------------------------------------------------------------------------- | 39     //-------------------------------------------------------------------------- | 
| 40 | 40 | 
| 41     sendGetData: function() { | 41     sendGetData: function() { | 
| 42       chrome.send('getData'); | 42       chrome.send('getData'); | 
| 43     }, | 43     }, | 
| 44 | 44 | 
| 45     sendResetData: function() { |  | 
| 46       chrome.send('resetData'); |  | 
| 47     }, |  | 
| 48 |  | 
| 49     //-------------------------------------------------------------------------- | 45     //-------------------------------------------------------------------------- | 
| 50     // Messages received from the browser. | 46     // Messages received from the browser. | 
| 51     //-------------------------------------------------------------------------- | 47     //-------------------------------------------------------------------------- | 
| 52 | 48 | 
| 53     receivedData: function(data) { | 49     receivedData: function(data) { | 
| 54       // TODO(eroman): The browser should give an indication of which snapshot | 50       // TODO(eroman): The browser should give an indication of which snapshot | 
| 55       // this data belongs to. For now we always assume it is for the latest. | 51       // this data belongs to. For now we always assume it is for the latest. | 
| 56       g_mainView.addDataToSnapshot(data); | 52       g_mainView.addDataToSnapshot(data); | 
| 57     }, | 53     }, | 
| 58   }; | 54   }; | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 92   // The anchor which toggles visibility of column checkboxes. | 88   // The anchor which toggles visibility of column checkboxes. | 
| 93   var EDIT_COLUMNS_LINK_ID = 'edit-columns-link'; | 89   var EDIT_COLUMNS_LINK_ID = 'edit-columns-link'; | 
| 94 | 90 | 
| 95   // The container node to show/hide when toggling the column checkboxes. | 91   // The container node to show/hide when toggling the column checkboxes. | 
| 96   var EDIT_COLUMNS_ROW = 'edit-columns-row'; | 92   var EDIT_COLUMNS_ROW = 'edit-columns-row'; | 
| 97 | 93 | 
| 98   // The checkbox which controls whether things like "Worker Threads" and | 94   // The checkbox which controls whether things like "Worker Threads" and | 
| 99   // "PAC threads" will be merged together. | 95   // "PAC threads" will be merged together. | 
| 100   var MERGE_SIMILAR_THREADS_CHECKBOX_ID = 'merge-similar-threads-checkbox'; | 96   var MERGE_SIMILAR_THREADS_CHECKBOX_ID = 'merge-similar-threads-checkbox'; | 
| 101 | 97 | 
| 102   var RESET_DATA_LINK_ID = 'reset-data-link'; |  | 
| 103 |  | 
| 104   var TOGGLE_SNAPSHOTS_LINK_ID = 'snapshots-link'; | 98   var TOGGLE_SNAPSHOTS_LINK_ID = 'snapshots-link'; | 
| 105   var SNAPSHOTS_ROW = 'snapshots-row'; | 99   var SNAPSHOTS_ROW = 'snapshots-row'; | 
| 106   var SNAPSHOT_SELECTION_SUMMARY_ID = 'snapshot-selection-summary'; | 100   var SNAPSHOT_SELECTION_SUMMARY_ID = 'snapshot-selection-summary'; | 
| 107   var TAKE_SNAPSHOT_BUTTON_ID = 'take-snapshot-button'; | 101   var TAKE_SNAPSHOT_BUTTON_ID = 'take-snapshot-button'; | 
| 108 | 102 | 
| 109   var SAVE_SNAPSHOTS_BUTTON_ID = 'save-snapshots-button'; | 103   var SAVE_SNAPSHOTS_BUTTON_ID = 'save-snapshots-button'; | 
| 110   var SNAPSHOT_FILE_LOADER_ID = 'snapshot-file-loader'; | 104   var SNAPSHOT_FILE_LOADER_ID = 'snapshot-file-loader'; | 
| 111   var LOAD_ERROR_ID = 'file-load-error'; | 105   var LOAD_ERROR_ID = 'file-load-error'; | 
| 112 | 106 | 
| 113   var DOWNLOAD_ANCHOR_ID = 'download-anchor'; | 107   var DOWNLOAD_ANCHOR_ID = 'download-anchor'; | 
| (...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 898     if (mergeSimilarThreads) { | 892     if (mergeSimilarThreads) { | 
| 899       propertyGetterFunc = function(row, key) { | 893       propertyGetterFunc = function(row, key) { | 
| 900         var value = row[key]; | 894         var value = row[key]; | 
| 901         // If the property is a thread name, try to remap it. | 895         // If the property is a thread name, try to remap it. | 
| 902         if (key == KEY_BIRTH_THREAD || key == KEY_DEATH_THREAD) { | 896         if (key == KEY_BIRTH_THREAD || key == KEY_DEATH_THREAD) { | 
| 903           var m = /^(.*[^\d])(\d+)$/.exec(value); | 897           var m = /^(.*[^\d])(\d+)$/.exec(value); | 
| 904           if (m) | 898           if (m) | 
| 905             value = m[1] + '*'; | 899             value = m[1] + '*'; | 
| 906         } | 900         } | 
| 907         return value; | 901         return value; | 
| 908       } | 902       }; | 
| 909     } else { | 903     } else { | 
| 910       propertyGetterFunc = function(row, key) { return row[key]; }; | 904       propertyGetterFunc = function(row, key) { return row[key]; }; | 
| 911     } | 905     } | 
| 912 | 906 | 
| 913     // Determine which sets of properties a row needs to match on to be | 907     // Determine which sets of properties a row needs to match on to be | 
| 914     // considered identical to another row. | 908     // considered identical to another row. | 
| 915     var identityKeys = IDENTITY_KEYS.slice(0); | 909     var identityKeys = IDENTITY_KEYS.slice(0); | 
| 916     deleteValuesFromArray(identityKeys, mergeKeys); | 910     deleteValuesFromArray(identityKeys, mergeKeys); | 
| 917 | 911 | 
| 918     // Set |aggregateKeys| to everything else, since we will be aggregating | 912     // Set |aggregateKeys| to everything else, since we will be aggregating | 
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1755 | 1749 | 
| 1756       $(EDIT_COLUMNS_LINK_ID).onclick = | 1750       $(EDIT_COLUMNS_LINK_ID).onclick = | 
| 1757           toggleNodeDisplay.bind(null, $(EDIT_COLUMNS_ROW)); | 1751           toggleNodeDisplay.bind(null, $(EDIT_COLUMNS_ROW)); | 
| 1758 | 1752 | 
| 1759       $(TOGGLE_SNAPSHOTS_LINK_ID).onclick = | 1753       $(TOGGLE_SNAPSHOTS_LINK_ID).onclick = | 
| 1760           toggleNodeDisplay.bind(null, $(SNAPSHOTS_ROW)); | 1754           toggleNodeDisplay.bind(null, $(SNAPSHOTS_ROW)); | 
| 1761 | 1755 | 
| 1762       $(MERGE_SIMILAR_THREADS_CHECKBOX_ID).onchange = | 1756       $(MERGE_SIMILAR_THREADS_CHECKBOX_ID).onchange = | 
| 1763           this.onMergeSimilarThreadsCheckboxChanged_.bind(this); | 1757           this.onMergeSimilarThreadsCheckboxChanged_.bind(this); | 
| 1764 | 1758 | 
| 1765       $(RESET_DATA_LINK_ID).onclick = |  | 
| 1766           g_browserBridge.sendResetData.bind(g_browserBridge); |  | 
| 1767 |  | 
| 1768       $(TAKE_SNAPSHOT_BUTTON_ID).onclick = this.takeSnapshot_.bind(this); | 1759       $(TAKE_SNAPSHOT_BUTTON_ID).onclick = this.takeSnapshot_.bind(this); | 
| 1769 | 1760 | 
| 1770       $(SAVE_SNAPSHOTS_BUTTON_ID).onclick = this.saveSnapshots_.bind(this); | 1761       $(SAVE_SNAPSHOTS_BUTTON_ID).onclick = this.saveSnapshots_.bind(this); | 
| 1771       $(SNAPSHOT_FILE_LOADER_ID).onchange = this.loadFileChanged_.bind(this); | 1762       $(SNAPSHOT_FILE_LOADER_ID).onchange = this.loadFileChanged_.bind(this); | 
| 1772     }, | 1763     }, | 
| 1773 | 1764 | 
| 1774     takeSnapshot_: function() { | 1765     takeSnapshot_: function() { | 
| 1775       // Start a new empty snapshot. Make note of the current time, so we know | 1766       // Start a new empty snapshot. Make note of the current time, so we know | 
| 1776       // when the snaphot was taken. | 1767       // when the snaphot was taken. | 
| 1777       this.snapshots_.push({flatData: [], origData: [], time: getTimeMillis()}); | 1768       this.snapshots_.push({flatData: [], origData: [], time: getTimeMillis()}); | 
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2214           groupKey.push(entry); | 2205           groupKey.push(entry); | 
| 2215         } | 2206         } | 
| 2216 | 2207 | 
| 2217         return JSON.stringify(groupKey); | 2208         return JSON.stringify(groupKey); | 
| 2218       }; | 2209       }; | 
| 2219     }, | 2210     }, | 
| 2220   }; | 2211   }; | 
| 2221 | 2212 | 
| 2222   return MainView; | 2213   return MainView; | 
| 2223 })(); | 2214 })(); | 
| OLD | NEW | 
|---|