| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 const UserInitiatedProfileName = "org.webkit.profiles.user-initiated"; | |
| 27 | |
| 28 /** | 26 /** |
| 29 * @constructor | 27 * @constructor |
| 30 * @extends {WebInspector.Object} | 28 * @extends {WebInspector.Object} |
| 31 * @param {string} id | 29 * @param {string} id |
| 32 * @param {string} name | 30 * @param {string} name |
| 33 */ | 31 */ |
| 34 WebInspector.ProfileType = function(id, name) | 32 WebInspector.ProfileType = function(id, name) |
| 35 { | 33 { |
| 36 this._id = id; | 34 this._id = id; |
| 37 this._name = name; | 35 this._name = name; |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 } | 504 } |
| 507 WebInspector.log(WebInspector.UIString("Can't load file. Only files
with extensions '%s' can be loaded.", extensions.join("', '"))); | 505 WebInspector.log(WebInspector.UIString("Can't load file. Only files
with extensions '%s' can be loaded.", extensions.join("', '"))); |
| 508 return; | 506 return; |
| 509 } | 507 } |
| 510 | 508 |
| 511 if (!!profileType.findTemporaryProfile()) { | 509 if (!!profileType.findTemporaryProfile()) { |
| 512 WebInspector.log(WebInspector.UIString("Can't load profile when othe
r profile is recording.")); | 510 WebInspector.log(WebInspector.UIString("Can't load profile when othe
r profile is recording.")); |
| 513 return; | 511 return; |
| 514 } | 512 } |
| 515 | 513 |
| 516 var temporaryProfile = profileType.createTemporaryProfile(WebInspector.P
rofilesPanelDescriptor.UserInitiatedProfileName + "." + file.name); | 514 var name = file.name; |
| 515 if (name.endsWith(profileType.fileExtension())) |
| 516 name = name.substr(0, name.length - profileType.fileExtension().leng
th); |
| 517 var temporaryProfile = profileType.createTemporaryProfile(name); |
| 517 temporaryProfile.setFromFile(); | 518 temporaryProfile.setFromFile(); |
| 518 profileType.addProfile(temporaryProfile); | 519 profileType.addProfile(temporaryProfile); |
| 519 temporaryProfile.loadFromFile(file); | 520 temporaryProfile.loadFromFile(file); |
| 520 }, | 521 }, |
| 521 | 522 |
| 522 get statusBarItems() | 523 get statusBarItems() |
| 523 { | 524 { |
| 524 return this._statusBarButtons.select("element").concat(this._profileType
StatusBarItemsContainer, this._profileViewStatusBarItemsContainer); | 525 return this._statusBarButtons.select("element").concat(this._profileType
StatusBarItemsContainer, this._profileViewStatusBarItemsContainer); |
| 525 }, | 526 }, |
| 526 | 527 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 */ | 695 */ |
| 695 _addProfileHeader: function(profile) | 696 _addProfileHeader: function(profile) |
| 696 { | 697 { |
| 697 var profileType = profile.profileType(); | 698 var profileType = profile.profileType(); |
| 698 var typeId = profileType.id; | 699 var typeId = profileType.id; |
| 699 var sidebarParent = profileType.treeElement; | 700 var sidebarParent = profileType.treeElement; |
| 700 sidebarParent.hidden = false; | 701 sidebarParent.hidden = false; |
| 701 var small = false; | 702 var small = false; |
| 702 var alternateTitle; | 703 var alternateTitle; |
| 703 | 704 |
| 704 if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile
.title) && !profile.isTemporary) { | 705 if (!profile.fromFile() && !profile.isTemporary) { |
| 705 var profileTitleKey = this._makeTitleKey(profile.title, typeId); | 706 var profileTitleKey = this._makeTitleKey(profile.title, typeId); |
| 706 if (!(profileTitleKey in this._profileGroups)) | 707 if (!(profileTitleKey in this._profileGroups)) |
| 707 this._profileGroups[profileTitleKey] = []; | 708 this._profileGroups[profileTitleKey] = []; |
| 708 | 709 |
| 709 var group = this._profileGroups[profileTitleKey]; | 710 var group = this._profileGroups[profileTitleKey]; |
| 710 group.push(profile); | 711 group.push(profile); |
| 711 if (group.length === 2) { | 712 if (group.length === 2) { |
| 712 // Make a group TreeElement now that there are 2 profiles. | 713 // Make a group TreeElement now that there are 2 profiles. |
| 713 group._profilesTreeElement = new WebInspector.ProfileGroupSideba
rTreeElement(this, profile.title); | 714 group._profilesTreeElement = new WebInspector.ProfileGroupSideba
rTreeElement(this, profile.title); |
| 714 | 715 |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 * @constructor | 1224 * @constructor |
| 1224 * @extends {WebInspector.SidebarTreeElement} | 1225 * @extends {WebInspector.SidebarTreeElement} |
| 1225 * @param {!WebInspector.ProfileHeader} profile | 1226 * @param {!WebInspector.ProfileHeader} profile |
| 1226 * @param {string} titleFormat | 1227 * @param {string} titleFormat |
| 1227 * @param {string} className | 1228 * @param {string} className |
| 1228 */ | 1229 */ |
| 1229 WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, classNam
e) | 1230 WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, classNam
e) |
| 1230 { | 1231 { |
| 1231 this.profile = profile; | 1232 this.profile = profile; |
| 1232 this._titleFormat = titleFormat; | 1233 this._titleFormat = titleFormat; |
| 1233 | |
| 1234 if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile
.title)) | |
| 1235 this._profileNumber = WebInspector.ProfilesPanelDescriptor.userInitiated
ProfileIndex(this.profile.title); | |
| 1236 | |
| 1237 WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false
); | 1234 WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false
); |
| 1238 | |
| 1239 this.refreshTitles(); | 1235 this.refreshTitles(); |
| 1240 } | 1236 } |
| 1241 | 1237 |
| 1242 WebInspector.ProfileSidebarTreeElement.prototype = { | 1238 WebInspector.ProfileSidebarTreeElement.prototype = { |
| 1243 onselect: function() | 1239 onselect: function() |
| 1244 { | 1240 { |
| 1245 if (!this._suppressOnSelect) | 1241 if (!this._suppressOnSelect) |
| 1246 this.treeOutline.panel._showProfile(this.profile); | 1242 this.treeOutline.panel._showProfile(this.profile); |
| 1247 }, | 1243 }, |
| 1248 | 1244 |
| 1249 ondelete: function() | 1245 ondelete: function() |
| 1250 { | 1246 { |
| 1251 this.treeOutline.panel._removeProfileHeader(this.profile); | 1247 this.treeOutline.panel._removeProfileHeader(this.profile); |
| 1252 return true; | 1248 return true; |
| 1253 }, | 1249 }, |
| 1254 | 1250 |
| 1255 get mainTitle() | 1251 get mainTitle() |
| 1256 { | 1252 { |
| 1257 if (this._mainTitle) | 1253 if (this._mainTitle) |
| 1258 return this._mainTitle; | 1254 return this._mainTitle; |
| 1259 if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.pro
file.title)) | |
| 1260 return WebInspector.UIString(this._titleFormat, this._profileNumber)
; | |
| 1261 return this.profile.title; | 1255 return this.profile.title; |
| 1262 }, | 1256 }, |
| 1263 | 1257 |
| 1264 set mainTitle(x) | 1258 set mainTitle(x) |
| 1265 { | 1259 { |
| 1266 this._mainTitle = x; | 1260 this._mainTitle = x; |
| 1267 this.refreshTitles(); | 1261 this.refreshTitles(); |
| 1268 }, | 1262 }, |
| 1269 | 1263 |
| 1270 set searchMatches(matches) | 1264 set searchMatches(matches) |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 importScript("HeapSnapshotGridNodes.js"); | 1407 importScript("HeapSnapshotGridNodes.js"); |
| 1414 importScript("HeapSnapshotLoader.js"); | 1408 importScript("HeapSnapshotLoader.js"); |
| 1415 importScript("HeapSnapshotProxy.js"); | 1409 importScript("HeapSnapshotProxy.js"); |
| 1416 importScript("HeapSnapshotView.js"); | 1410 importScript("HeapSnapshotView.js"); |
| 1417 importScript("HeapSnapshotWorkerDispatcher.js"); | 1411 importScript("HeapSnapshotWorkerDispatcher.js"); |
| 1418 importScript("JSHeapSnapshot.js"); | 1412 importScript("JSHeapSnapshot.js"); |
| 1419 importScript("ProfileLauncherView.js"); | 1413 importScript("ProfileLauncherView.js"); |
| 1420 importScript("TopDownProfileDataGridTree.js"); | 1414 importScript("TopDownProfileDataGridTree.js"); |
| 1421 importScript("CanvasProfileView.js"); | 1415 importScript("CanvasProfileView.js"); |
| 1422 importScript("CanvasReplayStateView.js"); | 1416 importScript("CanvasReplayStateView.js"); |
| OLD | NEW |