<!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>[184117] trunk/Source</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/184117">184117</a></dd>
<dt>Author</dt> <dd>mattbaker@apple.com</dd>
<dt>Date</dt> <dd>2015-05-11 13:09:14 -0700 (Mon, 11 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/175203">r175203</a>): No profile information is shown in Inspector
https://bugs.webkit.org/show_bug.cgi?id=144808

Reviewed by Darin Adler.

Source/JavaScriptCore:

Since a profile can be started after a timeline recording has already begun, we can't assume a zero start time.
The start time for the root node's call entry should be based on the stopwatch used by the ProfileGenerator.

* profiler/Profile.cpp:
(JSC::Profile::create):
(JSC::Profile::Profile):
* profiler/Profile.h:
* profiler/ProfileGenerator.cpp:
(JSC::ProfileGenerator::ProfileGenerator):
(JSC::AddParentForConsoleStartFunctor::operator()):

Source/WebCore:

Profiles started from the console should always use the Inspector environment's shared stopwatch.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::startFromConsole):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilecpp">trunk/Source/JavaScriptCore/profiler/Profile.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfileh">trunk/Source/JavaScriptCore/profiler/Profile.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfileGeneratorcpp">trunk/Source/JavaScriptCore/profiler/ProfileGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfileGeneratorh">trunk/Source/JavaScriptCore/profiler/ProfileGenerator.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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-05-11  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=144808
+
+        Reviewed by Darin Adler.
+
+        Since a profile can be started after a timeline recording has already begun, we can't assume a zero start time.
+        The start time for the root node's call entry should be based on the stopwatch used by the ProfileGenerator.
+
+        * profiler/Profile.cpp:
+        (JSC::Profile::create):
+        (JSC::Profile::Profile):
+        * profiler/Profile.h:
+        * profiler/ProfileGenerator.cpp:
+        (JSC::ProfileGenerator::ProfileGenerator):
+        (JSC::AddParentForConsoleStartFunctor::operator()):
+
</ins><span class="cx"> 2015-05-11  Basile Clement  &lt;basile_clement@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, remove unintended change.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/Profile.cpp (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/Profile.cpp        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/JavaScriptCore/profiler/Profile.cpp        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -27,24 +27,23 @@
</span><span class="cx"> #include &quot;Profile.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ProfileNode.h&quot;
</span><del>-#include &lt;wtf/CurrentTime.h&gt;
</del><span class="cx"> #include &lt;wtf/DataLog.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Profile&gt; Profile::create(const String&amp; title, unsigned uid)
</del><ins>+PassRefPtr&lt;Profile&gt; Profile::create(const String&amp; title, unsigned uid, double startTime)
</ins><span class="cx"> {
</span><del>-    return adoptRef(new Profile(title, uid));
</del><ins>+    return adoptRef(new Profile(title, uid, startTime));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-Profile::Profile(const String&amp; title, unsigned uid)
</del><ins>+Profile::Profile(const String&amp; title, unsigned uid, double startTime)
</ins><span class="cx">     : m_title(title)
</span><span class="cx">     , m_uid(uid)
</span><span class="cx"> {
</span><span class="cx">     // FIXME: When multi-threading is supported this will be a vector and calls
</span><span class="cx">     // into the profiler will need to know which thread it is executing on.
</span><span class="cx">     m_rootNode = ProfileNode::create(nullptr, CallIdentifier(ASCIILiteral(&quot;Thread_1&quot;), String(), 0, 0), nullptr);
</span><del>-    m_rootNode-&gt;appendCall(ProfileNode::Call(0.0));
</del><ins>+    m_rootNode-&gt;appendCall(ProfileNode::Call(startTime));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Profile::~Profile()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfileh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/Profile.h (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/Profile.h        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/JavaScriptCore/profiler/Profile.h        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> class JS_EXPORT_PRIVATE Profile : public RefCounted&lt;Profile&gt; {
</span><span class="cx"> public:
</span><del>-    static PassRefPtr&lt;Profile&gt; create(const String&amp; title, unsigned uid);
</del><ins>+    static PassRefPtr&lt;Profile&gt; create(const String&amp; title, unsigned uid, double);
</ins><span class="cx">     virtual ~Profile();
</span><span class="cx"> 
</span><span class="cx">     const String&amp; title() const { return m_title; }
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    Profile(const String&amp; title, unsigned uid);
</del><ins>+    Profile(const String&amp; title, unsigned uid, double startTime);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void removeProfileStart();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfileGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfileGenerator.cpp (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfileGenerator.cpp        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/JavaScriptCore/profiler/ProfileGenerator.cpp        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -51,20 +51,22 @@
</span><span class="cx">     , m_foundConsoleStartParent(false)
</span><span class="cx">     , m_suspended(false)
</span><span class="cx"> {
</span><del>-    m_profile = Profile::create(title, uid);
</del><ins>+    double startTime = m_stopwatch-&gt;elapsedTime();
+    m_profile = Profile::create(title, uid, startTime);
</ins><span class="cx">     m_currentNode = m_rootNode = m_profile-&gt;rootNode();
</span><span class="cx">     if (exec)
</span><del>-        addParentForConsoleStart(exec);
</del><ins>+        addParentForConsoleStart(exec, startTime);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class AddParentForConsoleStartFunctor {
</span><span class="cx"> public:
</span><del>-    AddParentForConsoleStartFunctor(ExecState* exec, RefPtr&lt;ProfileNode&gt;&amp; rootNode, RefPtr&lt;ProfileNode&gt;&amp; currentNode)
</del><ins>+    AddParentForConsoleStartFunctor(ExecState* exec, RefPtr&lt;ProfileNode&gt;&amp; rootNode, RefPtr&lt;ProfileNode&gt;&amp; currentNode, double startTime)
</ins><span class="cx">         : m_exec(exec)
</span><span class="cx">         , m_hasSkippedFirstFrame(false)
</span><span class="cx">         , m_foundParent(false)
</span><span class="cx">         , m_rootNode(rootNode)
</span><span class="cx">         , m_currentNode(currentNode)
</span><ins>+        , m_startTime(startTime)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -81,9 +83,7 @@
</span><span class="cx">         unsigned column = 0;
</span><span class="cx">         visitor-&gt;computeLineAndColumn(line, column);
</span><span class="cx">         m_currentNode = ProfileNode::create(m_exec, LegacyProfiler::createCallIdentifier(m_exec, visitor-&gt;callee(), visitor-&gt;sourceURL(), line, column), m_rootNode.get());
</span><del>-        // Assume that profile times are relative to when the |console.profile| command is evaluated.
-        // This matches the logic in JSStartProfiling() and InspectorTimelineAgent::startFromConsole().
-        m_currentNode-&gt;appendCall(ProfileNode::Call(0.0));
</del><ins>+        m_currentNode-&gt;appendCall(ProfileNode::Call(m_startTime));
</ins><span class="cx">         m_rootNode-&gt;spliceNode(m_currentNode.get());
</span><span class="cx"> 
</span><span class="cx">         m_foundParent = true;
</span><span class="lines">@@ -96,11 +96,12 @@
</span><span class="cx">     bool m_foundParent;
</span><span class="cx">     RefPtr&lt;ProfileNode&gt;&amp; m_rootNode;
</span><span class="cx">     RefPtr&lt;ProfileNode&gt;&amp; m_currentNode;
</span><ins>+    double m_startTime;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-void ProfileGenerator::addParentForConsoleStart(ExecState* exec)
</del><ins>+void ProfileGenerator::addParentForConsoleStart(ExecState* exec, double startTime)
</ins><span class="cx"> {
</span><del>-    AddParentForConsoleStartFunctor functor(exec, m_rootNode, m_currentNode);
</del><ins>+    AddParentForConsoleStartFunctor functor(exec, m_rootNode, m_currentNode, startTime);
</ins><span class="cx">     exec-&gt;iterate(functor);
</span><span class="cx"> 
</span><span class="cx">     m_foundConsoleStartParent = functor.foundParent();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfileGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfileGenerator.h (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfileGenerator.h        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/JavaScriptCore/profiler/ProfileGenerator.h        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         ProfileGenerator(ExecState*, const WTF::String&amp; title, unsigned uid, PassRefPtr&lt;Stopwatch&gt;);
</span><del>-        void addParentForConsoleStart(ExecState*);
</del><ins>+        void addParentForConsoleStart(ExecState*, double);
</ins><span class="cx"> 
</span><span class="cx">         void removeProfileStart();
</span><span class="cx">         void removeProfileEnd();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/WebCore/ChangeLog        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-05-11  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
+        https://bugs.webkit.org/show_bug.cgi?id=144808
+
+        Reviewed by Darin Adler.
+
+        Profiles started from the console should always use the Inspector environment's shared stopwatch.
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::startFromConsole):
+
</ins><span class="cx"> 2015-05-11  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [Content Extensions] Support domain-specific rules and exceptions.
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (184116 => 184117)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2015-05-11 19:54:15 UTC (rev 184116)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2015-05-11 20:09:14 UTC (rev 184117)
</span><span class="lines">@@ -257,11 +257,7 @@
</span><span class="cx">     if (!m_enabled &amp;&amp; m_pendingConsoleProfileRecords.isEmpty())
</span><span class="cx">         internalStart();
</span><span class="cx"> 
</span><del>-    // Use an independent stopwatch for console-initiated profiling, since the user will expect it
-    // to be relative to when their command was issued.
-    Ref&lt;Stopwatch&gt; profilerStopwatch = Stopwatch::create();
-    profilerStopwatch-&gt;start();
-    startProfiling(exec, title, WTF::move(profilerStopwatch));
</del><ins>+    startProfiling(exec, title, m_instrumentingAgents-&gt;inspectorEnvironment().executionStopwatch());
</ins><span class="cx"> 
</span><span class="cx">     m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>