| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 runOnWindowLoad(this._loaded.bind(this)); | 40 runOnWindowLoad(this._loaded.bind(this)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @param {boolean} hard | 44 * @param {boolean} hard |
| 45 */ | 45 */ |
| 46 static _reloadPage(hard) { | 46 static _reloadPage(hard) { |
| 47 SDK.ResourceTreeModel.reloadAllPages(hard); | 47 SDK.ResourceTreeModel.reloadAllPages(hard); |
| 48 } | 48 } |
| 49 | 49 |
| 50 /** |
| 51 * @param {string} label |
| 52 */ |
| 53 static time(label) { |
| 54 if (Host.isUnderTest()) |
| 55 return; |
| 56 console.time(label); |
| 57 } |
| 58 |
| 59 /** |
| 60 * @param {string} label |
| 61 */ |
| 62 static timeEnd(label) { |
| 63 if (Host.isUnderTest()) |
| 64 return; |
| 65 console.timeEnd(label); |
| 66 } |
| 67 |
| 50 _loaded() { | 68 _loaded() { |
| 51 console.timeStamp('Main._loaded'); | 69 console.timeStamp('Main._loaded'); |
| 52 Runtime.setPlatform(Host.platform()); | 70 Runtime.setPlatform(Host.platform()); |
| 53 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); | 71 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); |
| 54 } | 72 } |
| 55 | 73 |
| 56 /** | 74 /** |
| 57 * @param {!Object<string, string>} prefs | 75 * @param {!Object<string, string>} prefs |
| 58 */ | 76 */ |
| 59 _gotPreferences(prefs) { | 77 _gotPreferences(prefs) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 Runtime.experiments.setDefaultExperiments([ | 160 Runtime.experiments.setDefaultExperiments([ |
| 143 'continueToLocationMarkers', 'autoAttachToCrossProcessSubframes', 'objectP
reviews', 'audits2', | 161 'continueToLocationMarkers', 'autoAttachToCrossProcessSubframes', 'objectP
reviews', 'audits2', |
| 144 'networkGroupingRequests', 'timelineColorByProduct' | 162 'networkGroupingRequests', 'timelineColorByProduct' |
| 145 ]); | 163 ]); |
| 146 } | 164 } |
| 147 | 165 |
| 148 /** | 166 /** |
| 149 * @suppressGlobalPropertiesCheck | 167 * @suppressGlobalPropertiesCheck |
| 150 */ | 168 */ |
| 151 _createAppUI() { | 169 _createAppUI() { |
| 152 console.time('Main._createAppUI'); | 170 Main.Main.time('Main._createAppUI'); |
| 153 | 171 |
| 154 UI.viewManager = new UI.ViewManager(); | 172 UI.viewManager = new UI.ViewManager(); |
| 155 | 173 |
| 156 // Request filesystems early, we won't create connections until callback is
fired. Things will happen in parallel. | 174 // Request filesystems early, we won't create connections until callback is
fired. Things will happen in parallel. |
| 157 Persistence.isolatedFileSystemManager = new Persistence.IsolatedFileSystemMa
nager(); | 175 Persistence.isolatedFileSystemManager = new Persistence.IsolatedFileSystemMa
nager(); |
| 158 | 176 |
| 159 var themeSetting = Common.settings.createSetting('uiTheme', 'default'); | 177 var themeSetting = Common.settings.createSetting('uiTheme', 'default'); |
| 160 UI.initializeUIUtils(document, themeSetting); | 178 UI.initializeUIUtils(document, themeSetting); |
| 161 themeSetting.addChangeListener(Components.reload.bind(Components)); | 179 themeSetting.addChangeListener(Components.reload.bind(Components)); |
| 162 | 180 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 new Main.SourcesPanelIndicator(); | 229 new Main.SourcesPanelIndicator(); |
| 212 new Main.BackendSettingsSync(); | 230 new Main.BackendSettingsSync(); |
| 213 | 231 |
| 214 UI.actionRegistry = new UI.ActionRegistry(); | 232 UI.actionRegistry = new UI.ActionRegistry(); |
| 215 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); | 233 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); |
| 216 UI.ShortcutsScreen.registerShortcuts(); | 234 UI.ShortcutsScreen.registerShortcuts(); |
| 217 this._registerForwardedShortcuts(); | 235 this._registerForwardedShortcuts(); |
| 218 this._registerMessageSinkListener(); | 236 this._registerMessageSinkListener(); |
| 219 | 237 |
| 220 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b
ind(this)); | 238 self.runtime.extension(Common.AppProvider).instance().then(this._showAppUI.b
ind(this)); |
| 221 console.timeEnd('Main._createAppUI'); | 239 Main.Main.timeEnd('Main._createAppUI'); |
| 222 } | 240 } |
| 223 | 241 |
| 224 /** | 242 /** |
| 225 * @param {!Object} appProvider | 243 * @param {!Object} appProvider |
| 226 * @suppressGlobalPropertiesCheck | 244 * @suppressGlobalPropertiesCheck |
| 227 */ | 245 */ |
| 228 _showAppUI(appProvider) { | 246 _showAppUI(appProvider) { |
| 229 console.time('Main._showAppUI'); | 247 Main.Main.time('Main._showAppUI'); |
| 230 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp(); | 248 var app = /** @type {!Common.AppProvider} */ (appProvider).createApp(); |
| 231 // It is important to kick controller lifetime after apps are instantiated. | 249 // It is important to kick controller lifetime after apps are instantiated. |
| 232 Components.dockController.initialize(); | 250 Components.dockController.initialize(); |
| 233 app.presentUI(document); | 251 app.presentUI(document); |
| 234 | 252 |
| 235 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme
nt-search'); | 253 var toggleSearchNodeAction = UI.actionRegistry.action('elements.toggle-eleme
nt-search'); |
| 236 // TODO: we should not access actions from other modules. | 254 // TODO: we should not access actions from other modules. |
| 237 if (toggleSearchNodeAction) { | 255 if (toggleSearchNodeAction) { |
| 238 InspectorFrontendHost.events.addEventListener( | 256 InspectorFrontendHost.events.addEventListener( |
| 239 InspectorFrontendHostAPI.Events.EnterInspectElementMode, | 257 InspectorFrontendHostAPI.Events.EnterInspectElementMode, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 258 /** | 276 /** |
| 259 * @param {string} value | 277 * @param {string} value |
| 260 * @param {!Common.QueryParamHandler} handler | 278 * @param {!Common.QueryParamHandler} handler |
| 261 */ | 279 */ |
| 262 function handleQueryParam(value, handler) { | 280 function handleQueryParam(value, handler) { |
| 263 handler.handleQueryParam(value); | 281 handler.handleQueryParam(value); |
| 264 } | 282 } |
| 265 | 283 |
| 266 // Allow UI cycles to repaint prior to creating connection. | 284 // Allow UI cycles to repaint prior to creating connection. |
| 267 setTimeout(this._initializeTarget.bind(this), 0); | 285 setTimeout(this._initializeTarget.bind(this), 0); |
| 268 console.timeEnd('Main._showAppUI'); | 286 Main.Main.timeEnd('Main._showAppUI'); |
| 269 } | 287 } |
| 270 | 288 |
| 271 _initializeTarget() { | 289 _initializeTarget() { |
| 272 console.time('Main._initializeTarget'); | 290 Main.Main.time('Main._initializeTarget'); |
| 273 SDK.targetManager.connectToMainTarget(webSocketConnectionLost); | 291 SDK.targetManager.connectToMainTarget(webSocketConnectionLost); |
| 274 | 292 |
| 275 InspectorFrontendHost.readyForTest(); | 293 InspectorFrontendHost.readyForTest(); |
| 276 // Asynchronously run the extensions. | 294 // Asynchronously run the extensions. |
| 277 setTimeout(this._lateInitialization.bind(this), 100); | 295 setTimeout(this._lateInitialization.bind(this), 100); |
| 278 console.timeEnd('Main._initializeTarget'); | 296 Main.Main.timeEnd('Main._initializeTarget'); |
| 279 | 297 |
| 280 function webSocketConnectionLost() { | 298 function webSocketConnectionLost() { |
| 281 if (!Main._disconnectedScreenWithReasonWasShown) | 299 if (!Main._disconnectedScreenWithReasonWasShown) |
| 282 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected'); | 300 Main.RemoteDebuggingTerminatedScreen.show('WebSocket disconnected'); |
| 283 } | 301 } |
| 284 } | 302 } |
| 285 | 303 |
| 286 _lateInitialization() { | 304 _lateInitialization() { |
| 287 console.timeStamp('Main._lateInitialization'); | 305 console.timeStamp('Main._lateInitialization'); |
| 288 this._registerShortcuts(); | 306 this._registerShortcuts(); |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 * @override | 1002 * @override |
| 985 * @return {?Element} | 1003 * @return {?Element} |
| 986 */ | 1004 */ |
| 987 settingElement() { | 1005 settingElement() { |
| 988 return UI.SettingsUI.createSettingCheckbox( | 1006 return UI.SettingsUI.createSettingCheckbox( |
| 989 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); | 1007 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); |
| 990 } | 1008 } |
| 991 }; | 1009 }; |
| 992 | 1010 |
| 993 new Main.Main(); | 1011 new Main.Main(); |
| OLD | NEW |