OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * | 10 * |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 } | 46 } |
47 | 47 |
48 WebInspector.ProfilesPanelDescriptor.ShortcutKeys = { | 48 WebInspector.ProfilesPanelDescriptor.ShortcutKeys = { |
49 StartStopRecording: [ | 49 StartStopRecording: [ |
50 WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardS
hortcut.Modifiers.CtrlOrMeta) | 50 WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardS
hortcut.Modifiers.CtrlOrMeta) |
51 ] | 51 ] |
52 } | 52 } |
53 | 53 |
54 WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp = /webkit-profile:\/\/(.+)
\/(.+)/; | 54 WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp = /webkit-profile:\/\/(.+)
\/(.+)/; |
55 | 55 |
56 WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName = "org.webkit.prof
iles.user-initiated"; | |
57 | |
58 /** | |
59 * @param {string} title | |
60 * @return {boolean} | |
61 */ | |
62 WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile = function(title) | |
63 { | |
64 return title.startsWith(WebInspector.ProfilesPanelDescriptor.UserInitiatedPr
ofileName); | |
65 } | |
66 | |
67 /** | |
68 * @param {string} title | |
69 * @return {number} | |
70 * @throws {string} | |
71 */ | |
72 WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex = function(title) | |
73 { | |
74 if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) | |
75 throw "Not user-initiated profile title."; | |
76 var suffix = title.substring(WebInspector.ProfilesPanelDescriptor.UserInitia
tedProfileName.length + 1); | |
77 return parseInt(suffix, 10); | |
78 } | |
79 | |
80 /** | 56 /** |
81 * @param {string} title | 57 * @param {string} title |
82 * @return {string} | 58 * @return {string} |
83 */ | 59 */ |
84 WebInspector.ProfilesPanelDescriptor.resolveProfileTitle = function(title) | 60 WebInspector.ProfilesPanelDescriptor.resolveProfileTitle = function(title) |
85 { | 61 { |
86 if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) | 62 return title; |
87 return title; | |
88 return WebInspector.UIString("Profile %d", WebInspector.ProfilesPanelDescrip
tor.userInitiatedProfileIndex(title)); | |
89 } | 63 } |
90 | 64 |
91 /** | 65 /** |
92 * @param {Event} event | 66 * @param {Event} event |
93 */ | 67 */ |
94 WebInspector.ProfilesPanelDescriptor._openCPUProfile = function(event) | 68 WebInspector.ProfilesPanelDescriptor._openCPUProfile = function(event) |
95 { | 69 { |
96 event.preventDefault(); | 70 event.preventDefault(); |
97 var panel = WebInspector.showPanel("profiles"); | 71 var panel = WebInspector.showPanel("profiles"); |
98 var link = /** @type {!Element} */ (event.target); | 72 var link = /** @type {!Element} */ (event.target); |
(...skipping 19 matching lines...) Expand all Loading... |
118 link.href = WebInspector.UIString("show CPU profile"); | 92 link.href = WebInspector.UIString("show CPU profile"); |
119 link.target = "_blank"; | 93 link.target = "_blank"; |
120 if (tooltipText) | 94 if (tooltipText) |
121 link.title = tooltipText; | 95 link.title = tooltipText; |
122 link.timeLeft = timeLeft; | 96 link.timeLeft = timeLeft; |
123 link.timeRight = timeRight; | 97 link.timeRight = timeRight; |
124 link.profileUID = uid; | 98 link.profileUID = uid; |
125 link.addEventListener("click", WebInspector.ProfilesPanelDescriptor._openCPU
Profile, true); | 99 link.addEventListener("click", WebInspector.ProfilesPanelDescriptor._openCPU
Profile, true); |
126 return link; | 100 return link; |
127 } | 101 } |
OLD | NEW |