Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: chrome/tools/test/reference_build/chrome_linux/resources/inspector/CallStackSidebarPane.js

Issue 177049: On Linux, move the passing of filedescriptors to a dedicated socketpair(). (Closed)
Patch Set: Removed *.d files from reference build Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 WebInspector.CallStackSidebarPane = function() 26 WebInspector.CallStackSidebarPane = function()
27 { 27 {
28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack")); 28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Call Stack"));
29
30 this._shortcuts = {};
31
32 var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardSh ortcut.KeyCodes.Period,
33 WebInspector.KeyboardSh ortcut.Modifiers.Ctrl);
34 this._shortcuts[shortcut] = this._selectNextCallFrameOnStack.bind(this);
35
36 var shortcut = WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardSh ortcut.KeyCodes.Comma,
37 WebInspector.KeyboardSh ortcut.Modifiers.Ctrl);
38 this._shortcuts[shortcut] = this._selectPreviousCallFrameOnStack.bind(this);
29 } 39 }
30 40
31 WebInspector.CallStackSidebarPane.prototype = { 41 WebInspector.CallStackSidebarPane.prototype = {
32 update: function(callFrame, sourceIDMap) 42 update: function(callFrames, sourceIDMap)
33 { 43 {
34 this.bodyElement.removeChildren(); 44 this.bodyElement.removeChildren();
35 45
36 this.placards = []; 46 this.placards = [];
37 delete this._selectedCallFrame; 47 delete this._selectedCallFrame;
38 48
39 if (!callFrame) { 49 if (!callFrames) {
40 var infoElement = document.createElement("div"); 50 var infoElement = document.createElement("div");
41 infoElement.className = "info"; 51 infoElement.className = "info";
42 infoElement.textContent = WebInspector.UIString("Not Paused"); 52 infoElement.textContent = WebInspector.UIString("Not Paused");
43 this.bodyElement.appendChild(infoElement); 53 this.bodyElement.appendChild(infoElement);
44 return; 54 return;
45 } 55 }
46 56
47 var title; 57 var title;
48 var subtitle; 58 var subtitle;
49 var scriptOrResource; 59 var scriptOrResource;
50 60
51 do { 61 for (var i = 0; i < callFrames.length; ++i) {
62 var callFrame = callFrames[i];
52 switch (callFrame.type) { 63 switch (callFrame.type) {
53 case "function": 64 case "function":
54 title = callFrame.functionName || WebInspector.UIString("(anonym ous function)"); 65 title = callFrame.functionName || WebInspector.UIString("(anonym ous function)");
55 break; 66 break;
56 case "program": 67 case "program":
57 title = WebInspector.UIString("(program)"); 68 title = WebInspector.UIString("(program)");
58 break; 69 break;
59 } 70 }
60 71
61 scriptOrResource = sourceIDMap[callFrame.sourceID]; 72 scriptOrResource = sourceIDMap[callFrame.sourceID];
62 subtitle = WebInspector.displayNameForURL(scriptOrResource.sourceURL || scriptOrResource.url); 73 subtitle = WebInspector.displayNameForURL(scriptOrResource.sourceURL || scriptOrResource.url);
63 74
64 if (callFrame.line > 0) { 75 if (callFrame.line > 0) {
65 if (subtitle) 76 if (subtitle)
66 subtitle += ":" + callFrame.line; 77 subtitle += ":" + callFrame.line;
67 else 78 else
68 subtitle = WebInspector.UIString("line %d", callFrame.line); 79 subtitle = WebInspector.UIString("line %d", callFrame.line);
69 } 80 }
70 81
71 var placard = new WebInspector.Placard(title, subtitle); 82 var placard = new WebInspector.Placard(title, subtitle);
72 placard.callFrame = callFrame; 83 placard.callFrame = callFrame;
73 84
74 placard.element.addEventListener("click", this._placardSelected.bind (this), false); 85 placard.element.addEventListener("click", this._placardSelected.bind (this), false);
75 86
76 this.placards.push(placard); 87 this.placards.push(placard);
77 this.bodyElement.appendChild(placard.element); 88 this.bodyElement.appendChild(placard.element);
78 89 }
79 callFrame = callFrame.caller;
80 } while (callFrame);
81 }, 90 },
82 91
83 get selectedCallFrame() 92 get selectedCallFrame()
84 { 93 {
85 return this._selectedCallFrame; 94 return this._selectedCallFrame;
86 }, 95 },
87 96
88 set selectedCallFrame(x) 97 set selectedCallFrame(x)
89 { 98 {
90 if (this._selectedCallFrame === x) 99 if (this._selectedCallFrame === x)
91 return; 100 return;
92 101
93 this._selectedCallFrame = x; 102 this._selectedCallFrame = x;
94 103
95 for (var i = 0; i < this.placards.length; ++i) { 104 for (var i = 0; i < this.placards.length; ++i) {
96 var placard = this.placards[i]; 105 var placard = this.placards[i];
97 placard.selected = (placard.callFrame === this._selectedCallFrame); 106 placard.selected = (placard.callFrame === this._selectedCallFrame);
98 } 107 }
99 108
100 this.dispatchEventToListeners("call frame selected"); 109 this.dispatchEventToListeners("call frame selected");
101 }, 110 },
102 111
112 handleKeyEvent: function(event)
113 {
114 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
115 var handler = this._shortcuts[shortcut];
116 if (handler) {
117 handler(event);
118 event.preventDefault();
119 event.handled = true;
120 }
121 },
122
123 _selectNextCallFrameOnStack: function()
124 {
125 var index = this._selectedCallFrameIndex();
126 if (index == -1)
127 return;
128 this._selectedPlacardByIndex(index + 1);
129 },
130
131 _selectPreviousCallFrameOnStack: function()
132 {
133 var index = this._selectedCallFrameIndex();
134 if (index == -1)
135 return;
136 this._selectedPlacardByIndex(index - 1);
137 },
138
139 _selectedPlacardByIndex: function(index)
140 {
141 if (index < 0 || index >= this.placards.length)
142 return;
143 var placard = this.placards[index];
144 this.selectedCallFrame = placard.callFrame
145 },
146
147 _selectedCallFrameIndex: function()
148 {
149 if (!this._selectedCallFrame)
150 return -1;
151 for (var i = 0; i < this.placards.length; ++i) {
152 var placard = this.placards[i];
153 if (placard.callFrame === this._selectedCallFrame)
154 return i;
155 }
156 return -1;
157 },
158
103 _placardSelected: function(event) 159 _placardSelected: function(event)
104 { 160 {
105 var placardElement = event.target.enclosingNodeOrSelfWithClass("placard" ); 161 var placardElement = event.target.enclosingNodeOrSelfWithClass("placard" );
106 this.selectedCallFrame = placardElement.placard.callFrame; 162 this.selectedCallFrame = placardElement.placard.callFrame;
107 } 163 }
108 } 164 }
109 165
110 WebInspector.CallStackSidebarPane.prototype.__proto__ = WebInspector.SidebarPane .prototype; 166 WebInspector.CallStackSidebarPane.prototype.__proto__ = WebInspector.SidebarPane .prototype;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698