<!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>[201148] branches/safari-602.1.32-branch</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/201148">201148</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-05-19 01:41:03 -0700 (Thu, 19 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/200651">r200651</a>. rdar://problem/26188642</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602132branchLayoutTestsChangeLog">branches/safari-602.1.32-branch/LayoutTests/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceJavaScriptCoreChangeLog">branches/safari-602.1.32-branch/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceJavaScriptCoreinspectorprotocolTimelinejson">branches/safari-602.1.32-branch/Source/JavaScriptCore/inspector/protocol/Timeline.json</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreChangeLog">branches/safari-602.1.32-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreinspectorInspectorControllercpp">branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreinspectorInspectorInstrumentationcpp">branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreinspectorInspectorTimelineAgentcpp">branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp</a></li>
<li><a href="#branchessafari602132branchSourceWebCoreinspectorInspectorTimelineAgenth">branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.h</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIChangeLog">branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceProtocolTimelineObserverjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari602132branchLayoutTestsinspectortimelinesetAutoCaptureInstrumentserrorsexpectedtxt">branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors-expected.txt</a></li>
<li><a href="#branchessafari602132branchLayoutTestsinspectortimelinesetAutoCaptureInstrumentserrorshtml">branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602132branchLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/LayoutTests/ChangeLog (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/LayoutTests/ChangeLog        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/LayoutTests/ChangeLog        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r200651. rdar://problem/26188642
+
+ 2016-05-10 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Backend should initiate timeline recordings on page navigations to ensure nothing is missed
+ https://bugs.webkit.org/show_bug.cgi?id=157504
+ <rdar://problem/26188642>
+
+ Reviewed by Brian Burg.
+
+ * inspector/timeline/setAutoCaptureInstruments-errors-expected.txt: Added.
+ * inspector/timeline/setAutoCaptureInstruments-errors.html: Added.
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r201090. rdar://problem/26334636
</span><span class="cx">
</span><span class="cx"> 2016-05-18 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchLayoutTestsinspectortimelinesetAutoCaptureInstrumentserrorsexpectedtxt"></a>
<div class="addfile"><h4>Added: branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors-expected.txt (0 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors-expected.txt         (rev 0)
+++ branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors-expected.txt        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Tests for error cases with Timeline.setAutoCaptureInstruments.
+
+
+== Running test suite: Timeline.setAutoCaptureInstruments.errors
+-- Running test case: MissingRequiredArgument
+PASS: Should be an error: Some arguments of method 'Timeline.setAutoCaptureInstruments' can't be processed
+
+-- Running test case: InvalidTypeInInstrumentsList
+PASS: Should be an error: Unexpected type in instruments list, should be string
+
+-- Running test case: InvalidInstrumentInInstrumentsList
+PASS: Should be an error: Unexpected enum value: NoSuchInstrument
+
+-- Running test case: ValidInstrumentInInstrumentsList
+PASS: Should not be an error setting valid instruments.
+
</ins></span></pre></div>
<a id="branchessafari602132branchLayoutTestsinspectortimelinesetAutoCaptureInstrumentserrorshtml"></a>
<div class="addfile"><h4>Added: branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors.html (0 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors.html         (rev 0)
+++ branches/safari-602.1.32-branch/LayoutTests/inspector/timeline/setAutoCaptureInstruments-errors.html        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
+<script>
+function test()
+{
+ let suite = ProtocolTest.createAsyncSuite("Timeline.setAutoCaptureInstruments.errors");
+
+ ProtocolTest.dumpActivityToSystemConsole = true;
+ ProtocolTest.dumpInspectorProtocolMessages = true;
+
+ suite.addTestCase({
+ name: "MissingRequiredArgument",
+ test: (resolve, reject) => {
+ InspectorProtocol.sendCommand("Timeline.setAutoCaptureInstruments", {}, (messageObject) => {
+ ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvalidTypeInInstrumentsList",
+ test: (resolve, reject) => {
+ InspectorProtocol.sendCommand("Timeline.setAutoCaptureInstruments", {"instruments": [123]}, (messageObject) => {
+ ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "InvalidInstrumentInInstrumentsList",
+ test: (resolve, reject) => {
+ InspectorProtocol.sendCommand("Timeline.setAutoCaptureInstruments", {"instruments": ["NoSuchInstrument"]}, (messageObject) => {
+ ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "ValidInstrumentInInstrumentsList",
+ test: (resolve, reject) => {
+ InspectorProtocol.sendCommand("Timeline.setAutoCaptureInstruments", {"instruments": ["ScriptProfiler", "Heap", "Timeline", "Memory"]}, (messageObject) => {
+ ProtocolTest.expectThat(!messageObject.error, "Should not be an error setting valid instruments.");
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests for error cases with Timeline.setAutoCaptureInstruments.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="branchessafari602132branchSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/JavaScriptCore/ChangeLog (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/JavaScriptCore/ChangeLog        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/JavaScriptCore/ChangeLog        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
+ Merge r200651. rdar://problem/26188642
+
+ 2016-05-10 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Backend should initiate timeline recordings on page navigations to ensure nothing is missed
+ https://bugs.webkit.org/show_bug.cgi?id=157504
+ <rdar://problem/26188642>
+
+ Reviewed by Brian Burg.
+
+ * inspector/protocol/Timeline.json:
+ Add protocol commands to enable/disable auto capture and list the
+ instruments that should be enabled when auto capture starts.
+ Add protocol event for when the backend starts an auto capture.
+
</ins><span class="cx"> 2016-05-17 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge r200866. rdar://problem/26253396
</span></span></pre></div>
<a id="branchessafari602132branchSourceJavaScriptCoreinspectorprotocolTimelinejson"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/JavaScriptCore/inspector/protocol/Timeline.json (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/JavaScriptCore/inspector/protocol/Timeline.json        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/JavaScriptCore/inspector/protocol/Timeline.json        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -6,6 +6,7 @@
</span><span class="cx"> {
</span><span class="cx"> "id": "EventType",
</span><span class="cx"> "type": "string",
</span><ins>+ "description": "Timeline record type.",
</ins><span class="cx"> "enum": [
</span><span class="cx"> "EventDispatch",
</span><span class="cx"> "ScheduleStyleRecalculation",
</span><span class="lines">@@ -28,18 +29,28 @@
</span><span class="cx"> "RequestAnimationFrame",
</span><span class="cx"> "CancelAnimationFrame",
</span><span class="cx"> "FireAnimationFrame"
</span><del>- ],
- "description": "Timeline record type."
</del><ins>+ ]
</ins><span class="cx"> },
</span><span class="cx"> {
</span><ins>+ "id": "Instrument",
+ "type": "string",
+ "description": "Instrument types.",
+ "enum": [
+ "ScriptProfiler",
+ "Timeline",
+ "Memory",
+ "Heap"
+ ]
+ },
+ {
</ins><span class="cx"> "id": "TimelineEvent",
</span><span class="cx"> "type": "object",
</span><ins>+ "description": "Timeline record contains information about the recorded activity.",
</ins><span class="cx"> "properties": [
</span><span class="cx"> { "name": "type", "$ref": "EventType", "description": "Event type." },
</span><span class="cx"> { "name": "data", "type": "object", "description": "Event data." },
</span><span class="cx"> { "name": "children", "type": "array", "optional": true, "items": { "$ref": "TimelineEvent" }, "description": "Nested records." }
</span><del>- ],
- "description": "Timeline record contains information about the recorded activity."
</del><ins>+ ]
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "id": "CPUProfileNodeAggregateCallInfo",
</span><span class="lines">@@ -79,37 +90,55 @@
</span><span class="cx"> "commands": [
</span><span class="cx"> {
</span><span class="cx"> "name": "start",
</span><ins>+ "description": "Starts capturing instrumentation events.",
</ins><span class="cx"> "parameters": [
</span><span class="cx"> { "name": "maxCallStackDepth", "optional": true, "type": "integer", "description": "Samples JavaScript stack traces up to <code>maxCallStackDepth</code>, defaults to 5." }
</span><del>- ],
- "description": "Starts capturing instrumentation events."
</del><ins>+ ]
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "name": "stop",
</span><span class="cx"> "description": "Stops capturing instrumentation events."
</span><ins>+ },
+ {
+ "name": "setAutoCaptureEnabled",
+ "description": "Toggle auto capture state. If <code>true</code> the backend will disable breakpoints and start capturing on navigation. The backend will fire the <code>autoCaptureStarted</code> event when an auto capture starts. The frontend should stop the auto capture when appropriate and re-enable breakpoints.",
+ "parameters": [
+ { "name": "enabled", "type": "boolean", "description": "New auto capture state." }
+ ]
+ },
+ {
+ "name": "setAutoCaptureInstruments",
+ "description": "Instruments to enable when an auto capture starts.",
+ "parameters": [
+ { "name": "instruments", "type": "array", "items": { "$ref": "Instrument" }, "description": "Instruments to enable." }
+ ]
</ins><span class="cx"> }
</span><span class="cx"> ],
</span><span class="cx"> "events": [
</span><span class="cx"> {
</span><span class="cx"> "name": "eventRecorded",
</span><ins>+ "description": "Fired for every instrumentation event while timeline is started.",
</ins><span class="cx"> "parameters": [
</span><span class="cx"> { "name": "record", "$ref": "TimelineEvent", "description": "Timeline event record data." }
</span><del>- ],
- "description": "Fired for every instrumentation event while timeline is started."
</del><ins>+ ]
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "name": "recordingStarted",
</span><ins>+ "description": "Fired when recording has started.",
</ins><span class="cx"> "parameters": [
</span><span class="cx"> { "name": "startTime", "type": "number", "description": "Start time of this new recording." }
</span><del>- ],
- "description": "Fired when recording has started."
</del><ins>+ ]
</ins><span class="cx"> },
</span><span class="cx"> {
</span><span class="cx"> "name": "recordingStopped",
</span><ins>+ "description": "Fired when recording has stopped.",
</ins><span class="cx"> "parameters": [
</span><span class="cx"> { "name": "endTime", "type": "number", "description": "End time of this recording." }
</span><del>- ],
- "description": "Fired when recording has stopped."
</del><ins>+ ]
+ },
+ {
+ "name": "autoCaptureStarted",
+ "description": "Fired when auto capture started."
</ins><span class="cx"> }
</span><span class="cx"> ]
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/ChangeLog (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/ChangeLog        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebCore/ChangeLog        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -1,5 +1,42 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r200651. rdar://problem/26188642
+
+ 2016-05-10 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Backend should initiate timeline recordings on page navigations to ensure nothing is missed
+ https://bugs.webkit.org/show_bug.cgi?id=157504
+ <rdar://problem/26188642>
+
+ Reviewed by Brian Burg.
+
+ Test: inspector/timeline/setAutoCaptureInstruments-errors.html
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ Pass other agents into the TimelineAgent constructor.
+
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::frameStartedLoadingImpl):
+ Inform the TimelineAgent whenever the main frame starts a new load.
+
+ * inspector/InspectorTimelineAgent.h:
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::InspectorTimelineAgent):
+ Initialize new members.
+
+ (WebCore::InspectorTimelineAgent::willDestroyFrontendAndBackend):
+ Cleanup auto capture state when tearing down.
+
+ (WebCore::InspectorTimelineAgent::setAutoCaptureEnabled):
+ (WebCore::InspectorTimelineAgent::setAutoCaptureInstruments):
+ Set and validate new auto capture state from the frontend.
+
+ (WebCore::InspectorTimelineAgent::mainFrameStartedLoading):
+ When page navigates start an auto capture if needed.
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r201090. rdar://problem/26334636
</span><span class="cx">
</span><span class="cx"> 2016-05-18 Simon Fraser <simon.fraser@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorController.cpp (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorController.cpp        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorController.cpp        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -158,25 +158,28 @@
</span><span class="cx"> InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
</span><span class="cx"> m_agents.append(WTFMove(domStorageAgentPtr));
</span><span class="cx">
</span><del>- auto timelineAgentPtr = std::make_unique<InspectorTimelineAgent>(pageContext, pageAgent);
- m_timelineAgent = timelineAgentPtr.get();
- m_agents.append(WTFMove(timelineAgentPtr));
-
</del><span class="cx"> auto heapAgentPtr = std::make_unique<InspectorHeapAgent>(pageContext);
</span><span class="cx"> InspectorHeapAgent* heapAgent = heapAgentPtr.get();
</span><span class="cx"> m_agents.append(WTFMove(heapAgentPtr));
</span><span class="cx">
</span><ins>+ auto scriptProfilerAgentPtr = std::make_unique<InspectorScriptProfilerAgent>(pageContext);
+ InspectorScriptProfilerAgent* scriptProfilerAgent = scriptProfilerAgentPtr.get();
+ m_agents.append(WTFMove(scriptProfilerAgentPtr));
+
</ins><span class="cx"> auto consoleAgentPtr = std::make_unique<PageConsoleAgent>(pageContext, heapAgent, m_domAgent);
</span><span class="cx"> WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
</span><span class="cx"> m_instrumentingAgents->setWebConsoleAgent(consoleAgentPtr.get());
</span><span class="cx"> m_agents.append(WTFMove(consoleAgentPtr));
</span><span class="cx">
</span><ins>+ auto timelineAgentPtr = std::make_unique<InspectorTimelineAgent>(pageContext, scriptProfilerAgent, heapAgent, pageAgent);
+ m_timelineAgent = timelineAgentPtr.get();
+ m_agents.append(WTFMove(timelineAgentPtr));
+
</ins><span class="cx"> auto debuggerAgentPtr = std::make_unique<PageDebuggerAgent>(pageContext, pageAgent, m_overlay.get());
</span><span class="cx"> PageDebuggerAgent* debuggerAgent = debuggerAgentPtr.get();
</span><span class="cx"> m_agents.append(WTFMove(debuggerAgentPtr));
</span><span class="cx">
</span><span class="cx"> m_agents.append(std::make_unique<InspectorDOMDebuggerAgent>(pageContext, m_domAgent, debuggerAgent));
</span><del>- m_agents.append(std::make_unique<InspectorScriptProfilerAgent>(pageContext));
</del><span class="cx"> m_agents.append(std::make_unique<InspectorApplicationCacheAgent>(pageContext, pageAgent));
</span><span class="cx"> m_agents.append(std::make_unique<InspectorLayerTreeAgent>(pageContext));
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -775,6 +775,8 @@
</span><span class="cx"> if (frame.isMainFrame()) {
</span><span class="cx"> if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
</span><span class="cx"> pageDebuggerAgent->mainFrameStartedLoading();
</span><ins>+ if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.persistentInspectorTimelineAgent())
+ timelineAgent->mainFrameStartedLoading();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (InspectorPageAgent* inspectorPageAgent = instrumentingAgents.inspectorPageAgent())
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreinspectorInspectorTimelineAgentcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx">
</span><span class="cx"> #include "Event.h"
</span><span class="cx"> #include "Frame.h"
</span><ins>+#include "InspectorMemoryAgent.h"
</ins><span class="cx"> #include "InspectorPageAgent.h"
</span><span class="cx"> #include "InstrumentingAgents.h"
</span><span class="cx"> #include "JSDOMWindow.h"
</span><span class="lines">@@ -43,6 +44,9 @@
</span><span class="cx"> #include "ScriptState.h"
</span><span class="cx"> #include "TimelineRecordFactory.h"
</span><span class="cx"> #include <inspector/ScriptBreakpoint.h>
</span><ins>+#include <inspector/agents/InspectorDebuggerAgent.h>
+#include <inspector/agents/InspectorHeapAgent.h>
+#include <inspector/agents/InspectorScriptProfilerAgent.h>
</ins><span class="cx"> #include <profiler/LegacyProfiler.h>
</span><span class="cx"> #include <wtf/Stopwatch.h>
</span><span class="cx">
</span><span class="lines">@@ -77,6 +81,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+InspectorTimelineAgent::InspectorTimelineAgent(WebAgentContext& context, InspectorScriptProfilerAgent* scriptProfileAgent, InspectorHeapAgent* heapAgent, InspectorPageAgent* pageAgent)
+ : InspectorAgentBase(ASCIILiteral("Timeline"), context)
+ , m_frontendDispatcher(std::make_unique<Inspector::TimelineFrontendDispatcher>(context.frontendRouter))
+ , m_backendDispatcher(Inspector::TimelineBackendDispatcher::create(context.backendDispatcher, this))
+ , m_scriptProfilerAgent(scriptProfileAgent)
+ , m_heapAgent(heapAgent)
+ , m_pageAgent(pageAgent)
+{
+}
+
</ins><span class="cx"> InspectorTimelineAgent::~InspectorTimelineAgent()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -92,6 +106,9 @@
</span><span class="cx">
</span><span class="cx"> ErrorString unused;
</span><span class="cx"> stop(unused);
</span><ins>+
+ m_autoCaptureEnabled = false;
+ m_autoCaptureInstruments.clear();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void InspectorTimelineAgent::start(ErrorString&, const int* maxCallStackDepth)
</span><span class="lines">@@ -108,6 +125,35 @@
</span><span class="cx"> m_enabledFromFrontend = false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InspectorTimelineAgent::setAutoCaptureEnabled(ErrorString&, bool enabled)
+{
+ m_autoCaptureEnabled = enabled;
+}
+
+void InspectorTimelineAgent::setAutoCaptureInstruments(ErrorString& errorString, const InspectorArray& instruments)
+{
+ Vector<Protocol::Timeline::Instrument> newInstruments;
+ newInstruments.reserveCapacity(instruments.length());
+
+ for (auto instrumentValue : instruments) {
+ String enumValueString;
+ if (!instrumentValue->asString(enumValueString)) {
+ errorString = ASCIILiteral("Unexpected type in instruments list, should be string");
+ return;
+ }
+
+ Optional<Protocol::Timeline::Instrument> instrumentType = Protocol::InspectorHelpers::parseEnumValueFromString<Protocol::Timeline::Instrument>(enumValueString);
+ if (!instrumentType) {
+ errorString = makeString("Unexpected enum value: ", enumValueString);
+ return;
+ }
+
+ newInstruments.uncheckedAppend(*instrumentType);
+ }
+
+ m_autoCaptureInstruments.swap(newInstruments);
+}
+
</ins><span class="cx"> void InspectorTimelineAgent::internalStart(const int* maxCallStackDepth)
</span><span class="cx"> {
</span><span class="cx"> if (m_enabled)
</span><span class="lines">@@ -384,6 +430,60 @@
</span><span class="cx"> appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeEnd, true, &frame);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InspectorTimelineAgent::mainFrameStartedLoading()
+{
+ if (m_enabled)
+ return;
+
+ if (!m_autoCaptureEnabled)
+ return;
+
+ if (m_autoCaptureInstruments.isEmpty())
+ return;
+
+ // Pre-emptively disable breakpoints. The frontend must re-enable them.
+ if (InspectorDebuggerAgent* debuggerAgent = m_instrumentingAgents.inspectorDebuggerAgent()) {
+ ErrorString unused;
+ debuggerAgent->setBreakpointsActive(unused, false);
+ }
+
+ // Inform the frontend we started an auto capture. The frontend must stop capture.
+ m_frontendDispatcher->autoCaptureStarted();
+
+ // Enable instruments.
+ for (auto instrumentType : m_autoCaptureInstruments) {
+ switch (instrumentType) {
+ case Inspector::Protocol::Timeline::Instrument::ScriptProfiler: {
+ if (m_scriptProfilerAgent) {
+ ErrorString unused;
+ const bool includeSamples = true;
+ m_scriptProfilerAgent->startTracking(unused, &includeSamples);
+ }
+ break;
+ }
+ case Inspector::Protocol::Timeline::Instrument::Heap: {
+ if (m_heapAgent) {
+ ErrorString unused;
+ m_heapAgent->startTracking(unused);
+ }
+ break;
+ }
+ case Inspector::Protocol::Timeline::Instrument::Memory: {
+#if ENABLE(RESOURCE_USAGE)
+ if (InspectorMemoryAgent* memoryAgent = m_instrumentingAgents.inspectorMemoryAgent()) {
+ ErrorString unused;
+ memoryAgent->startTracking(unused);
+ }
+#endif
+ break;
+ }
+ case Inspector::Protocol::Timeline::Instrument::Timeline:
+ internalStart();
+ break;
+ }
+ }
+}
+
</ins><span class="cx"> void InspectorTimelineAgent::didCommitLoad()
</span><span class="cx"> {
</span><span class="cx"> clearRecordStack();
</span><span class="lines">@@ -524,14 +624,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-InspectorTimelineAgent::InspectorTimelineAgent(WebAgentContext& context, InspectorPageAgent* pageAgent)
- : InspectorAgentBase(ASCIILiteral("Timeline"), context)
- , m_frontendDispatcher(std::make_unique<Inspector::TimelineFrontendDispatcher>(context.frontendRouter))
- , m_backendDispatcher(Inspector::TimelineBackendDispatcher::create(context.backendDispatcher, this))
- , m_pageAgent(pageAgent)
-{
-}
-
</del><span class="cx"> void InspectorTimelineAgent::appendRecord(RefPtr<InspectorObject>&& data, TimelineRecordType type, bool captureCallStack, Frame* frame)
</span><span class="cx"> {
</span><span class="cx"> Ref<InspectorObject> record = TimelineRecordFactory::createGenericRecord(timestamp(), captureCallStack ? m_maxCallStackDepth : 0);
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebCoreinspectorInspectorTimelineAgenth"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.h (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.h        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebCore/inspector/InspectorTimelineAgent.h        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -45,6 +45,11 @@
</span><span class="cx"> class Profile;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+namespace Inspector {
+class InspectorHeapAgent;
+class InspectorScriptProfilerAgent;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class Event;
</span><span class="lines">@@ -92,7 +97,7 @@
</span><span class="cx"> WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent);
</span><span class="cx"> WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>- InspectorTimelineAgent(WebAgentContext&, InspectorPageAgent*);
</del><ins>+ InspectorTimelineAgent(WebAgentContext&, Inspector::InspectorScriptProfilerAgent*, Inspector::InspectorHeapAgent*, InspectorPageAgent*);
</ins><span class="cx"> virtual ~InspectorTimelineAgent();
</span><span class="cx">
</span><span class="cx"> void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
</span><span class="lines">@@ -100,6 +105,8 @@
</span><span class="cx">
</span><span class="cx"> void start(ErrorString&, const int* maxCallStackDepth = nullptr) final;
</span><span class="cx"> void stop(ErrorString&) final;
</span><ins>+ void setAutoCaptureEnabled(ErrorString&, bool) final;
+ void setAutoCaptureInstruments(ErrorString&, const Inspector::InspectorArray&) final;
</ins><span class="cx">
</span><span class="cx"> int id() const { return m_id; }
</span><span class="cx">
</span><span class="lines">@@ -137,6 +144,7 @@
</span><span class="cx"> void didFireAnimationFrame();
</span><span class="cx"> void time(Frame&, const String&);
</span><span class="cx"> void timeEnd(Frame&, const String&);
</span><ins>+ void mainFrameStartedLoading();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> // ScriptDebugListener
</span><span class="lines">@@ -191,6 +199,8 @@
</span><span class="cx">
</span><span class="cx"> std::unique_ptr<Inspector::TimelineFrontendDispatcher> m_frontendDispatcher;
</span><span class="cx"> RefPtr<Inspector::TimelineBackendDispatcher> m_backendDispatcher;
</span><ins>+ Inspector::InspectorScriptProfilerAgent* m_scriptProfilerAgent;
+ Inspector::InspectorHeapAgent* m_heapAgent;
</ins><span class="cx"> InspectorPageAgent* m_pageAgent;
</span><span class="cx">
</span><span class="cx"> Vector<TimelineRecordEntry> m_recordStack;
</span><span class="lines">@@ -202,6 +212,9 @@
</span><span class="cx"> bool m_enabled { false };
</span><span class="cx"> bool m_enabledFromFrontend { false };
</span><span class="cx">
</span><ins>+ bool m_autoCaptureEnabled { false };
+ Vector<Inspector::Protocol::Timeline::Instrument> m_autoCaptureInstruments;
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx"> std::unique_ptr<WebCore::RunLoopObserver> m_frameStartObserver;
</span><span class="cx"> std::unique_ptr<WebCore::RunLoopObserver> m_frameStopObserver;
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -1,5 +1,47 @@
</span><span class="cx"> 2016-05-19 Babak Shafiei <bshafiei@apple.com>
</span><span class="cx">
</span><ins>+ Merge r200651. rdar://problem/26188642
+
+ 2016-05-10 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Backend should initiate timeline recordings on page navigations to ensure nothing is missed
+ https://bugs.webkit.org/show_bug.cgi?id=157504
+ <rdar://problem/26188642>
+
+ Reviewed by Brian Burg.
+
+ * UserInterface/Controllers/TimelineManager.js:
+ (WebInspector.TimelineManager):
+ (WebInspector.TimelineManager.prototype.set autoCaptureOnPageLoad):
+ (WebInspector.TimelineManager.prototype.set enabledTimelineTypes):
+ (WebInspector.TimelineManager.prototype._updateAutoCaptureInstruments):
+ For backends that support it, enable/disable auto capture and the instruments to use.
+
+ (WebInspector.TimelineManager.prototype.autoCaptureStarted):
+ New event, stop and start a new recording. Set a flag that we should
+ detect the auto capturing resource so we know when the stop the
+ auto capture.
+
+ (WebInspector.TimelineManager.prototype._loadNewRecording):
+ (WebInspector.TimelineManager.prototype._addRecord):
+ (WebInspector.TimelineManager.prototype._startAutoCapturing): Renamed.
+ (WebInspector.TimelineManager.prototype._attemptAutoCapturingForFrame):
+ (WebInspector.TimelineManager.prototype._legacyAttemptStartAutoCapturingForFrame):
+ (WebInspector.TimelineManager.prototype._stopAutoRecordingSoon):
+ (WebInspector.TimelineManager.prototype._resetAutoRecordingMaxTimeTimeout):
+ (WebInspector.TimelineManager.prototype._resetAutoRecordingDeadTimeTimeout):
+ (WebInspector.TimelineManager.prototype._mainResourceDidChange):
+ (WebInspector.TimelineManager.prototype._mergeScriptProfileRecords):
+ Factor out the new path, old path, and shared code for auto capturing.
+ Renamed _startAutoCapturing to _attemptAutoCapturingForFrame which
+ better matches what it tries to do.
+
+ * UserInterface/Protocol/TimelineObserver.js:
+ (WebInspector.TimelineObserver.prototype.autoCaptureStarted):
+ Inform TimelineManager.
+
+2016-05-19 Babak Shafiei <bshafiei@apple.com>
+
</ins><span class="cx"> Merge r200949. rdar://problem/26262219
</span><span class="cx">
</span><span class="cx"> 2016-05-14 Timothy Hatcher <timothy@apple.com>
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx">
</span><del>- WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._startAutoCapturing, this);
</del><ins>+ WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted, this._provisionalLoadStarted, this);
</ins><span class="cx"> WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
</span><span class="cx"> WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
</span><span class="cx">
</span><span class="lines">@@ -37,12 +37,15 @@
</span><span class="cx"> WebInspector.memoryManager.addEventListener(WebInspector.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
</span><span class="cx">
</span><span class="cx"> this._enabledTimelineTypesSetting = new WebInspector.Setting("enabled-instrument-types", WebInspector.TimelineManager.defaultTimelineTypes());
</span><ins>+ this._updateAutoCaptureInstruments();
</ins><span class="cx">
</span><span class="cx"> this._persistentNetworkTimeline = new WebInspector.NetworkTimeline;
</span><span class="cx">
</span><span class="cx"> this._isCapturing = false;
</span><span class="cx"> this._isCapturingPageReload = false;
</span><del>- this._autoCapturingMainResource = null;
</del><ins>+ this._autoCaptureOnPageLoad = false;
+ this._mainResourceForAutoCapturing = null;
+ this._shouldSetAutoCapturingMainResource = false;
</ins><span class="cx"> this._boundStopCapturing = this.stopCapturing.bind(this);
</span><span class="cx">
</span><span class="cx"> this._webTimelineScriptRecordsExpectingScriptProfilerEvents = null;
</span><span class="lines">@@ -128,6 +131,9 @@
</span><span class="cx"> set autoCaptureOnPageLoad(autoCapture)
</span><span class="cx"> {
</span><span class="cx"> this._autoCaptureOnPageLoad = autoCapture;
</span><ins>+
+ if (window.TimelineAgent && TimelineAgent.setAutoCaptureEnabled)
+ TimelineAgent.setAutoCaptureEnabled(autoCapture);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> get enabledTimelineTypes()
</span><span class="lines">@@ -139,6 +145,8 @@
</span><span class="cx"> set enabledTimelineTypes(x)
</span><span class="cx"> {
</span><span class="cx"> this._enabledTimelineTypesSetting.value = x || [];
</span><ins>+
+ this._updateAutoCaptureInstruments();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> isCapturing()
</span><span class="lines">@@ -204,6 +212,8 @@
</span><span class="cx">
</span><span class="cx"> capturingStarted(startTime)
</span><span class="cx"> {
</span><ins>+ // Called from WebInspector.TimelineObserver.
+
</ins><span class="cx"> if (this._isCapturing)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -219,6 +229,8 @@
</span><span class="cx">
</span><span class="cx"> capturingStopped(endTime)
</span><span class="cx"> {
</span><ins>+ // Called from WebInspector.TimelineObserver.
+
</ins><span class="cx"> if (!this._isCapturing)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -234,11 +246,24 @@
</span><span class="cx">
</span><span class="cx"> this._isCapturing = false;
</span><span class="cx"> this._isCapturingPageReload = false;
</span><del>- this._autoCapturingMainResource = null;
</del><ins>+ this._shouldSetAutoCapturingMainResource = false;
+ this._mainResourceForAutoCapturing = null;
</ins><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStopped, {endTime});
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ autoCaptureStarted(startTime)
+ {
+ // Called from WebInspector.TimelineObserver.
+
+ if (this._isCapturing)
+ this.stopCapturing();
+
+ this.startCapturing(true);
+
+ this._shouldSetAutoCapturingMainResource = true;
+ }
+
</ins><span class="cx"> eventRecorded(recordPayload)
</span><span class="cx"> {
</span><span class="cx"> // Called from WebInspector.TimelineObserver.
</span><span class="lines">@@ -591,10 +616,10 @@
</span><span class="cx"> // Now that we have navigated, we should reset the legacy base timestamp and the
</span><span class="cx"> // will send request timestamp for the new main resource. This way, all new timeline
</span><span class="cx"> // records will be computed relative to the new navigation.
</span><del>- if (this._autoCapturingMainResource && WebInspector.TimelineRecording.isLegacy) {
- console.assert(this._autoCapturingMainResource.originalRequestWillBeSentTimestamp);
- this._activeRecording.setLegacyBaseTimestamp(this._autoCapturingMainResource.originalRequestWillBeSentTimestamp);
- this._autoCapturingMainResource._requestSentTimestamp = 0;
</del><ins>+ if (this._mainResourceForAutoCapturing && WebInspector.TimelineRecording.isLegacy) {
+ console.assert(this._mainResourceForAutoCapturing.originalRequestWillBeSentTimestamp);
+ this._activeRecording.setLegacyBaseTimestamp(this._mainResourceForAutoCapturing.originalRequestWillBeSentTimestamp);
+ this._mainResourceForAutoCapturing._requestSentTimestamp = 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingLoaded, {oldRecording});
</span><span class="lines">@@ -617,25 +642,58 @@
</span><span class="cx"> this._resetAutoRecordingDeadTimeTimeout();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- _startAutoCapturing(event)
</del><ins>+ _attemptAutoCapturingForFrame(frame)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._autoCaptureOnPageLoad)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (!event.target.isMainFrame() || (this._isCapturing && !this._autoCapturingMainResource))
</del><ins>+ if (!frame.isMainFrame())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- var mainResource = event.target.provisionalMainResource || event.target.mainResource;
- if (mainResource === this._autoCapturingMainResource)
</del><ins>+ // COMPATIBILITY (iOS 9): Timeline.setAutoCaptureEnabled did not exist.
+ // Perform auto capture in the frontend.
+ if (!TimelineAgent.setAutoCaptureEnabled)
+ return this._legacyAttemptStartAutoCapturingForFrame(frame);
+
+ if (!this._shouldSetAutoCapturingMainResource)
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- var oldMainResource = event.target.mainResource || null;
</del><ins>+ console.assert(this._isCapturing, "We saw autoCaptureStarted so we should already be capturing");
+
+ let mainResource = frame.provisionalMainResource || frame.mainResource;
+ if (mainResource === this._mainResourceForAutoCapturing)
+ return false;
+
+ let oldMainResource = frame.mainResource || null;
</ins><span class="cx"> this._isCapturingPageReload = oldMainResource !== null && oldMainResource.url === mainResource.url;
</span><span class="cx">
</span><ins>+ this._mainResourceForAutoCapturing = mainResource;
+
+ this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));
+
+ this._resetAutoRecordingMaxTimeTimeout();
+
+ this._shouldSetAutoCapturingMainResource = false;
+
+ return true;
+ }
+
+ _legacyAttemptStartAutoCapturingForFrame(frame)
+ {
+ if (this._isCapturing && !this._mainResourceForAutoCapturing)
+ return false;
+
+ let mainResource = frame.provisionalMainResource || frame.mainResource;
+ if (mainResource === this._mainResourceForAutoCapturing)
+ return false;
+
+ let oldMainResource = frame.mainResource || null;
+ this._isCapturingPageReload = oldMainResource !== null && oldMainResource.url === mainResource.url;
+
</ins><span class="cx"> if (this._isCapturing)
</span><span class="cx"> this.stopCapturing();
</span><span class="cx">
</span><del>- this._autoCapturingMainResource = mainResource;
</del><ins>+ this._mainResourceForAutoCapturing = mainResource;
</ins><span class="cx">
</span><span class="cx"> this._loadNewRecording();
</span><span class="cx">
</span><span class="lines">@@ -643,9 +701,7 @@
</span><span class="cx">
</span><span class="cx"> this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));
</span><span class="cx">
</span><del>- if (this._stopCapturingTimeout)
- clearTimeout(this._stopCapturingTimeout);
- this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.MaximumAutoRecordDuration);
</del><ins>+ this._resetAutoRecordingMaxTimeTimeout();
</ins><span class="cx">
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="lines">@@ -653,7 +709,7 @@
</span><span class="cx"> _stopAutoRecordingSoon()
</span><span class="cx"> {
</span><span class="cx"> // Only auto stop when auto capturing.
</span><del>- if (!this._isCapturing || !this._autoCapturingMainResource)
</del><ins>+ if (!this._isCapturing || !this._mainResourceForAutoCapturing)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (this._stopCapturingTimeout)
</span><span class="lines">@@ -661,10 +717,17 @@
</span><span class="cx"> this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ _resetAutoRecordingMaxTimeTimeout()
+ {
+ if (this._stopCapturingTimeout)
+ clearTimeout(this._stopCapturingTimeout);
+ this._stopCapturingTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.MaximumAutoRecordDuration);
+ }
+
</ins><span class="cx"> _resetAutoRecordingDeadTimeTimeout()
</span><span class="cx"> {
</span><span class="cx"> // Only monitor dead time when auto capturing.
</span><del>- if (!this._isCapturing || !this._autoCapturingMainResource)
</del><ins>+ if (!this._isCapturing || !this._mainResourceForAutoCapturing)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (this._deadTimeTimeout)
</span><span class="lines">@@ -672,13 +735,19 @@
</span><span class="cx"> this._deadTimeTimeout = setTimeout(this._boundStopCapturing, WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ _provisionalLoadStarted(event)
+ {
+ this._attemptAutoCapturingForFrame(event.target);
+ }
+
</ins><span class="cx"> _mainResourceDidChange(event)
</span><span class="cx"> {
</span><del>- if (event.target.isMainFrame())
</del><ins>+ let frame = event.target;
+ if (frame.isMainFrame())
</ins><span class="cx"> this._persistentNetworkTimeline.reset();
</span><span class="cx">
</span><del>- var mainResource = event.target.mainResource;
- var record = new WebInspector.ResourceTimelineRecord(mainResource);
</del><ins>+ let mainResource = frame.mainResource;
+ let record = new WebInspector.ResourceTimelineRecord(mainResource);
</ins><span class="cx"> if (!isNaN(record.startTime))
</span><span class="cx"> this._persistentNetworkTimeline.addRecord(record);
</span><span class="cx">
</span><span class="lines">@@ -687,13 +756,13 @@
</span><span class="cx"> if (!WebInspector.frameResourceManager.mainFrame)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (this._startAutoCapturing(event))
</del><ins>+ if (this._attemptAutoCapturingForFrame(frame))
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (!this._isCapturing)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (mainResource === this._autoCapturingMainResource)
</del><ins>+ if (mainResource === this._mainResourceForAutoCapturing)
</ins><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this._addRecord(record);
</span><span class="lines">@@ -891,6 +960,39 @@
</span><span class="cx"> // However, the remaining ScriptProfiler records are valid and could be shown.
</span><span class="cx"> // FIXME: <https://webkit.org/b/152904> Web Inspector: Timeline UI should keep up with processing all incoming records
</span><span class="cx"> }
</span><ins>+
+ _updateAutoCaptureInstruments()
+ {
+ if (!window.TimelineAgent)
+ return;
+
+ if (!TimelineAgent.setAutoCaptureInstruments)
+ return;
+
+ let instrumentSet = new Set;
+ let enabledTimelineTypes = this._enabledTimelineTypesSetting.value;
+
+ for (let timelineType of enabledTimelineTypes) {
+ switch (timelineType) {
+ case WebInspector.TimelineRecord.Type.Script:
+ instrumentSet.add(TimelineAgent.Instrument.ScriptProfiler);
+ break;
+ case WebInspector.TimelineRecord.Type.HeapAllocations:
+ instrumentSet.add(TimelineAgent.Instrument.Heap);
+ break;
+ case WebInspector.TimelineRecord.Type.Network:
+ case WebInspector.TimelineRecord.Type.RenderingFrame:
+ case WebInspector.TimelineRecord.Type.Layout:
+ instrumentSet.add(TimelineAgent.Instrument.Timeline);
+ break;
+ case WebInspector.TimelineRecord.Type.Memory:
+ instrumentSet.add(TimelineAgent.Instrument.Memory);
+ break;
+ }
+ }
+
+ TimelineAgent.setAutoCaptureInstruments([...instrumentSet]);
+ }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WebInspector.TimelineManager.Event = {
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceProtocolTimelineObserverjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js (201147 => 201148)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js        2016-05-19 08:40:55 UTC (rev 201147)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Protocol/TimelineObserver.js        2016-05-19 08:41:03 UTC (rev 201148)
</span><span class="lines">@@ -41,4 +41,9 @@
</span><span class="cx"> {
</span><span class="cx"> WebInspector.timelineManager.capturingStopped(endTime);
</span><span class="cx"> }
</span><ins>+
+ autoCaptureStarted()
+ {
+ WebInspector.timelineManager.autoCaptureStarted();
+ }
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>
</body>
</html>