<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[176817] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/176817">176817</a></dd>
<dt>Author</dt> <dd>burg@cs.washington.edu</dd>
<dt>Date</dt> <dd>2014-12-04 14:20:08 -0800 (Thu, 04 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: timeline probe records have inaccurate per-probe hit counts
https://bugs.webkit.org/show_bug.cgi?id=138976

Reviewed by Joseph Pecoraro.
Source/JavaScriptCore:

Previously, the DebuggerAgent was responsible for assigning unique ids to samples.
However, this makes it impossible for the frontend's Timeline manager to associate
a Probe Sample timeline record with the corresponding probe sample data. The record
only included the probe batchId (misnamed as hitCount in ScriptDebugServer).

This patch moves both the batchId and sampleId counters into ScriptDebugServer, so
any client of ScriptDebugListener will get the correct sampleId for each sample.

* inspector/ScriptDebugListener.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::ScriptDebugServer):
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
(Inspector::ScriptDebugServer::handleBreakpointHit):
* inspector/ScriptDebugServer.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
* inspector/agents/InspectorDebuggerAgent.h:

Source/WebCore:

Update the signature for breakpointActionProbe to take batchId and sampleId.
Covered by existing test inspector-protocol/debugger/didSampleProbe-multiple-probes.html.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::breakpointActionProbe):
* inspector/InspectorTimelineAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createProbeSampleData):
* inspector/TimelineRecordFactory.h:

LayoutTests:

Patch by Katie Madonna &lt;madonnk@gmail.com&gt;

Update test to also cover expected probe sampleId behavior.

* inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt:
* inspector-protocol/debugger/didSampleProbe-multiple-probes.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggerdidSampleProbemultipleprobesexpectedtxt">trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorprotocoldebuggerdidSampleProbemultipleprobeshtml">trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptDebugListenerh">trunk/Source/JavaScriptCore/inspector/ScriptDebugListener.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptDebugServercpp">trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorScriptDebugServerh">trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorTimelineAgentcpp">trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorTimelineAgenth">trunk/Source/WebCore/inspector/InspectorTimelineAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorTimelineRecordFactorycpp">trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorTimelineRecordFactoryh">trunk/Source/WebCore/inspector/TimelineRecordFactory.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/LayoutTests/ChangeLog        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-12-02  Brian J. Burg &lt;burg@cs.washington.edu&gt;
+
+        Web Inspector: timeline probe records have inaccurate per-probe hit counts
+        https://bugs.webkit.org/show_bug.cgi?id=138976
+
+        Reviewed by Joseph Pecoraro.
+        Patch by Katie Madonna &lt;madonnk@gmail.com&gt;
+
+        Update test to also cover expected probe sampleId behavior.
+
+        * inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt:
+        * inspector-protocol/debugger/didSampleProbe-multiple-probes.html:
+
</ins><span class="cx"> 2014-12-04  Adenilson Cavalcanti  &lt;cavalcantii@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Groove/inset/outset borders show solid if the color is black
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggerdidSampleProbemultipleprobesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes-expected.txt        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -3,8 +3,12 @@
</span><span class="cx"> Found breakpoint.js
</span><span class="cx"> Running breakpointActions to trigger probe samples.
</span><span class="cx"> inside breakpointActions a:(12) b:([object Object])
</span><ins>+inside breakpointActions a:(12) b:([object Object])
</ins><span class="cx"> Received probe sample payload: {&quot;type&quot;:&quot;number&quot;,&quot;value&quot;:12,&quot;description&quot;:&quot;12&quot;}
</span><span class="cx"> Received probe sample payload: {&quot;type&quot;:&quot;number&quot;,&quot;value&quot;:12,&quot;description&quot;:&quot;12&quot;}
</span><ins>+Received probe sample payload: {&quot;type&quot;:&quot;number&quot;,&quot;value&quot;:12,&quot;description&quot;:&quot;12&quot;}
+Received probe sample payload: {&quot;type&quot;:&quot;number&quot;,&quot;value&quot;:12,&quot;description&quot;:&quot;12&quot;}
</ins><span class="cx"> PASS: Samples from different probe actions should have unique action identifiers.
</span><span class="cx"> PASS: Samples from probe actions on the same breakpoint should have the same batch identifiers.
</span><ins>+PASS: SampleIds from a any probe are sequential and start counting from one.
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorprotocoldebuggerdidSampleProbemultipleprobeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/LayoutTests/inspector-protocol/debugger/didSampleProbe-multiple-probes.html        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -10,16 +10,15 @@
</span><span class="cx">     InspectorTest.sendCommand(&quot;Debugger.enable&quot;, {});
</span><span class="cx"> 
</span><span class="cx">     var samples = [];
</span><del>-    const expectedSampleCount = 2;
</del><ins>+    const expectedSampleCount = 4;
</ins><span class="cx"> 
</span><span class="cx">     function receivedAllExpectedSamples() {
</span><span class="cx">         return samples.length === expectedSampleCount;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    function dumpSamples()
-    {
-        InspectorTest.log(&quot;Sample 1: &quot; + JSON.stringify(samples[0]));
-        InspectorTest.log(&quot;Sample 2: &quot; + JSON.stringify(samples[1]));
</del><ins>+    function dumpSamples() {
+        for (var i = 0; i &lt; samples.length; i++)
+            InspectorTest.log(&quot;Sample &quot; + (i + 1) + &quot;: &quot; + JSON.stringify(samples[i]));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     var tests = [
</span><span class="lines">@@ -37,6 +36,13 @@
</span><span class="cx">             },
</span><span class="cx">             error: dumpSamples
</span><span class="cx">         },
</span><ins>+        {
+            message: &quot;SampleIds from a any probe are sequential and start counting from one.&quot;,
+            predicate: function samplesHaveSequentialIds() {
+                return samples.every(function(sample, idx) { return sample.sampleId === idx + 1; });
+            },
+            error: dumpSamples
+        },
</ins><span class="cx">     ];
</span><span class="cx"> 
</span><span class="cx">     InspectorTest.eventHandler[&quot;Debugger.scriptParsed&quot;] = function(messageObject)
</span><span class="lines">@@ -58,6 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">                 InspectorTest.log(&quot;Running breakpointActions to trigger probe samples.&quot;);
</span><span class="cx">                 InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {expression: &quot;breakpointActions(12, {x:1,y:2})&quot;});
</span><ins>+                InspectorTest.sendCommand(&quot;Runtime.evaluate&quot;, {expression: &quot;breakpointActions(12, {x:1,y:2})&quot;});
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/ChangeLog        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2014-12-02  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Web Inspector: timeline probe records have inaccurate per-probe hit counts
+        https://bugs.webkit.org/show_bug.cgi?id=138976
+
+        Reviewed by Joseph Pecoraro.
+
+        Previously, the DebuggerAgent was responsible for assigning unique ids to samples.
+        However, this makes it impossible for the frontend's Timeline manager to associate
+        a Probe Sample timeline record with the corresponding probe sample data. The record
+        only included the probe batchId (misnamed as hitCount in ScriptDebugServer).
+
+        This patch moves both the batchId and sampleId counters into ScriptDebugServer, so
+        any client of ScriptDebugListener will get the correct sampleId for each sample.
+
+        * inspector/ScriptDebugListener.h:
+        * inspector/ScriptDebugServer.cpp:
+        (Inspector::ScriptDebugServer::ScriptDebugServer):
+        (Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
+        (Inspector::ScriptDebugServer::handleBreakpointHit):
+        * inspector/ScriptDebugServer.h:
+        * inspector/agents/InspectorDebuggerAgent.cpp:
+        (Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent):
+        (Inspector::InspectorDebuggerAgent::breakpointActionProbe):
+        * inspector/agents/InspectorDebuggerAgent.h:
+
</ins><span class="cx"> 2014-12-04  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Serialization of MapData object provides unsafe access to internal types
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptDebugListenerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptDebugListener.h (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptDebugListener.h        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/inspector/ScriptDebugListener.h        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void breakpointActionLog(JSC::ExecState*, const String&amp;) = 0;
</span><span class="cx">     virtual void breakpointActionSound(int breakpointActionIdentifier) = 0;
</span><del>-    virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&amp;, int hitCount, const Deprecated::ScriptValue&amp; result) = 0;
</del><ins>+    virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&amp;, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue&amp; result) = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptDebugServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.cpp        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -50,8 +50,6 @@
</span><span class="cx"> 
</span><span class="cx"> ScriptDebugServer::ScriptDebugServer(bool isInWorkerThread)
</span><span class="cx">     : Debugger(isInWorkerThread)
</span><del>-    , m_doneProcessingDebuggerEvents(true)
-    , m_callingListeners(false)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -176,7 +174,7 @@
</span><span class="cx">         listener-&gt;breakpointActionSound(breakpointActionIdentifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScriptDebugServer::dispatchBreakpointActionProbe(ExecState* exec, const ScriptBreakpointAction&amp; action, const Deprecated::ScriptValue&amp; sample)
</del><ins>+void ScriptDebugServer::dispatchBreakpointActionProbe(ExecState* exec, const ScriptBreakpointAction&amp; action, const Deprecated::ScriptValue&amp; sampleValue)
</ins><span class="cx"> {
</span><span class="cx">     if (m_callingListeners)
</span><span class="cx">         return;
</span><span class="lines">@@ -187,10 +185,12 @@
</span><span class="cx"> 
</span><span class="cx">     TemporaryChange&lt;bool&gt; change(m_callingListeners, true);
</span><span class="cx"> 
</span><ins>+    unsigned sampleId = m_nextProbeSampleId++;
+
</ins><span class="cx">     Vector&lt;ScriptDebugListener*&gt; listenersCopy;
</span><span class="cx">     copyToVector(listeners, listenersCopy);
</span><span class="cx">     for (auto* listener : listenersCopy)
</span><del>-        listener-&gt;breakpointActionProbe(exec, action, m_hitCount, sample);
</del><ins>+        listener-&gt;breakpointActionProbe(exec, action, m_currentProbeBatchId, sampleId, sampleValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener)
</span><span class="lines">@@ -288,7 +288,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ScriptDebugServer::handleBreakpointHit(const JSC::Breakpoint&amp; breakpoint)
</span><span class="cx"> {
</span><del>-    m_hitCount++;
</del><ins>+    m_currentProbeBatchId++;
</ins><span class="cx">     BreakpointIDToActionsMap::iterator it = m_breakpointIDToActions.find(breakpoint.id);
</span><span class="cx">     if (it != m_breakpointIDToActions.end()) {
</span><span class="cx">         BreakpointActions&amp; actions = it-&gt;value;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorScriptDebugServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/inspector/ScriptDebugServer.h        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx">     void dispatchBreakpointActionSound(JSC::ExecState*, int breakpointActionIdentifier);
</span><span class="cx">     void dispatchBreakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&amp;, const Deprecated::ScriptValue&amp; sample);
</span><span class="cx"> 
</span><del>-    bool m_doneProcessingDebuggerEvents;
</del><ins>+    bool m_doneProcessingDebuggerEvents {true};
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     typedef HashMap&lt;JSC::BreakpointID, BreakpointActions&gt; BreakpointIDToActionsMap;
</span><span class="lines">@@ -107,9 +107,12 @@
</span><span class="cx"> 
</span><span class="cx">     Deprecated::ScriptValue exceptionOrCaughtValue(JSC::ExecState*);
</span><span class="cx"> 
</span><del>-    unsigned m_hitCount;
-    bool m_callingListeners;
</del><ins>+    bool m_callingListeners {false};
+
</ins><span class="cx">     BreakpointIDToActionsMap m_breakpointIDToActions;
</span><ins>+
+    unsigned m_nextProbeSampleId {1};
+    unsigned m_currentProbeBatchId {0};
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -60,13 +60,7 @@
</span><span class="cx"> InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedScriptManager)
</span><span class="cx">     : InspectorAgentBase(ASCIILiteral(&quot;Debugger&quot;))
</span><span class="cx">     , m_injectedScriptManager(injectedScriptManager)
</span><del>-    , m_listener(nullptr)
-    , m_pausedScriptState(nullptr)
</del><span class="cx">     , m_continueToLocationBreakpointID(JSC::noBreakpointID)
</span><del>-    , m_enabled(false)
-    , m_javaScriptPauseScheduled(false)
-    , m_hasExceptionValue(false)
-    , m_nextProbeSampleId(1)
</del><span class="cx"> {
</span><span class="cx">     // FIXME: make breakReason optional so that there was no need to init it with &quot;other&quot;.
</span><span class="cx">     clearBreakDetails();
</span><span class="lines">@@ -667,16 +661,14 @@
</span><span class="cx">     m_frontendDispatcher-&gt;playBreakpointActionSound(breakpointActionIdentifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState* scriptState, const ScriptBreakpointAction&amp; action, int hitCount, const Deprecated::ScriptValue&amp; sample)
</del><ins>+void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState* scriptState, const ScriptBreakpointAction&amp; action, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue&amp; sample)
</ins><span class="cx"> {
</span><del>-    int sampleId = m_nextProbeSampleId++;
-
</del><span class="cx">     InjectedScript injectedScript = m_injectedScriptManager-&gt;injectedScriptFor(scriptState);
</span><span class="cx">     RefPtr&lt;Protocol::Runtime::RemoteObject&gt; payload = injectedScript.wrapObject(sample, objectGroupForBreakpointAction(action));
</span><span class="cx">     RefPtr&lt;Protocol::Debugger::ProbeSample&gt; result = Protocol::Debugger::ProbeSample::create()
</span><span class="cx">         .setProbeId(action.identifier)
</span><ins>+        .setBatchId(batchId)
</ins><span class="cx">         .setSampleId(sampleId)
</span><del>-        .setBatchId(hitCount)
</del><span class="cx">         .setTimestamp(m_injectedScriptManager-&gt;inspectorEnvironment().executionStopwatch()-&gt;elapsedTime())
</span><span class="cx">         .setPayload(payload.release());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">     virtual void failedToParseSource(const String&amp; url, const String&amp; data, int firstLine, int errorLine, const String&amp; errorMessage) override final;
</span><span class="cx"> 
</span><span class="cx">     virtual void breakpointActionSound(int breakpointActionIdentifier) override;
</span><del>-    virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&amp;, int hitCount, const Deprecated::ScriptValue&amp; sample) override final;
</del><ins>+    virtual void breakpointActionProbe(JSC::ExecState*, const ScriptBreakpointAction&amp;, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue&amp; sample) override final;
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;Inspector::Protocol::Debugger::Location&gt; resolveBreakpoint(const String&amp; breakpointIdentifier, JSC::SourceID, const ScriptBreakpoint&amp;);
</span><span class="cx">     bool assertPaused(ErrorString&amp;);
</span><span class="lines">@@ -156,8 +156,8 @@
</span><span class="cx">     InjectedScriptManager* m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;InspectorDebuggerFrontendDispatcher&gt; m_frontendDispatcher;
</span><span class="cx">     RefPtr&lt;InspectorDebuggerBackendDispatcher&gt; m_backendDispatcher;
</span><del>-    Listener* m_listener;
-    JSC::ExecState* m_pausedScriptState;
</del><ins>+    Listener* m_listener {nullptr};
+    JSC::ExecState* m_pausedScriptState {nullptr};
</ins><span class="cx">     Deprecated::ScriptValue m_currentCallStack;
</span><span class="cx">     ScriptsMap m_scripts;
</span><span class="cx">     BreakpointIdentifierToDebugServerBreakpointIDsMap m_breakpointIdentifierToDebugServerBreakpointIDs;
</span><span class="lines">@@ -165,11 +165,10 @@
</span><span class="cx">     JSC::BreakpointID m_continueToLocationBreakpointID;
</span><span class="cx">     InspectorDebuggerFrontendDispatcher::Reason m_breakReason;
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; m_breakAuxData;
</span><del>-    bool m_enabled;
-    bool m_javaScriptPauseScheduled;
-    bool m_hasExceptionValue;
</del><ins>+    bool m_enabled {false};
+    bool m_javaScriptPauseScheduled {false};
+    bool m_hasExceptionValue {false};
</ins><span class="cx">     RefPtr&lt;WTF::Stopwatch&gt; m_stopwatch;
</span><del>-    int m_nextProbeSampleId;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace Inspector
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/WebCore/ChangeLog        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2014-12-02  Brian J. Burg  &lt;burg@cs.washington.edu&gt;
+
+        Web Inspector: timeline probe records have inaccurate per-probe hit counts
+        https://bugs.webkit.org/show_bug.cgi?id=138976
+
+        Reviewed by Joseph Pecoraro.
+
+        Update the signature for breakpointActionProbe to take batchId and sampleId.
+        Covered by existing test inspector-protocol/debugger/didSampleProbe-multiple-probes.html.
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::breakpointActionProbe):
+        * inspector/InspectorTimelineAgent.h:
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createProbeSampleData):
+        * inspector/TimelineRecordFactory.h:
+
</ins><span class="cx"> 2014-12-04  Adenilson Cavalcanti  &lt;cavalcantii@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Groove/inset/outset borders show solid if the color is black
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -421,7 +421,7 @@
</span><span class="cx">     if (frame &amp;&amp; m_callStackDepth) {
</span><span class="cx">         --m_callStackDepth;
</span><span class="cx">         ASSERT(m_callStackDepth &gt;= 0);
</span><del>-        
</del><ins>+
</ins><span class="cx">         if (!m_callStackDepth) {
</span><span class="cx">             if (m_recordStack.isEmpty())
</span><span class="cx">                 return;
</span><span class="lines">@@ -552,11 +552,12 @@
</span><span class="cx"> 
</span><span class="cx"> // ScriptDebugListener
</span><span class="cx"> 
</span><del>-void InspectorTimelineAgent::breakpointActionProbe(JSC::ExecState* exec, const Inspector::ScriptBreakpointAction&amp; action, int hitCount, const Deprecated::ScriptValue&amp;)
</del><ins>+void InspectorTimelineAgent::breakpointActionProbe(JSC::ExecState* exec, const Inspector::ScriptBreakpointAction&amp; action, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue&amp;)
</ins><span class="cx"> {
</span><ins>+    UNUSED_PARAM(batchId);
</ins><span class="cx">     ASSERT(exec);
</span><span class="cx"> 
</span><del>-    appendRecord(TimelineRecordFactory::createProbeSampleData(action, hitCount), TimelineRecordType::ProbeSample, false, frameFromExecState(exec));
</del><ins>+    appendRecord(TimelineRecordFactory::createProbeSampleData(action, sampleId), TimelineRecordType::ProbeSample, false, frameFromExecState(exec));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static Inspector::Protocol::Timeline::EventType toProtocol(TimelineRecordType type)
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void breakpointActionLog(JSC::ExecState*, const String&amp;) override { }
</span><span class="cx">     virtual void breakpointActionSound(int) override { }
</span><del>-    virtual void breakpointActionProbe(JSC::ExecState*, const Inspector::ScriptBreakpointAction&amp;, int hitCount, const Deprecated::ScriptValue&amp; result) override;
</del><ins>+    virtual void breakpointActionProbe(JSC::ExecState*, const Inspector::ScriptBreakpointAction&amp;, unsigned batchId, unsigned sampleId, const Deprecated::ScriptValue&amp; result) override;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class TimelineRecordStack;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorTimelineRecordFactorycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -95,11 +95,11 @@
</span><span class="cx">     return data.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;InspectorObject&gt; TimelineRecordFactory::createProbeSampleData(const ScriptBreakpointAction&amp; action, int hitCount)
</del><ins>+PassRefPtr&lt;InspectorObject&gt; TimelineRecordFactory::createProbeSampleData(const ScriptBreakpointAction&amp; action, unsigned sampleId)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InspectorObject&gt; data = InspectorObject::create();
</span><span class="cx">     data-&gt;setInteger(ASCIILiteral(&quot;probeId&quot;), action.identifier);
</span><del>-    data-&gt;setInteger(ASCIILiteral(&quot;hitCount&quot;), hitCount);
</del><ins>+    data-&gt;setInteger(ASCIILiteral(&quot;sampleId&quot;), sampleId);
</ins><span class="cx">     return data.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorTimelineRecordFactoryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (176816 => 176817)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h        2014-12-04 22:01:30 UTC (rev 176816)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h        2014-12-04 22:20:08 UTC (rev 176817)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">         static PassRefPtr&lt;Inspector::InspectorObject&gt; createFunctionCallData(const String&amp; scriptName, int scriptLine);
</span><span class="cx">         static PassRefPtr&lt;Inspector::InspectorObject&gt; createConsoleProfileData(const String&amp; title);
</span><span class="cx"> 
</span><del>-        static PassRefPtr&lt;Inspector::InspectorObject&gt; createProbeSampleData(const Inspector::ScriptBreakpointAction&amp;, int hitCount);
</del><ins>+        static PassRefPtr&lt;Inspector::InspectorObject&gt; createProbeSampleData(const Inspector::ScriptBreakpointAction&amp;, unsigned sampleId);
</ins><span class="cx"> 
</span><span class="cx">         static PassRefPtr&lt;Inspector::InspectorObject&gt; createEventDispatchData(const Event&amp;);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>