Changeset 69760 in webkit
- Timestamp:
- Oct 14, 2010 5:56:28 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69759 r69760 1 2010-10-14 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: implement pausing on window events and timeouts 6 https://bugs.webkit.org/show_bug.cgi?id=47542 7 8 * inspector/InspectorInstrumentation.cpp: 9 (WebCore::InspectorInstrumentation::didInstallTimerImpl): 10 (WebCore::InspectorInstrumentation::didRemoveTimerImpl): 11 (WebCore::InspectorInstrumentation::willDispatchEventImpl): 12 (WebCore::InspectorInstrumentation::didDispatchEventImpl): 13 (WebCore::InspectorInstrumentation::willDispatchEventOnWindowImpl): 14 (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl): 15 (WebCore::InspectorInstrumentation::willFireTimerImpl): 16 (WebCore::InspectorInstrumentation::didFireTimerImpl): 17 (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded): 18 (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent): 19 * inspector/InspectorInstrumentation.h: 20 * inspector/front-end/BreakpointManager.js: 21 (WebInspector.EventListenerBreakpoint.prototype.populateLabelElement): 22 (WebInspector.EventListenerBreakpoint.prototype.populateStatusMessageElement): 23 (WebInspector.EventListenerBreakpoint.prototype._condition): 24 (WebInspector.EventListenerBreakpoint.prototype._uiEventName): 25 * inspector/front-end/BreakpointsSidebarPane.js: 26 (WebInspector.EventListenerBreakpointsSidebarPane.prototype._populate): 27 1 28 2010-10-14 Csaba Osztrogonác <ossy@webkit.org> 2 29 -
trunk/WebCore/inspector/InspectorInstrumentation.cpp
r69567 r69760 44 44 namespace WebCore { 45 45 46 static const char* const listenerEventCategoryType = "listener"; 47 static const char* const instrumentationEventCategoryType = "instrumentation"; 48 49 static const char* const setTimerEventName = "setTimer"; 50 static const char* const clearTimerEventName = "clearTimer"; 51 static const char* const timerFiredEventName = "timerFired"; 52 46 53 int InspectorInstrumentation::s_frontendCounter = 0; 47 54 … … 159 166 void InspectorInstrumentation::didInstallTimerImpl(InspectorController* inspectorController, int timerId, int timeout, bool singleShot) 160 167 { 168 pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, setTimerEventName, true); 161 169 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) 162 170 timelineAgent->didInstallTimer(timerId, timeout, singleShot); … … 165 173 void InspectorInstrumentation::didRemoveTimerImpl(InspectorController* inspectorController, int timerId) 166 174 { 175 pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, clearTimerEventName, true); 167 176 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController)) 168 177 timelineAgent->didRemoveTimer(timerId); … … 206 215 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window, Node* node, const Vector<RefPtr<ContainerNode> >& ancestors) 207 216 { 208 #if ENABLE(JAVASCRIPT_DEBUGGER) 209 if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) { 210 String breakpointId = inspectorController->findEventListenerBreakpoint(event.type()); 211 if (!breakpointId.isEmpty()) { 212 RefPtr<InspectorObject> eventData = InspectorObject::create(); 213 eventData->setString("breakpointId", breakpointId); 214 eventData->setString("eventName", event.type()); 215 debuggerAgent->schedulePauseOnNextStatement(NativeBreakpointDebuggerEventType, eventData); 216 } 217 } 218 #endif 217 pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false); 219 218 220 219 int timelineAgentId = 0; … … 229 228 void InspectorInstrumentation::didDispatchEventImpl(const InspectorInstrumentationCookie& cookie) 230 229 { 231 #if ENABLE(JAVASCRIPT_DEBUGGER) 232 if (InspectorDebuggerAgent* debuggerAgent = cookie.first->m_debuggerAgent.get()) 233 debuggerAgent->cancelPauseOnNextStatement(); 234 #endif 230 cancelPauseOnNativeEvent(cookie.first); 235 231 236 232 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) … … 240 236 InspectorInstrumentationCookie InspectorInstrumentation::willDispatchEventOnWindowImpl(InspectorController* inspectorController, const Event& event, DOMWindow* window) 241 237 { 238 pauseOnNativeEventIfNeeded(inspectorController, listenerEventCategoryType, event.type(), false); 239 242 240 int timelineAgentId = 0; 243 241 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); … … 251 249 void InspectorInstrumentation::didDispatchEventOnWindowImpl(const InspectorInstrumentationCookie& cookie) 252 250 { 251 cancelPauseOnNativeEvent(cookie.first); 252 253 253 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) 254 254 timelineAgent->didDispatchEvent(); … … 274 274 InspectorInstrumentationCookie InspectorInstrumentation::willFireTimerImpl(InspectorController* inspectorController, int timerId) 275 275 { 276 pauseOnNativeEventIfNeeded(inspectorController, instrumentationEventCategoryType, timerFiredEventName, false); 277 276 278 int timelineAgentId = 0; 277 279 InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorController); … … 285 287 void InspectorInstrumentation::didFireTimerImpl(const InspectorInstrumentationCookie& cookie) 286 288 { 289 cancelPauseOnNativeEvent(cookie.first); 290 287 291 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) 288 292 timelineAgent->didFireTimer(); … … 411 415 { 412 416 return inspectorController->hasFrontend(); 417 } 418 419 void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* inspectorController, const String& categoryType, const String& eventName, bool synchronous) 420 { 421 #if ENABLE(JAVASCRIPT_DEBUGGER) 422 InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get(); 423 if (!debuggerAgent) 424 return; 425 String fullEventName = String::format("%s:%s", categoryType.utf8().data(), eventName.utf8().data()); 426 String breakpointId = inspectorController->findEventListenerBreakpoint(fullEventName); 427 if (breakpointId.isEmpty()) 428 return; 429 RefPtr<InspectorObject> eventData = InspectorObject::create(); 430 eventData->setString("breakpointId", breakpointId); 431 if (synchronous) 432 debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData); 433 else 434 debuggerAgent->schedulePauseOnNextStatement(NativeBreakpointDebuggerEventType, eventData); 435 #endif 436 } 437 438 void InspectorInstrumentation::cancelPauseOnNativeEvent(InspectorController* inspectorController) 439 { 440 #if ENABLE(JAVASCRIPT_DEBUGGER) 441 if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) 442 debuggerAgent->cancelPauseOnNextStatement(); 443 #endif 413 444 } 414 445 -
trunk/WebCore/inspector/InspectorInstrumentation.h
r69406 r69760 147 147 148 148 static bool hasFrontend(InspectorController*); 149 static void pauseOnNativeEventIfNeeded(InspectorController*, const String& categoryType, const String& eventName, bool synchronous); 150 static void cancelPauseOnNativeEvent(InspectorController*); 149 151 static InspectorTimelineAgent* retrieveTimelineAgent(InspectorController*); 150 152 static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); -
trunk/WebCore/inspector/front-end/BreakpointManager.js
r69567 r69760 487 487 }, 488 488 489 label: function()490 { 491 return this._eventName;489 populateLabelElement: function(element) 490 { 491 element.appendChild(document.createTextNode(this._uiEventName())); 492 492 }, 493 493 494 494 populateStatusMessageElement: function(element, eventData) 495 495 { 496 var status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", this._ eventName);496 var status = WebInspector.UIString("Paused on a \"%s\" Event Listener.", this._uiEventName()); 497 497 element.appendChild(document.createTextNode(status)); 498 498 }, … … 501 501 { 502 502 return { eventName: this._eventName }; 503 }, 504 505 _uiEventName: function() 506 { 507 if (!WebInspector.EventListenerBreakpoint._uiEventNames) { 508 WebInspector.EventListenerBreakpoint._uiEventNames = { 509 "instrumentation:setTimer": WebInspector.UIString("Set Timer"), 510 "instrumentation:clearTimer": WebInspector.UIString("Clear Timer"), 511 "instrumentation:timerFired": WebInspector.UIString("Timer Fired") 512 }; 513 } 514 return WebInspector.EventListenerBreakpoint._uiEventNames[this._eventName] || this._eventName.substring(this._eventName.indexOf(":") + 1); 503 515 } 504 516 } -
trunk/WebCore/inspector/front-end/BreakpointsSidebarPane.js
r69567 r69760 247 247 { 248 248 var categories = { 249 "Mouse": ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"], 250 "Keyboard": ["keydown", "keypress", "keyup"] 249 "Mouse": { type: "listener", eventNames: ["click", "dblclick", "mousedown", "mouseup", "mouseover", "mousemove", "mouseout", "mousewheel"] }, 250 "Keyboard": { type: "listener", eventNames: ["keydown", "keypress", "keyup"] }, 251 "HTML frame/object": { type: "listener", eventNames: ["load", "error", "resize", "scroll"] }, 252 "Timer": { type: "instrumentation", eventNames: ["setTimer", "clearTimer", "timerFired"] } 251 253 }; 252 254 … … 261 263 categoryItem.children = {}; 262 264 263 var eventNames = categories[category]; 265 var categoryType = categories[category].type; 266 var eventNames = categories[category].eventNames; 264 267 for (var i = 0; i < eventNames.length; ++i) { 265 var eventName = eventNames[i];268 var eventName = categoryType + ":" + eventNames[i]; 266 269 267 270 var breakpoint = WebInspector.breakpointManager.createEventListenerBreakpoint(eventName, true); … … 269 272 continue; 270 273 271 var eventNameTreeElement = new TreeElement(breakpoint.label()); 274 var labelElement = document.createElement("div"); 275 breakpoint.populateLabelElement(labelElement); 276 var eventNameTreeElement = new TreeElement(labelElement); 272 277 categoryTreeElement.appendChild(eventNameTreeElement); 273 278 eventNameTreeElement.listItemElement.addStyleClass("source-code");
Note: See TracChangeset
for help on using the changeset viewer.