Changeset 162096 in webkit
- Timestamp:
- Jan 15, 2014 3:22:39 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r162088 r162096 1 2014-01-15 Brian Burg <bburg@apple.com> 2 3 Web Inspector: capture probe samples on the backend 4 https://bugs.webkit.org/show_bug.cgi?id=126668 5 6 Reviewed by Joseph Pecoraro. 7 8 Add protocol tests for setting and hitting the probe breakpoint action type. 9 10 * inspector-protocol/debugger/setBreakpoint-actions-expected.txt: 11 * inspector-protocol/debugger/setBreakpoint-actions.html: 12 * inspector-protocol/debugger/setProbe-multiple-actions-expected.txt: Added. 13 * inspector-protocol/debugger/setProbe-multiple-actions.html: Added. 14 * inspector-protocol/resources/probe-helper.js: Added. 15 (ProbeHelper.simplifiedProbeSample): 16 1 17 2014-01-15 Gavin Barraclough <barraclough@apple.com> 2 18 -
trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions-expected.txt
r159520 r162096 18 18 PASS: Console Message: {"source":"console-api","level":"log","text":"eval-action","location":"???:1:26","parameters":[{"type":"string"},{"type":"number"},{"type":"object"}]} 19 19 PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-after","location":"breakpoint.js:19:2"} 20 PASS: Probe sample payload: {"type":"number","value":12,"description":"12"} 20 21 inside breakpointActions a:(100) b:([object HTMLBodyElement]) 21 22 PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-before","location":"breakpoint.js:19:2"} 22 23 PASS: Console Message: {"source":"console-api","level":"log","text":"eval-action","location":"???:1:26","parameters":[{"type":"string"},{"type":"number"},{"type":"object","subtype":"node"}]} 23 24 PASS: Console Message: {"source":"javascript","level":"log","text":"log-action-after","location":"breakpoint.js:19:2"} 25 PASS: Probe sample payload: {"type":"number","value":100,"description":"100"} 24 26 -
trunk/LayoutTests/inspector-protocol/debugger/setBreakpoint-actions.html
r155132 r162096 7 7 { 8 8 InspectorTest.importScript("../../../../inspector-protocol/resources/console-helper.js"); 9 InspectorTest.importScript("../../../../inspector-protocol/resources/probe-helper.js"); 9 10 10 11 InspectorTest.sendCommand("Console.enable", {}); … … 14 15 }); 15 16 16 var expectLogs = false; 17 var logsSeen = 0; 18 const expectedLogs = 6; 17 var isExpectingLogs = false; 18 var isExpectingSamples = false; 19 var logCount = 0; 20 var sampleCount = 0; 21 const expectedLogCount = 6; 22 const expectedSampleCount = 2; 23 24 function receivedAllExpectedOutput() { 25 return logCount === expectedLogCount && sampleCount === expectedSampleCount; 26 } 19 27 20 28 InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject) … … 31 39 {"type": "sound"}, 32 40 {"type": "evaluate", "data": "(function() { console.log('eval-action', a, b); })()"}, 33 {"type": "log", "data": "log-action-after"} 41 {"type": "log", "data": "log-action-after"}, 42 {"type": "probe", "data": "a"} 34 43 ] 35 44 }; … … 42 51 InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, 12)"}); 43 52 InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(2, {x:1,y:2})"}, function() { 44 expectLogs = true; 53 isExpectingLogs = true; 54 isExpectingSamples = true; 45 55 InspectorTest.log("Running breakpointActions to triggering the breakpoint actions"); 46 56 InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointActions(12, {x:1,y:2})"}, function() { … … 60 70 } 61 71 72 InspectorTest.eventHandler["Debugger.didSampleProbe"] = function(messageObject) 73 { 74 if (!isExpectingSamples) { 75 InspectorTest.log("FAIL: unexpected probe sample, probe samples should only have come from breakpoint actions."); 76 InspectorTest.completeTest(); 77 return; 78 } 79 80 var simplifiedSample = ProbeHelper.simplifiedProbeSample(messageObject); 81 InspectorTest.log("PASS: Probe sample payload: " + JSON.stringify(simplifiedSample.payload)); 82 83 ++sampleCount; 84 85 if (receivedAllExpectedOutput()) 86 InspectorTest.completeTest(); 87 } 88 62 89 InspectorTest.eventHandler["Console.messageAdded"] = function(messageObject) 63 90 { 64 if (! expectLogs) {91 if (!isExpectingLogs) { 65 92 InspectorTest.log("FAIL: unexpected log, logs should only have come from breakpoint actions."); 66 93 InspectorTest.completeTest(); … … 71 98 InspectorTest.log("PASS: Console Message: " + JSON.stringify(simplifiedMessage)); 72 99 73 if (++logsSeen === expectedLogs) 100 ++logCount; 101 102 if (receivedAllExpectedOutput()) 74 103 InspectorTest.completeTest(); 75 104 } -
trunk/Source/JavaScriptCore/ChangeLog
r162017 r162096 1 2014-01-15 Brian Burg <bburg@apple.com> 2 3 Web Inspector: capture probe samples on the backend 4 https://bugs.webkit.org/show_bug.cgi?id=126668 5 6 Reviewed by Joseph Pecoraro. 7 8 Add the 'probe' breakpoint action to the protocol. Change the setBreakpoint 9 commands to return a list of assigned breakpoint action identifiers 10 Add a type for breakpoint action identifiers. Add an event for sending 11 captured probe samples to the inspector frontend. 12 13 * inspector/protocol/Debugger.json: 14 1 15 2014-01-10 Mark Hahnenberg <mhahnenberg@apple.com> 2 16 -
trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json
r161691 r162096 9 9 }, 10 10 { 11 "id": "BreakpointActionIdentifier", 12 "type": "integer", 13 "description": "Breakpoint action identifier." 14 }, 15 { 11 16 "id": "ScriptId", 12 17 "type": "string", … … 32 37 "type": "object", 33 38 "properties": [ 34 { "name": "type", "type": "string", "enum": ["log", "evaluate", "sound" ], "description": "Different kinds of breakpoint actions." },39 { "name": "type", "type": "string", "enum": ["log", "evaluate", "sound", "probe"], "description": "Different kinds of breakpoint actions." }, 35 40 { "name": "data", "type": "string", "optional": true, "description": "Data associated with this breakpoint type (e.g. for type \"eval\" this is the JavaScript string to evalulate)." } 36 41 ], … … 79 84 ], 80 85 "description": "Scope description." 86 }, 87 { 88 "id": "ProbeSample", 89 "description": "A sample collected by evaluating a probe breakpoint action.", 90 "type": "object", 91 "properties": [ 92 { "name": "probeId", "$ref": "BreakpointActionIdentifier", "description": "Identifier of the probe breakpoint action that created the sample." }, 93 { "name": "sampleId", "type": "integer", "description": "Unique identifier for this sample." }, 94 { "name": "batchId", "type": "integer", "description": "A batch identifier which is the same for all samples taken at the same breakpoint hit." }, 95 { "name": "timestamp", "type": "number", "description": "Timestamp of when the sample was taken." }, 96 { "name": "payload", "$ref": "Runtime.RemoteObject", "description": "Contents of the sample." } 97 ] 81 98 } 82 99 ], … … 108 125 "returns": [ 109 126 { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, 110 { "name": "locations", "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." } 127 { "name": "locations", "type": "array", "items": { "$ref": "Location"}, "description": "List of the locations this breakpoint resolved into upon addition." }, 128 { "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." } 111 129 ], 112 130 "description": "Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads." … … 120 138 "returns": [ 121 139 { "name": "breakpointId", "$ref": "BreakpointId", "description": "Id of the created breakpoint for further reference." }, 122 { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." } 140 { "name": "actualLocation", "$ref": "Location", "description": "Location this breakpoint resolved into." }, 141 { "name": "breakpointActionIdentifiers", "type": "array", "items": { "$ref": "BreakpointActionIdentifier" }, "description": "Assigned breakpoint action identifiers." } 123 142 ], 124 143 "description": "Sets JavaScript breakpoint at a given location." … … 274 293 "name": "resumed", 275 294 "description": "Fired when the virtual machine resumed execution." 295 }, 296 { 297 "name": "didSampleProbe", 298 "description": "Fires when a new proben sample is collected.", 299 "parameters": [ 300 { "name": "sample", "$ref": "ProbeSample", "description": "A collected probe sample." } 301 ] 276 302 } 277 303 ] -
trunk/Source/WebCore/ChangeLog
r162085 r162096 1 2014-01-15 Brian Burg <bburg@apple.com> 2 3 Web Inspector: capture probe samples on the backend 4 https://bugs.webkit.org/show_bug.cgi?id=126668 5 6 Reviewed by Joseph Pecoraro. 7 8 Test: inspector-protocol/debugger/setProbe-multiple-actions.html 9 10 Add the probe breakpoint action type. A probe action 11 evaluates an expression on the script call frame, and 12 the result is aggregated on a per-probe basis. Each 13 evaluated expression result is called a probe sample. 14 15 * bindings/js/ScriptDebugServer.cpp: 16 (WebCore::ScriptDebugServer::evaluateBreakpointAction): Teach 17 the debug server to evaluate a probe. 18 19 (WebCore::ScriptDebugServer::dispatchDidSampleProbe): Added. 20 (WebCore::ScriptDebugServer::handleBreakpointHit): Increment a hit count. 21 (WebCore::ScriptDebugServer::getActionsForBreakpoint): 22 * bindings/js/ScriptDebugServer.h: 23 * inspector/InspectorDebuggerAgent.cpp: 24 (WebCore::objectGroupForBreakpointAction): Added. Create an object 25 group for each breakpoint action. Currently only probes make objects. 26 (WebCore::InspectorDebuggerAgent::InspectorDebuggerAgent): 27 (WebCore::InspectorDebuggerAgent::disable): 28 (WebCore::InspectorDebuggerAgent::enable): Remove stale comment. 29 (WebCore::breakpointActionTypeForString): Add new case. 30 (WebCore::InspectorDebuggerAgent::breakpointActionsFromProtocol): Make 31 this a member function instead of a static function, so it can increment 32 the breakpoint action identifier counter. 33 (WebCore::InspectorDebuggerAgent::setBreakpointByUrl): Propagate the 34 assigned breakpoint action identifiers. 35 (WebCore::InspectorDebuggerAgent::setBreakpoint): Propagate the 36 assigned breakpoint action identifiers. 37 (WebCore::InspectorDebuggerAgent::removeBreakpoint): Release object 38 groups for any actions that were associated with the removed breakpoint. 39 (WebCore::InspectorDebuggerAgent::didSampleProbe): Added. 40 (WebCore::InspectorDebuggerAgent::clearResolvedBreakpointState): Renamed from clear(). 41 (WebCore::InspectorDebuggerAgent::didClearGlobalObject): Renamed from reset(). 42 * inspector/InspectorDebuggerAgent.h: 43 * inspector/PageDebuggerAgent.cpp: 44 (WebCore::PageDebuggerAgent::didClearMainFrameWindowObject): 45 * inspector/ScriptBreakpoint.h: 46 (WebCore::ScriptBreakpointAction::ScriptBreakpointAction): Add identifier member. 47 * inspector/ScriptDebugListener.h: 48 1 49 2014-01-15 Brent Fulgham <bfulgham@apple.com> 2 50 -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp
r161771 r162096 1 1 /* 2 * Copyright (C) 2008, 2009, 2013 Apple Inc. All rights reserved.2 * Copyright (C) 2008, 2009, 2013, 2014 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 4 * Copyright (C) 2013 University of Washington. All rights reserved. 4 5 * 5 6 * Redistribution and use in source and binary forms, with or without … … 45 46 #include <runtime/JSLock.h> 46 47 #include <wtf/MainThread.h> 48 #include <wtf/NeverDestroyed.h> 49 #include <wtf/TemporaryChange.h> 47 50 #include <wtf/text/WTFString.h> 48 51 … … 91 94 } 92 95 93 bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& breakpointAction) const96 bool ScriptDebugServer::evaluateBreakpointAction(const ScriptBreakpointAction& breakpointAction) 94 97 { 95 98 DebuggerCallFrame* debuggerCallFrame = currentDebuggerCallFrame(); … … 111 114 systemBeep(); 112 115 break; 116 case ScriptBreakpointActionTypeProbe: { 117 JSValue exception; 118 JSValue result = debuggerCallFrame->evaluate(breakpointAction.data, exception); 119 if (exception) 120 reportException(debuggerCallFrame->exec(), exception); 121 122 JSC::ExecState* state = debuggerCallFrame->scope()->globalObject()->globalExec(); 123 Deprecated::ScriptValue wrappedResult = Deprecated::ScriptValue(state->vm(), exception ? exception : result); 124 dispatchDidSampleProbe(state, breakpointAction.identifier, wrappedResult); 125 break; 126 } 113 127 } 114 128 … … 141 155 } 142 156 157 void ScriptDebugServer::dispatchDidSampleProbe(ExecState* exec, int identifier, const Deprecated::ScriptValue& sample) 158 { 159 if (m_callingListeners) 160 return; 161 162 ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject()); 163 if (!listeners) 164 return; 165 ASSERT(!listeners->isEmpty()); 166 167 TemporaryChange<bool> change(m_callingListeners, true); 168 169 Vector<ScriptDebugListener*> listenersCopy; 170 copyToVector(*listeners, listenersCopy); 171 for (auto listener : listenersCopy) 172 listener->didSampleProbe(exec, identifier, m_hitCount, sample); 173 } 174 143 175 void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) 144 176 { … … 252 284 void ScriptDebugServer::handleBreakpointHit(const JSC::Breakpoint& breakpoint) 253 285 { 286 m_hitCount++; 254 287 BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(breakpoint.id); 255 288 if (it != m_breakpointIDToActions.end()) { … … 291 324 } 292 325 326 const Vector<ScriptBreakpointAction>& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID) 327 { 328 ASSERT(breakpointID != JSC::noBreakpointID); 329 330 if (m_breakpointIDToActions.contains(breakpointID)) 331 return m_breakpointIDToActions.find(breakpointID)->value; 332 333 static NeverDestroyed<Vector<ScriptBreakpointAction>> emptyActionVector = Vector<ScriptBreakpointAction>(); 334 return emptyActionVector; 335 } 336 293 337 } // namespace WebCore 294 338 -
trunk/Source/WebCore/bindings/js/ScriptDebugServer.h
r161771 r162096 63 63 virtual void recompileAllJSFunctions() = 0; 64 64 65 const Vector<ScriptBreakpointAction>& getActionsForBreakpoint(JSC::BreakpointID); 66 65 67 class Task { 66 68 WTF_MAKE_FAST_ALLOCATED; … … 85 87 virtual bool isContentScript(JSC::ExecState*); 86 88 87 bool evaluateBreakpointAction(const ScriptBreakpointAction&) const;89 bool evaluateBreakpointAction(const ScriptBreakpointAction&); 88 90 89 91 void dispatchFunctionToListeners(JavaScriptExecutionCallback, JSC::JSGlobalObject*); … … 93 95 void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, bool isContentScript); 94 96 void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage); 97 void dispatchDidSampleProbe(JSC::ExecState*, int probeIdentifier, const Deprecated::ScriptValue& sample); 95 98 96 99 bool m_doneProcessingDebuggerEvents; … … 109 112 void recompileAllJSFunctionsTimerFired(Timer<ScriptDebugServer>&); 110 113 114 unsigned m_hitCount; 111 115 bool m_callingListeners; 112 116 BreakpointIDToActionsMap m_breakpointIDToActions; -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
r161761 r162096 57 57 const char* InspectorDebuggerAgent::backtraceObjectGroup = "backtrace"; 58 58 59 static String objectGroupForBreakpointAction(int identifier) 60 { 61 DEFINE_STATIC_LOCAL(const AtomicString, objectGroup, ("breakpoint-action-", AtomicString::ConstructFromLiteral)); 62 return makeString(objectGroup, String::number(identifier)); 63 } 64 59 65 InspectorDebuggerAgent::InspectorDebuggerAgent(InstrumentingAgents* instrumentingAgents, InjectedScriptManager* injectedScriptManager) 60 66 : InspectorAgentBase(ASCIILiteral("Debugger"), instrumentingAgents) 61 67 , m_injectedScriptManager(injectedScriptManager) 62 , m_pausedScriptState( 0)68 , m_pausedScriptState(nullptr) 63 69 , m_continueToLocationBreakpointID(JSC::noBreakpointID) 64 70 , m_enabled(false) 65 71 , m_javaScriptPauseScheduled(false) 66 , m_listener(0) 72 , m_listener(nullptr) 73 , m_nextProbeSampleId(1) 74 , m_nextBreakpointActionIdentifier(1) 67 75 { 68 76 // FIXME: make breakReason optional so that there was no need to init it with "other". … … 79 87 m_instrumentingAgents->setInspectorDebuggerAgent(this); 80 88 81 // FIXME(WK44513): breakpoints activated flag should be synchronized between all front-ends82 89 scriptDebugServer().setBreakpointsActivated(true); 83 90 startListeningScriptDebugServer(); … … 92 99 { 93 100 m_javaScriptBreakpoints.clear(); 94 m_instrumentingAgents->setInspectorDebuggerAgent( 0);101 m_instrumentingAgents->setInspectorDebuggerAgent(nullptr); 95 102 96 103 stopListeningScriptDebugServer(); 97 scriptDebugServer().clearBreakpoints(); 98 scriptDebugServer().continueProgram(); 99 clear(); 104 clearResolvedBreakpointState(); 100 105 101 106 if (m_listener) … … 194 199 return true; 195 200 } 201 if (typeString == Inspector::TypeBuilder::getJSEnumConstantValue(Inspector::TypeBuilder::Debugger::BreakpointAction::Type::Probe)) { 202 *output = ScriptBreakpointActionTypeProbe; 203 return true; 204 } 196 205 197 206 return false; 198 207 } 199 208 200 static boolbreakpointActionsFromProtocol(ErrorString* errorString, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* result)209 bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString* errorString, RefPtr<InspectorArray>& actions, Vector<ScriptBreakpointAction>* result) 201 210 { 202 211 if (!actions) … … 231 240 object->getString("data", &data); 232 241 233 result->append(ScriptBreakpointAction(type, data));242 result->append(ScriptBreakpointAction(type, m_nextBreakpointActionIdentifier++, data)); 234 243 } 235 244 … … 237 246 } 238 247 239 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations )248 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) 240 249 { 241 250 locations = Array<Inspector::TypeBuilder::Debugger::Location>::create(); … … 268 277 return; 269 278 279 breakpointActionIdentifiers = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>::create(); 280 for (ScriptBreakpointAction& action : breakpointActions) 281 breakpointActionIdentifiers->addItem(action.identifier); 282 270 283 m_javaScriptBreakpoints.set(breakpointIdentifier, buildObjectForBreakpointCookie(url, lineNumber, columnNumber, condition, actions, isRegex, autoContinue)); 271 284 … … 298 311 } 299 312 300 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation )313 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const RefPtr<InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers) 301 314 { 302 315 JSC::SourceID sourceID; … … 319 332 if (!breakpointActionsFromProtocol(errorString, actions, &breakpointActions)) 320 333 return; 334 335 breakpointActionIdentifiers = Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>::create(); 336 for (ScriptBreakpointAction& action : breakpointActions) 337 breakpointActionIdentifiers->addItem(action.identifier); 321 338 322 339 String breakpointIdentifier = String::number(sourceID) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber); … … 338 355 m_javaScriptBreakpoints.remove(breakpointIdentifier); 339 356 340 BreakpointIdentifierToDebugServerBreakpointIDsMap::iterator debugServerBreakpointIDsIterator = m_breakpointIdentifierToDebugServerBreakpointIDs.find(breakpointIdentifier); 341 if (debugServerBreakpointIDsIterator == m_breakpointIdentifierToDebugServerBreakpointIDs.end()) 342 return; 343 for (size_t i = 0; i < debugServerBreakpointIDsIterator->value.size(); ++i) 344 scriptDebugServer().removeBreakpoint(debugServerBreakpointIDsIterator->value[i]); 345 m_breakpointIdentifierToDebugServerBreakpointIDs.remove(debugServerBreakpointIDsIterator); 357 Vector<JSC::BreakpointID> breakpointIDs = m_breakpointIdentifierToDebugServerBreakpointIDs.take(breakpointIdentifier); 358 for (auto breakpointID : breakpointIDs) { 359 const Vector<ScriptBreakpointAction>& breakpointActions = scriptDebugServer().getActionsForBreakpoint(breakpointID); 360 for (auto& action : breakpointActions) 361 m_injectedScriptManager->releaseObjectGroup(objectGroupForBreakpointAction(action.identifier)); 362 363 scriptDebugServer().removeBreakpoint(breakpointID); 364 } 346 365 } 347 366 … … 654 673 } 655 674 675 void InspectorDebuggerAgent::didSampleProbe(JSC::ExecState* scriptState, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) 676 { 677 int sampleId = m_nextProbeSampleId++; 678 679 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 680 RefPtr<TypeBuilder::Runtime::RemoteObject> payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(probeIdentifier)); 681 RefPtr<TypeBuilder::Debugger::ProbeSample> result = TypeBuilder::Debugger::ProbeSample::create() 682 .setProbeId(probeIdentifier) 683 .setSampleId(sampleId) 684 .setBatchId(hitCount) 685 .setTimestamp(monotonicallyIncreasingTime()) 686 .setPayload(payload.release()); 687 688 m_frontendDispatcher->didSampleProbe(result.release()); 689 } 690 656 691 void InspectorDebuggerAgent::didContinue() 657 692 { … … 669 704 } 670 705 671 void InspectorDebuggerAgent::clear() 672 { 673 m_pausedScriptState = 0; 706 void InspectorDebuggerAgent::clearResolvedBreakpointState() 707 { 708 ErrorString dummyError; 709 Vector<String> breakpointIdentifiers; 710 copyKeysToVector(m_breakpointIdentifierToDebugServerBreakpointIDs, breakpointIdentifiers); 711 for (const String& identifier : breakpointIdentifiers) 712 removeBreakpoint(&dummyError, identifier); 713 714 scriptDebugServer().continueProgram(); 715 716 m_pausedScriptState = nullptr; 674 717 m_currentCallStack = Deprecated::ScriptValue(); 675 718 m_scripts.clear(); … … 678 721 clearBreakDetails(); 679 722 m_javaScriptPauseScheduled = false; 680 ErrorString error; 681 setOverlayMessage(&error, 0); 723 setOverlayMessage(&dummyError, nullptr); 682 724 } 683 725 … … 697 739 } 698 740 699 void InspectorDebuggerAgent::reset() 700 { 701 scriptDebugServer().clearBreakpoints(); 702 m_scripts.clear(); 703 m_breakpointIdentifierToDebugServerBreakpointIDs.clear(); 741 void InspectorDebuggerAgent::didClearGlobalObject() 742 { 704 743 if (m_frontendDispatcher) 705 744 m_frontendDispatcher->globalObjectCleared(); 745 746 clearResolvedBreakpointState(); 706 747 } 707 748 -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r161761 r162096 82 82 virtual void setBreakpointsActive(ErrorString*, bool active); 83 83 84 virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations );85 virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation );84 virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::Location>>& locations, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers); 85 virtual void setBreakpoint(ErrorString*, const RefPtr<Inspector::InspectorObject>& location, const RefPtr<Inspector::InspectorObject>* options, Inspector::TypeBuilder::Debugger::BreakpointId*, RefPtr<Inspector::TypeBuilder::Debugger::Location>& actualLocation, RefPtr<Inspector::TypeBuilder::Array<Inspector::TypeBuilder::Debugger::BreakpointActionIdentifier>>& breakpointActionIdentifiers); 86 86 virtual void removeBreakpoint(ErrorString*, const String& breakpointIdentifier); 87 87 virtual void continueToLocation(ErrorString*, const RefPtr<Inspector::InspectorObject>& location); … … 139 139 virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception); 140 140 virtual void didContinue(); 141 void reset();141 void didClearGlobalObject(); 142 142 143 143 private: … … 146 146 virtual void didParseSource(JSC::SourceID, const Script&) OVERRIDE FINAL; 147 147 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) OVERRIDE FINAL; 148 virtual void didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& sample) OVERRIDE FINAL; 148 149 149 150 PassRefPtr<Inspector::TypeBuilder::Debugger::Location> resolveBreakpoint(const String& breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&); 150 void clear();151 151 bool assertPaused(ErrorString*); 152 void clearResolvedBreakpointState(); 152 153 void clearBreakDetails(); 154 155 bool breakpointActionsFromProtocol(ErrorString*, RefPtr<Inspector::InspectorArray>& actions, Vector<ScriptBreakpointAction>* result); 153 156 154 157 String sourceMapURLForScript(const Script&); … … 172 175 bool m_javaScriptPauseScheduled; 173 176 Listener* m_listener; 177 int m_nextProbeSampleId; 178 int m_nextBreakpointActionIdentifier; 174 179 }; 175 180 -
trunk/Source/WebCore/inspector/PageDebuggerAgent.cpp
r161784 r162096 116 116 void PageDebuggerAgent::didClearMainFrameWindowObject() 117 117 { 118 reset();118 didClearGlobalObject(); 119 119 } 120 120 -
trunk/Source/WebCore/inspector/ScriptBreakpoint.h
r155132 r162096 39 39 ScriptBreakpointActionTypeLog, 40 40 ScriptBreakpointActionTypeEvaluate, 41 ScriptBreakpointActionTypeSound 41 ScriptBreakpointActionTypeSound, 42 ScriptBreakpointActionTypeProbe 42 43 } ScriptBreakpointActionType; 43 44 44 45 struct ScriptBreakpointAction { 45 ScriptBreakpointAction(ScriptBreakpointActionType type, const String& data)46 ScriptBreakpointAction(ScriptBreakpointActionType type, int identifier, const String& data) 46 47 : type(type) 48 , identifier(identifier) 47 49 , data(data) 48 50 { … … 50 52 51 53 ScriptBreakpointActionType type; 54 int identifier; 52 55 String data; 53 56 }; -
trunk/Source/WebCore/inspector/ScriptDebugListener.h
r160682 r162096 72 72 virtual void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) = 0; 73 73 virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue& callFrames, const Deprecated::ScriptValue& exception) = 0; 74 virtual void didSampleProbe(JSC::ExecState*, int probeIdentifier, int hitCount, const Deprecated::ScriptValue& result) = 0; 74 75 virtual void didContinue() = 0; 75 76 }; -
trunk/Source/WebInspectorUI/ChangeLog
r162084 r162096 1 2014-01-15 Brian Burg <bburg@apple.com> 2 3 Web Inspector: capture probe samples on the backend 4 https://bugs.webkit.org/show_bug.cgi?id=126668 5 6 Reviewed by Joseph Pecoraro. 7 8 * UserInterface/InspectorJSBackendCommands.js: Add probe enumeration value. 9 1 10 2014-01-15 Andreas Kling <akling@apple.com> 2 11 -
trunk/Source/WebInspectorUI/UserInterface/InspectorJSBackendCommands.js
r161691 r162096 9 9 // Debugger. 10 10 InspectorBackend.registerDebuggerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Debugger"); 11 InspectorBackend.registerEnum("Debugger.BreakpointActionType", {Log: "log", Evaluate: "evaluate", Sound: "sound" });11 InspectorBackend.registerEnum("Debugger.BreakpointActionType", {Log: "log", Evaluate: "evaluate", Sound: "sound", Probe: "probe"}); 12 12 InspectorBackend.registerEnum("Debugger.ScopeType", {Global: "global", Local: "local", With: "with", Closure: "closure", Catch: "catch"}); 13 13 InspectorBackend.registerEvent("Debugger.globalObjectCleared", []); … … 17 17 InspectorBackend.registerEvent("Debugger.paused", ["callFrames", "reason", "data"]); 18 18 InspectorBackend.registerEvent("Debugger.resumed", []); 19 InspectorBackend.registerEvent("Debugger.didSampleProbe", ["sample"]); 19 20 InspectorBackend.registerCommand("Debugger.enable", [], []); 20 21 InspectorBackend.registerCommand("Debugger.disable", [], []);
Note: See TracChangeset
for help on using the changeset viewer.