Title: [174322] trunk/Source
Revision
174322
Author
[email protected]
Date
2014-10-04 14:55:58 -0700 (Sat, 04 Oct 2014)

Log Message

Unreviewed, rolling out r174319.

Causes assertions in fast/profiler tests. Needs nontrivial
investigation, will take offline.

Reverted changeset:

"Web Inspector: timelines should not count time elapsed while
paused in the debugger"
https://bugs.webkit.org/show_bug.cgi?id=136351
http://trac.webkit.org/changeset/174319

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/API/JSProfilerPrivate.cpp (174321 => 174322)


--- trunk/Source/_javascript_Core/API/JSProfilerPrivate.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/API/JSProfilerPrivate.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -34,7 +34,7 @@
 
 void JSStartProfiling(JSContextRef ctx, JSStringRef title)
 {
-    LegacyProfiler::profiler()->startProfiling(toJS(ctx), title->string(), Stopwatch::create());
+    LegacyProfiler::profiler()->startProfiling(toJS(ctx), title->string());
 }
 
 void JSEndProfiling(JSContextRef ctx, JSStringRef title)

Modified: trunk/Source/_javascript_Core/ChangeLog (174321 => 174322)


--- trunk/Source/_javascript_Core/ChangeLog	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-10-04 21:55:58 UTC (rev 174322)
@@ -1,5 +1,19 @@
 2014-10-04  Brian J. Burg  <[email protected]>
 
+        Unreviewed, rolling out r174319.
+
+        Causes assertions in fast/profiler tests. Needs nontrivial
+        investigation, will take offline.
+
+        Reverted changeset:
+
+        "Web Inspector: timelines should not count time elapsed while
+        paused in the debugger"
+        https://bugs.webkit.org/show_bug.cgi?id=136351
+        http://trac.webkit.org/changeset/174319
+
+2014-10-04  Brian J. Burg  <[email protected]>
+
         Web Inspector: timelines should not count time elapsed while paused in the debugger
         https://bugs.webkit.org/show_bug.cgi?id=136351
 

Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp (174321 => 174322)


--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -38,6 +38,7 @@
 #include "JSJavaScriptCallFrame.h"
 #include "JSLock.h"
 #include "_javascript_CallFrame.h"
+#include "LegacyProfiler.h"
 #include "ScriptValue.h"
 #include "SourceProvider.h"
 #include <wtf/NeverDestroyed.h>
@@ -306,12 +307,14 @@
 void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject)
 {
     dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause);
+    LegacyProfiler::profiler()->didPause(currentDebuggerCallFrame());
     didPause(vmEntryGlobalObject);
 
     m_doneProcessingDebuggerEvents = false;
     runEventLoopWhilePaused();
 
     didContinue(vmEntryGlobalObject);
+    LegacyProfiler::profiler()->didContinue(currentDebuggerCallFrame());
     dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue);
 }
 

Modified: trunk/Source/_javascript_Core/profiler/LegacyProfiler.cpp (174321 => 174322)


--- trunk/Source/_javascript_Core/profiler/LegacyProfiler.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/profiler/LegacyProfiler.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -32,6 +32,7 @@
 #include "CallFrame.h"
 #include "CodeBlock.h"
 #include "CommonIdentifiers.h"
+#include "DebuggerCallFrame.h"
 #include "InternalFunction.h"
 #include "JSFunction.h"
 #include "JSGlobalObject.h"
@@ -49,16 +50,16 @@
 
 static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSObject*, const String& defaultSourceURL, unsigned defaultLineNumber, unsigned defaultColumnNumber);
 
-LegacyProfiler* LegacyProfiler::s_sharedLegacyProfiler = nullptr;
+LegacyProfiler* LegacyProfiler::s_sharedLegacyProfiler = 0;
 
 LegacyProfiler* LegacyProfiler::profiler()
 {
     if (!s_sharedLegacyProfiler)
         s_sharedLegacyProfiler = new LegacyProfiler();
     return s_sharedLegacyProfiler;
-}
+}   
 
-void LegacyProfiler::startProfiling(ExecState* exec, const String& title, PassRefPtr<Stopwatch> stopwatch)
+void LegacyProfiler::startProfiling(ExecState* exec, const String& title)
 {
     if (!exec)
         return;
@@ -74,14 +75,14 @@
     }
 
     exec->vm().setEnabledProfiler(this);
-    RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID, stopwatch);
+    RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID);
     m_currentProfiles.append(profileGenerator);
 }
 
 PassRefPtr<Profile> LegacyProfiler::stopProfiling(ExecState* exec, const String& title)
 {
     if (!exec)
-        return nullptr;
+        return 0;
 
     JSGlobalObject* origin = exec->lexicalGlobalObject();
     for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
@@ -93,12 +94,12 @@
             m_currentProfiles.remove(i);
             if (!m_currentProfiles.size())
                 exec->vm().setEnabledProfiler(nullptr);
-
+            
             return returnProfile;
         }
     }
 
-    return nullptr;
+    return 0;
 }
 
 void LegacyProfiler::stopProfiling(JSGlobalObject* origin)
@@ -183,6 +184,28 @@
     callFunctionForProfilesWithGroup(std::bind(&ProfileGenerator::exceptionUnwind, std::placeholders::_1, handlerCallFrame, callIdentifier), m_currentProfiles, handlerCallFrame->lexicalGlobalObject()->profileGroup());
 }
 
+void LegacyProfiler::didPause(PassRefPtr<DebuggerCallFrame> prpCallFrame)
+{
+    if (m_currentProfiles.isEmpty())
+        return;
+
+    RefPtr<DebuggerCallFrame> callFrame = prpCallFrame;
+    CallIdentifier callIdentifier = createCallIdentifier(callFrame->exec(), JSValue(), StringImpl::empty(), 0, 0);
+
+    callFunctionForProfilesWithGroup(std::bind(&ProfileGenerator::didPause, std::placeholders::_1, callFrame, callIdentifier), m_currentProfiles, callFrame->vmEntryGlobalObject()->profileGroup());
+}
+
+void LegacyProfiler::didContinue(PassRefPtr<DebuggerCallFrame> prpCallFrame)
+{
+    if (m_currentProfiles.isEmpty())
+        return;
+
+    RefPtr<DebuggerCallFrame> callFrame = prpCallFrame;
+    CallIdentifier callIdentifier = createCallIdentifier(callFrame->exec(), JSValue(), StringImpl::empty(), 0, 0);
+
+    callFunctionForProfilesWithGroup(std::bind(&ProfileGenerator::didContinue, std::placeholders::_1, callFrame, callIdentifier), m_currentProfiles, callFrame->vmEntryGlobalObject()->profileGroup());
+}
+
 CallIdentifier LegacyProfiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const String& defaultSourceURL, unsigned defaultLineNumber, unsigned defaultColumnNumber)
 {
     if (!functionValue)

Modified: trunk/Source/_javascript_Core/profiler/LegacyProfiler.h (174321 => 174322)


--- trunk/Source/_javascript_Core/profiler/LegacyProfiler.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/profiler/LegacyProfiler.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -32,12 +32,13 @@
 #include "Profile.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
-#include <wtf/Stopwatch.h>
 #include <wtf/Vector.h>
 
 namespace JSC {
 
+class DebuggerCallFrame;
 class ExecState;
+class VM;
 class JSGlobalObject;
 class JSObject;
 class JSValue;
@@ -47,10 +48,10 @@
 class LegacyProfiler {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    JS_EXPORT_PRIVATE static LegacyProfiler* profiler();
+    JS_EXPORT_PRIVATE static LegacyProfiler* profiler(); 
     static CallIdentifier createCallIdentifier(ExecState*, JSValue, const WTF::String& sourceURL, unsigned defaultLineNumber, unsigned defaultColumnNumber);
 
-    JS_EXPORT_PRIVATE void startProfiling(ExecState*, const WTF::String& title, PassRefPtr<Stopwatch>);
+    JS_EXPORT_PRIVATE void startProfiling(ExecState*, const WTF::String& title);
     JS_EXPORT_PRIVATE PassRefPtr<Profile> stopProfiling(ExecState*, const WTF::String& title);
     void stopProfiling(JSGlobalObject*);
 
@@ -65,6 +66,9 @@
 
     void exceptionUnwind(ExecState* handlerCallFrame);
 
+    void didPause(PassRefPtr<DebuggerCallFrame>);
+    void didContinue(PassRefPtr<DebuggerCallFrame>);
+
     const Vector<RefPtr<ProfileGenerator>>& currentProfiles() { return m_currentProfiles; };
 
 private:

Modified: trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp (174321 => 174322)


--- trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/profiler/ProfileGenerator.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -28,6 +28,7 @@
 
 #include "CallFrame.h"
 #include "CodeBlock.h"
+#include "Debugger.h"
 #include "JSGlobalObject.h"
 #include "JSStringRef.h"
 #include "JSFunction.h"
@@ -39,18 +40,21 @@
 
 namespace JSC {
 
-PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const String& title, unsigned uid, PassRefPtr<Stopwatch> stopwatch)
+PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const String& title, unsigned uid)
 {
-    return adoptRef(new ProfileGenerator(exec, title, uid, stopwatch));
+    return adoptRef(new ProfileGenerator(exec, title, uid));
 }
 
-ProfileGenerator::ProfileGenerator(ExecState* exec, const String& title, unsigned uid, PassRefPtr<Stopwatch> stopwatch)
+ProfileGenerator::ProfileGenerator(ExecState* exec, const String& title, unsigned uid)
     : m_origin(exec ? exec->lexicalGlobalObject() : nullptr)
     , m_profileGroup(exec ? exec->lexicalGlobalObject()->profileGroup() : 0)
-    , m_stopwatch(stopwatch)
+    , m_debuggerPausedTimestamp(NAN)
     , m_foundConsoleStartParent(false)
     , m_suspended(false)
 {
+    if (Debugger* debugger = exec->lexicalGlobalObject()->debugger())
+        m_debuggerPausedTimestamp = debugger->isPaused() ? currentTime() : NAN;
+
     m_profile = Profile::create(title, uid);
     m_currentNode = m_rootNode = m_profile->rootNode();
     if (exec)
@@ -114,8 +118,13 @@
     ASSERT_ARG(node, node);
 
     if (isnan(startTime))
-        startTime = m_stopwatch->elapsedTime();
+        startTime = currentTime();
 
+    // If the debugger is paused when beginning, then don't set the start time. It
+    // will be fixed up when the debugger unpauses or the call entry ends.
+    if (!isnan(m_debuggerPausedTimestamp))
+        startTime = NAN;
+
     node->appendCall(ProfileNode::Call(startTime));
 }
 
@@ -124,8 +133,22 @@
     ASSERT_ARG(node, node);
 
     ProfileNode::Call& last = node->lastCall();
+
+    // If the debugger is paused, ignore the interval that ends now.
+    if (!isnan(m_debuggerPausedTimestamp) && !isnan(last.elapsedTime()))
+        return;
+
+    // If paused and no time was accrued then the debugger was never unpaused. The call will
+    // have no time accrued and appear to have started when the debugger was paused.
+    if (!isnan(m_debuggerPausedTimestamp)) {
+        last.setStartTime(m_debuggerPausedTimestamp);
+        last.setElapsedTime(0.0);
+        return;
+    }
+
+    // Otherwise, add the interval ending now to elapsed time.
     double previousElapsedTime = isnan(last.elapsedTime()) ? 0.0 : last.elapsedTime();
-    double newlyElapsedTime = m_stopwatch->elapsedTime() - last.startTime();
+    double newlyElapsedTime = currentTime() - last.startTime();
     last.setElapsedTime(previousElapsedTime + newlyElapsedTime);
 }
 
@@ -200,6 +223,33 @@
     }
 }
 
+void ProfileGenerator::didPause(PassRefPtr<DebuggerCallFrame>, const CallIdentifier&)
+{
+    ASSERT(isnan(m_debuggerPausedTimestamp));
+
+    m_debuggerPausedTimestamp = currentTime();
+
+    for (ProfileNode* node = m_currentNode.get(); node != m_profile->rootNode(); node = node->parent()) {
+        ProfileNode::Call& last = node->lastCall();
+        ASSERT(!isnan(last.startTime()));
+
+        double previousElapsedTime = isnan(last.elapsedTime()) ? 0.0 : last.elapsedTime();
+        double additionalElapsedTime = m_debuggerPausedTimestamp - last.startTime();
+        last.setStartTime(NAN);
+        last.setElapsedTime(previousElapsedTime + additionalElapsedTime);
+    }
+}
+
+void ProfileGenerator::didContinue(PassRefPtr<DebuggerCallFrame>, const CallIdentifier&)
+{
+    ASSERT(!isnan(m_debuggerPausedTimestamp));
+
+    for (ProfileNode* node = m_currentNode.get(); node != m_profile->rootNode(); node = node->parent())
+        node->lastCall().setStartTime(m_debuggerPausedTimestamp);
+
+    m_debuggerPausedTimestamp = NAN;
+}
+
 void ProfileGenerator::stopProfiling()
 {
     for (ProfileNode* node = m_currentNode.get(); node != m_profile->rootNode(); node = node->parent())

Modified: trunk/Source/_javascript_Core/profiler/ProfileGenerator.h (174321 => 174322)


--- trunk/Source/_javascript_Core/profiler/ProfileGenerator.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/_javascript_Core/profiler/ProfileGenerator.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -29,7 +29,6 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
-#include <wtf/Stopwatch.h>
 #include <wtf/text/WTFString.h>
 
 namespace JSC {
@@ -43,7 +42,7 @@
 
     class ProfileGenerator : public RefCounted<ProfileGenerator>  {
     public:
-        static PassRefPtr<ProfileGenerator> create(ExecState*, const WTF::String& title, unsigned uid, PassRefPtr<Stopwatch>);
+        static PassRefPtr<ProfileGenerator> create(ExecState*, const WTF::String& title, unsigned uid);
 
         // Members
         const WTF::String& title() const;
@@ -55,12 +54,15 @@
         void didExecute(ExecState* callerCallFrame, const CallIdentifier&);
         void exceptionUnwind(ExecState* handlerCallFrame, const CallIdentifier&);
 
+        void didPause(PassRefPtr<DebuggerCallFrame>, const CallIdentifier&);
+        void didContinue(PassRefPtr<DebuggerCallFrame>, const CallIdentifier&);
+
         void setIsSuspended(bool suspended) { ASSERT(m_suspended != suspended); m_suspended = suspended; }
 
         void stopProfiling();
 
     private:
-        ProfileGenerator(ExecState*, const WTF::String& title, unsigned uid, PassRefPtr<Stopwatch>);
+        ProfileGenerator(ExecState*, const WTF::String& title, unsigned uid);
         void addParentForConsoleStart(ExecState*);
 
         void removeProfileStart();
@@ -72,7 +74,8 @@
         RefPtr<Profile> m_profile;
         JSGlobalObject* m_origin;
         unsigned m_profileGroup;
-        RefPtr<Stopwatch> m_stopwatch;
+        // Timestamp is set to NAN when the debugger is not currently paused.
+        double m_debuggerPausedTimestamp;
         RefPtr<ProfileNode> m_rootNode;
         RefPtr<ProfileNode> m_currentNode;
         bool m_foundConsoleStartParent;

Modified: trunk/Source/WTF/ChangeLog (174321 => 174322)


--- trunk/Source/WTF/ChangeLog	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/ChangeLog	2014-10-04 21:55:58 UTC (rev 174322)
@@ -1,5 +1,19 @@
 2014-10-04  Brian J. Burg  <[email protected]>
 
+        Unreviewed, rolling out r174319.
+
+        Causes assertions in fast/profiler tests. Needs nontrivial
+        investigation, will take offline.
+
+        Reverted changeset:
+
+        "Web Inspector: timelines should not count time elapsed while
+        paused in the debugger"
+        https://bugs.webkit.org/show_bug.cgi?id=136351
+        http://trac.webkit.org/changeset/174319
+
+2014-10-04  Brian J. Burg  <[email protected]>
+
         Web Inspector: timelines should not count time elapsed while paused in the debugger
         https://bugs.webkit.org/show_bug.cgi?id=136351
 

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (174321 => 174322)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj	2014-10-04 21:55:58 UTC (rev 174322)
@@ -269,7 +269,6 @@
     <ClInclude Include="..\wtf\StackBounds.h" />
     <ClInclude Include="..\wtf\StaticConstructors.h" />
     <ClInclude Include="..\wtf\StdLibExtras.h" />
-    <ClInclude Include="..\wtf\Stopwatch.h" />
     <ClInclude Include="..\wtf\StringExtras.h" />
     <ClInclude Include="..\wtf\StringHasher.h" />
     <ClInclude Include="..\wtf\StringPrintStream.h" />

Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (174321 => 174322)


--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters	2014-10-04 21:55:58 UTC (rev 174322)
@@ -609,9 +609,6 @@
     <ClInclude Include="..\wtf\StdLibExtras.h">
       <Filter>wtf</Filter>
     </ClInclude>
-    <ClInclude Include="..\wtf\Stopwatch.h">
-      <Filter>wtf</Filter>
-    </ClInclude>
     <ClInclude Include="..\wtf\StringExtras.h">
       <Filter>wtf</Filter>
     </ClInclude>

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (174321 => 174322)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2014-10-04 21:55:58 UTC (rev 174322)
@@ -272,7 +272,6 @@
 		A8A47487151A825B004123FF /* WTFThreadData.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4737B151A825B004123FF /* WTFThreadData.h */; };
 		A8A4748C151A8264004123FF /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4748B151A8264004123FF /* config.h */; };
 		B38FD7BD168953E80065C969 /* FeatureDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = B38FD7BC168953E80065C969 /* FeatureDefines.h */; };
-		C4F8A93719C65EB400B2B15D /* Stopwatch.h in Headers */ = {isa = PBXBuildFile; fileRef = C4F8A93619C65EB400B2B15D /* Stopwatch.h */; };
 		CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
 		CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; };
 		CE46516E19DB1FB4003ECA05 /* NSMapTableSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */; };
@@ -565,7 +564,6 @@
 		A8A4737B151A825B004123FF /* WTFThreadData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTFThreadData.h; sourceTree = "<group>"; };
 		A8A4748B151A8264004123FF /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; };
 		B38FD7BC168953E80065C969 /* FeatureDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FeatureDefines.h; sourceTree = "<group>"; };
-		C4F8A93619C65EB400B2B15D /* Stopwatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Stopwatch.h; sourceTree = "<group>"; };
 		CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
 		CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
 		CE46516D19DB1FB4003ECA05 /* NSMapTableSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMapTableSPI.h; sourceTree = "<group>"; };
@@ -858,7 +856,6 @@
 				FEDACD3C1630F83F00C69634 /* StackStats.h */,
 				A8A47310151A825B004123FF /* StaticConstructors.h */,
 				A8A47311151A825B004123FF /* StdLibExtras.h */,
-				C4F8A93619C65EB400B2B15D /* Stopwatch.h */,
 				1A6BB768162F300500DD16DB /* StreamBuffer.h */,
 				A8A47313151A825B004123FF /* StringExtras.h */,
 				A748745117A0BDAE00FA04CB /* StringHashDumpContext.h */,
@@ -1078,7 +1075,6 @@
 				A8A473A3151A825B004123FF /* DecimalNumber.h in Headers */,
 				0F2B66A617B6B4FB00A7AE3F /* DeferrableRefCounted.h in Headers */,
 				A8A473A5151A825B004123FF /* Deque.h in Headers */,
-				C4F8A93719C65EB400B2B15D /* Stopwatch.h in Headers */,
 				A8A473A6151A825B004123FF /* DisallowCType.h in Headers */,
 				A8A473AF151A825B004123FF /* diy-fp.h in Headers */,
 				A8A473B1151A825B004123FF /* double-conversion.h in Headers */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (174321 => 174322)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2014-10-04 21:55:58 UTC (rev 174322)
@@ -92,7 +92,6 @@
     StackStats.h
     StaticConstructors.h
     StdLibExtras.h
-    Stopwatch.h
     StringExtras.h
     StringHasher.h
     StringPrintStream.h

Deleted: trunk/Source/WTF/wtf/Stopwatch.h (174321 => 174322)


--- trunk/Source/WTF/wtf/Stopwatch.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WTF/wtf/Stopwatch.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2014 University of Washington. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef Stopwatch_h
-#define Stopwatch_h
-
-#include <cmath>
-#include <wtf/CurrentTime.h>
-#include <wtf/RefCounted.h>
-
-namespace WTF {
-
-class Stopwatch : public RefCounted<Stopwatch> {
-public:
-    static PassRefPtr<Stopwatch> create()
-    {
-        return adoptRef(new Stopwatch());
-    }
-
-    void reset();
-    void start();
-    void stop();
-
-    double elapsedTime();
-
-private:
-    Stopwatch()
-        : m_elapsedTime(NAN)
-        , m_lastStartTime(NAN)
-    {
-    }
-
-    double m_elapsedTime;
-    double m_lastStartTime;
-};
-
-inline void Stopwatch::reset()
-{
-    m_elapsedTime = 0.0;
-    m_lastStartTime = NAN;
-}
-
-inline void Stopwatch::start()
-{
-    ASSERT(!isnan(m_elapsedTime) && isnan(m_lastStartTime));
-
-    m_lastStartTime = monotonicallyIncreasingTime();
-}
-
-inline void Stopwatch::stop()
-{
-    ASSERT(!isnan(m_elapsedTime) && !isnan(m_lastStartTime));
-
-    m_elapsedTime += monotonicallyIncreasingTime() - m_lastStartTime;
-    m_lastStartTime = NAN;
-}
-
-inline double Stopwatch::elapsedTime()
-{
-    bool shouldSuspend = !isnan(m_lastStartTime);
-    if (shouldSuspend)
-        stop();
-
-    ASSERT(!isnan(m_elapsedTime) && isnan(m_lastStartTime));
-    double elapsedTime = m_elapsedTime;
-
-    if (shouldSuspend)
-        start();
-    return elapsedTime;
-}
-
-} // namespace WTF
-
-using WTF::Stopwatch;
-
-#endif // Stopwatch_h

Modified: trunk/Source/WebCore/ChangeLog (174321 => 174322)


--- trunk/Source/WebCore/ChangeLog	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/ChangeLog	2014-10-04 21:55:58 UTC (rev 174322)
@@ -1,5 +1,19 @@
 2014-10-04  Brian J. Burg  <[email protected]>
 
+        Unreviewed, rolling out r174319.
+
+        Causes assertions in fast/profiler tests. Needs nontrivial
+        investigation, will take offline.
+
+        Reverted changeset:
+
+        "Web Inspector: timelines should not count time elapsed while
+        paused in the debugger"
+        https://bugs.webkit.org/show_bug.cgi?id=136351
+        http://trac.webkit.org/changeset/174319
+
+2014-10-04  Brian J. Burg  <[email protected]>
+
         Web Inspector: timelines should not count time elapsed while paused in the debugger
         https://bugs.webkit.org/show_bug.cgi?id=136351
 

Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -57,6 +57,7 @@
 #include "StyleSheetList.h"
 #include "WebKitNamedFlow.h"
 #include <inspector/InspectorValues.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/HashSet.h>
 #include <wtf/Ref.h>
 #include <wtf/Vector.h>

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -57,7 +57,6 @@
 #include "InspectorDOMAgent.h"
 #include "InspectorInstrumentation.h"
 #include "InspectorOverlay.h"
-#include "InspectorTimelineAgent.h"
 #include "InspectorWebFrontendDispatchers.h"
 #include "InstrumentingAgents.h"
 #include "MainFrame.h"
@@ -74,6 +73,7 @@
 #include <inspector/ContentSearchUtilities.h>
 #include <inspector/IdentifiersFactory.h>
 #include <inspector/InspectorValues.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/ListHashSet.h>
 #include <wtf/Vector.h>
 #include <wtf/text/Base64.h>
@@ -361,16 +361,6 @@
 #endif
 }
 
-double InspectorPageAgent::timestamp()
-{
-    // If the timeline agent is recording now, use its stopwatch. Otherwise, just report 0.0
-    // since the timestamps are only used to accurately graph records on the timeline.
-    if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
-        return timelineAgent->timestamp();
-
-    return 0.0;
-}
-
 void InspectorPageAgent::enable(ErrorString&)
 {
     m_enabled = true;
@@ -762,12 +752,12 @@
 void InspectorPageAgent::domContentEventFired()
 {
     m_isFirstLayoutAfterOnLoad = true;
-    m_frontendDispatcher->domContentEventFired(timestamp());
+    m_frontendDispatcher->domContentEventFired(currentTime());
 }
 
 void InspectorPageAgent::loadEventFired()
 {
-    m_frontendDispatcher->loadEventFired(timestamp());
+    m_frontendDispatcher->loadEventFired(currentTime());
 }
 
 void InspectorPageAgent::frameNavigated(DocumentLoader* loader)

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -167,8 +167,6 @@
     void updateTouchEventEmulationInPage(bool);
 #endif
 
-    double timestamp();
-
     static bool mainResourceContent(Frame*, bool withBase64Encode, String* result);
     static bool dataContent(const char* data, unsigned size, const String& textEncodingName, bool withBase64Encode, String* result);
 

Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -47,7 +47,6 @@
 #include "IconController.h"
 #include "InspectorClient.h"
 #include "InspectorPageAgent.h"
-#include "InspectorTimelineAgent.h"
 #include "InspectorWebFrontendDispatchers.h"
 #include "InstrumentingAgents.h"
 #include "JSMainThreadExecState.h"
@@ -70,6 +69,7 @@
 #include <inspector/InspectorValues.h>
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
+#include <wtf/CurrentTime.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -276,16 +276,6 @@
     ASSERT(!m_instrumentingAgents->inspectorResourceAgent());
 }
 
-double InspectorResourceAgent::timestamp()
-{
-    // If the timeline agent is recording now, use its stopwatch. Otherwise, just report 0.0
-    // since the timestamps are only used to accurately graph records on the timeline.
-    if (InspectorTimelineAgent* timelineAgent = m_instrumentingAgents->inspectorTimelineAgent())
-        return timelineAgent->timestamp();
-
-    return 0.0;
-}
-
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
     if (request.hiddenFromInspector()) {
@@ -330,7 +320,7 @@
     Inspector::Protocol::Page::ResourceType resourceType = InspectorPageAgent::resourceTypeJson(type);
 
     RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : nullptr);
-    m_frontendDispatcher->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), timestamp(), initiatorObject, buildObjectForResourceResponse(redirectResponse, loader), type != InspectorPageAgent::OtherResource ? &resourceType : nullptr);
+    m_frontendDispatcher->requestWillBeSent(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), loader->url().string(), buildObjectForResourceRequest(request), currentTime(), initiatorObject, buildObjectForResourceResponse(redirectResponse, loader), type != InspectorPageAgent::OtherResource ? &resourceType : nullptr);
 }
 
 void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
@@ -375,7 +365,7 @@
     m_resourcesData->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), response);
     m_resourcesData->setResourceType(requestId, type);
 
-    m_frontendDispatcher->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), timestamp(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
+    m_frontendDispatcher->responseReceived(requestId, m_pageAgent->frameId(loader->frame()), m_pageAgent->loaderId(loader), currentTime(), InspectorPageAgent::resourceTypeJson(type), resourceResponse);
 
     // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
     // as there will be no calls to didReceiveData from the network stack.
@@ -401,7 +391,7 @@
             m_resourcesData->maybeAddResourceData(requestId, data, dataLength);
     }
 
-    m_frontendDispatcher->dataReceived(requestId, timestamp(), dataLength, encodedDataLength);
+    m_frontendDispatcher->dataReceived(requestId, currentTime(), dataLength, encodedDataLength);
 }
 
 void InspectorResourceAgent::didFinishLoading(unsigned long identifier, DocumentLoader* loader, double finishTime)
@@ -421,7 +411,7 @@
     // However, all other times passed to the Inspector are generated from the web process. Mixing
     // times from different processes can cause the finish time to be earlier than the response
     // received time due to inter-process communication lag.
-    finishTime = timestamp();
+    finishTime = currentTime();
 
     String sourceMappingURL;
     NetworkResourcesData::ResourceData const* resourceData = m_resourcesData->data(requestId);
@@ -447,7 +437,7 @@
     }
 
     bool canceled = error.isCancellation();
-    m_frontendDispatcher->loadingFailed(requestId, timestamp(), error.localizedDescription(), canceled ? &canceled : nullptr);
+    m_frontendDispatcher->loadingFailed(requestId, currentTime(), error.localizedDescription(), canceled ? &canceled : nullptr);
 }
 
 void InspectorResourceAgent::didLoadResourceFromMemoryCache(DocumentLoader* loader, CachedResource* resource)
@@ -466,7 +456,7 @@
 
     RefPtr<Inspector::Protocol::Network::Initiator> initiatorObject = buildInitiatorObject(loader->frame() ? loader->frame()->document() : nullptr);
 
-    m_frontendDispatcher->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), timestamp(), initiatorObject, buildObjectForCachedResource(resource, loader));
+    m_frontendDispatcher->requestServedFromMemoryCache(requestId, frameId, loaderId, loader->url().string(), currentTime(), initiatorObject, buildObjectForCachedResource(resource, loader));
 }
 
 void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, const String& sourceString)
@@ -598,7 +588,7 @@
 {
     RefPtr<Inspector::Protocol::Network::WebSocketRequest> requestObject = Inspector::Protocol::Network::WebSocketRequest::create()
         .setHeaders(buildObjectForHeaders(request.httpHeaderFields()));
-    m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), timestamp(), requestObject);
+    m_frontendDispatcher->webSocketWillSendHandshakeRequest(IdentifiersFactory::requestId(identifier), currentTime(), requestObject);
 }
 
 void InspectorResourceAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const ResourceResponse& response)
@@ -607,12 +597,12 @@
         .setStatus(response.httpStatusCode())
         .setStatusText(response.httpStatusText())
         .setHeaders(buildObjectForHeaders(response.httpHeaderFields()));
-    m_frontendDispatcher->webSocketHandshakeResponseReceived(IdentifiersFactory::requestId(identifier), timestamp(), responseObject);
+    m_frontendDispatcher->webSocketHandshakeResponseReceived(IdentifiersFactory::requestId(identifier), currentTime(), responseObject);
 }
 
 void InspectorResourceAgent::didCloseWebSocket(unsigned long identifier)
 {
-    m_frontendDispatcher->webSocketClosed(IdentifiersFactory::requestId(identifier), timestamp());
+    m_frontendDispatcher->webSocketClosed(IdentifiersFactory::requestId(identifier), currentTime());
 }
 
 void InspectorResourceAgent::didReceiveWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
@@ -621,7 +611,7 @@
         .setOpcode(frame.opCode)
         .setMask(frame.masked)
         .setPayloadData(String(frame.payload, frame.payloadLength));
-    m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), timestamp(), frameObject);
+    m_frontendDispatcher->webSocketFrameReceived(IdentifiersFactory::requestId(identifier), currentTime(), frameObject);
 }
 
 void InspectorResourceAgent::didSendWebSocketFrame(unsigned long identifier, const WebSocketFrame& frame)
@@ -630,12 +620,12 @@
         .setOpcode(frame.opCode)
         .setMask(frame.masked)
         .setPayloadData(String(frame.payload, frame.payloadLength));
-    m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), timestamp(), frameObject);
+    m_frontendDispatcher->webSocketFrameSent(IdentifiersFactory::requestId(identifier), currentTime(), frameObject);
 }
 
 void InspectorResourceAgent::didReceiveWebSocketFrameError(unsigned long identifier, const String& errorMessage)
 {
-    m_frontendDispatcher->webSocketFrameError(IdentifiersFactory::requestId(identifier), timestamp(), errorMessage);
+    m_frontendDispatcher->webSocketFrameError(IdentifiersFactory::requestId(identifier), currentTime(), errorMessage);
 }
 
 #endif // ENABLE(WEB_SOCKETS)

Modified: trunk/Source/WebCore/inspector/InspectorResourceAgent.h (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorResourceAgent.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorResourceAgent.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -138,8 +138,6 @@
 private:
     void enable();
 
-    double timestamp();
-
     InspectorPageAgent* m_pageAgent;
     InspectorClient* m_client;
     std::unique_ptr<Inspector::InspectorNetworkFrontendDispatcher> m_frontendDispatcher;

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -61,6 +61,11 @@
 
 namespace WebCore {
 
+void TimelineTimeConverter::reset()
+{
+    m_startOffset = monotonicallyIncreasingTime() - currentTime();
+}
+
 InspectorTimelineAgent::~InspectorTimelineAgent()
 {
 }
@@ -71,7 +76,6 @@
     m_backendDispatcher = InspectorTimelineBackendDispatcher::create(backendDispatcher, this);
 
     m_instrumentingAgents->setPersistentInspectorTimelineAgent(this);
-    m_stopwatch->reset();
 
     if (m_scriptDebugServer)
         m_scriptDebugServer->recompileAllJSFunctions();
@@ -114,7 +118,7 @@
     else
         m_maxCallStackDepth = 5;
 
-    m_stopwatch->start();
+    m_timeConverter.reset();
 
     m_instrumentingAgents->setInspectorTimelineAgent(this);
 
@@ -132,8 +136,6 @@
     if (!m_enabled)
         return;
 
-    m_stopwatch->stop();
-
     m_instrumentingAgents->setInspectorTimelineAgent(nullptr);
 
     if (m_scriptDebugServer)
@@ -155,9 +157,9 @@
     m_scriptDebugServer = scriptDebugServer;
 }
 
-static inline void startProfiling(JSC::ExecState* exec, const String& title, PassRefPtr<Stopwatch> stopwatch)
+static inline void startProfiling(JSC::ExecState* exec, const String& title)
 {
-    JSC::LegacyProfiler::profiler()->startProfiling(exec, title, stopwatch);
+    JSC::LegacyProfiler::profiler()->startProfiling(exec, title);
 }
 
 static inline PassRefPtr<JSC::Profile> stopProfiling(JSC::ExecState* exec, const String& title)
@@ -165,9 +167,9 @@
     return JSC::LegacyProfiler::profiler()->stopProfiling(exec, title);
 }
 
-static inline void startProfiling(Frame* frame, const String& title, PassRefPtr<Stopwatch> stopwatch)
+static inline void startProfiling(Frame* frame, const String& title)
 {
-    startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title, stopwatch);
+    startProfiling(toJSDOMWindow(frame, debuggerWorld())->globalExec(), title);
 }
 
 static inline PassRefPtr<JSC::Profile> stopProfiling(Frame* frame, const String& title)
@@ -191,7 +193,7 @@
     if (!m_enabled && m_pendingConsoleProfileRecords.isEmpty())
         internalStart();
 
-    startProfiling(exec, title, m_stopwatch);
+    startProfiling(exec, title);
 
     m_pendingConsoleProfileRecords.append(createRecordEntry(TimelineRecordFactory::createConsoleProfileData(title), TimelineRecordType::ConsoleProfile, true, frameFromExecState(exec)));
 }
@@ -230,7 +232,7 @@
     pushCurrentRecord(TimelineRecordFactory::createFunctionCallData(scriptName, scriptLine), TimelineRecordType::FunctionCall, true, frame);
 
     if (frame && !m_callStackDepth)
-        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"), m_stopwatch);
+        startProfiling(frame, ASCIILiteral("Timeline FunctionCall"));
 
     ++m_callStackDepth;
 }
@@ -405,7 +407,7 @@
 
     if (frame && !m_callStackDepth) {
         ++m_callStackDepth;
-        startProfiling(frame, ASCIILiteral("Timeline EvaluateScript"), m_stopwatch);
+        startProfiling(frame, ASCIILiteral("Timeline EvaluateScript"));
     }
 }
 
@@ -552,16 +554,6 @@
     appendRecord(TimelineRecordFactory::createProbeSampleData(action, hitCount), TimelineRecordType::ProbeSample, false, frameFromExecState(exec));
 }
 
-void InspectorTimelineAgent::didPause(JSC::ExecState*, const Deprecated::ScriptValue&, const Deprecated::ScriptValue&)
-{
-    m_stopwatch->stop();
-}
-
-void InspectorTimelineAgent::didContinue()
-{
-    m_stopwatch->start();
-}
-
 static Inspector::Protocol::Timeline::EventType toProtocol(TimelineRecordType type)
 {
     switch (type) {
@@ -698,7 +690,6 @@
     : InspectorAgentBase(ASCIILiteral("Timeline"), instrumentingAgents)
     , m_pageAgent(pageAgent)
     , m_scriptDebugServer(nullptr)
-    , m_stopwatch(Stopwatch::create())
     , m_id(1)
     , m_callStackDepth(0)
     , m_maxCallStackDepth(5)
@@ -757,7 +748,7 @@
 
 double InspectorTimelineAgent::timestamp()
 {
-    return m_stopwatch->elapsedTime();
+    return m_timeConverter.fromMonotonicallyIncreasingTime(monotonicallyIncreasingTime());
 }
 
 Page* InspectorTimelineAgent::page()

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (174321 => 174322)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2014-10-04 21:55:58 UTC (rev 174322)
@@ -40,7 +40,6 @@
 #include "LayoutRect.h"
 #include <inspector/InspectorValues.h>
 #include <inspector/ScriptDebugListener.h>
-#include <wtf/Stopwatch.h>
 #include <wtf/Vector.h>
 #include <wtf/WeakPtr.h>
 
@@ -114,6 +113,19 @@
     WebSocketDestroy
 };
 
+class TimelineTimeConverter {
+public:
+    TimelineTimeConverter()
+        : m_startOffset(0)
+    {
+    }
+    double fromMonotonicallyIncreasingTime(double time) const  { return (time - m_startOffset) * 1000.0; }
+    void reset();
+
+private:
+    double m_startOffset;
+};
+
 class InspectorTimelineAgent
     : public InspectorAgentBase
     , public Inspector::InspectorTimelineBackendDispatcherHandler
@@ -198,10 +210,6 @@
     void willFireAnimationFrame(int callbackId, Frame*);
     void didFireAnimationFrame();
 
-    // Returns the elapsed time from a monotonic stopwatch that starts with timeline recording and
-    // pauses when the debugger pauses or execution is otherwise suspended.
-    double timestamp();
-
 #if ENABLE(WEB_SOCKETS)
     void didCreateWebSocket(unsigned long identifier, const URL&, const String& protocol, Frame*);
     void willSendWebSocketHandshakeRequest(unsigned long identifier, Frame*);
@@ -210,11 +218,11 @@
 #endif
 
 protected:
-    // ScriptDebugListener
+    // ScriptDebugListener. This is only used to create records for probe samples.
     virtual void didParseSource(JSC::SourceID, const Script&) override { }
     virtual void failedToParseSource(const String&, const String&, int, int, const String&) override { }
-    virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue&, const Deprecated::ScriptValue&) override;
-    virtual void didContinue() override;
+    virtual void didPause(JSC::ExecState*, const Deprecated::ScriptValue&, const Deprecated::ScriptValue&) override { }
+    virtual void didContinue() override { }
 
     virtual void breakpointActionLog(JSC::ExecState*, const String&) override { }
     virtual void breakpointActionSound(int) override { }
@@ -256,15 +264,17 @@
     void clearRecordStack();
 
     void localToPageQuad(const RenderObject&, const LayoutRect&, FloatQuad*);
+    const TimelineTimeConverter& timeConverter() const { return m_timeConverter; }
+    double timestamp();
     Page* page();
 
     InspectorPageAgent* m_pageAgent;
     PageScriptDebugServer* m_scriptDebugServer;
+    TimelineTimeConverter m_timeConverter;
 
-    RefPtr<Stopwatch> m_stopwatch;
-
     std::unique_ptr<Inspector::InspectorTimelineFrontendDispatcher> m_frontendDispatcher;
     RefPtr<Inspector::InspectorTimelineBackendDispatcher> m_backendDispatcher;
+    double m_timestampOffset;
 
     Vector<TimelineRecordEntry> m_recordStack;
 

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (174321 => 174322)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2014-10-04 21:55:58 UTC (rev 174322)
@@ -47,6 +47,7 @@
 #include <inspector/ScriptCallStack.h>
 #include <inspector/ScriptCallStackFactory.h>
 #include <profiler/Profile.h>
+#include <wtf/CurrentTime.h>
 
 using namespace Inspector;
 

Modified: trunk/Source/WebInspectorUI/ChangeLog (174321 => 174322)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-10-04 21:55:58 UTC (rev 174322)
@@ -1,5 +1,19 @@
 2014-10-04  Brian J. Burg  <[email protected]>
 
+        Unreviewed, rolling out r174319.
+
+        Causes assertions in fast/profiler tests. Needs nontrivial
+        investigation, will take offline.
+
+        Reverted changeset:
+
+        "Web Inspector: timelines should not count time elapsed while
+        paused in the debugger"
+        https://bugs.webkit.org/show_bug.cgi?id=136351
+        http://trac.webkit.org/changeset/174319
+
+2014-10-04  Brian J. Burg  <[email protected]>
+
         Web Inspector: timelines should not count time elapsed while paused in the debugger
         https://bugs.webkit.org/show_bug.cgi?id=136351
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (174321 => 174322)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js	2014-10-04 21:55:58 UTC (rev 174322)
@@ -35,8 +35,6 @@
     this._activeRecording = null;
     this._isCapturing = false;
 
-    // For legacy backends, we compute the elapsed time of records relative to this timestamp.
-    this._legacyFirstRecordTimestamp = NaN;
     this._nextRecordingIdentifier = 1;
 
     this._boundStopCapturing = this.stopCapturing.bind(this);
@@ -57,7 +55,6 @@
     CapturingStopped: "timeline-manager-capturing-stopped"
 };
 
-WebInspector.TimelineManager.StartTimeThresholdForLegacyRecordConversion = 28800000; // Date.parse("Jan 1, 1970")
 WebInspector.TimelineManager.MaximumAutoRecordDuration = 90000; // 90 seconds
 WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent = 10000; // 10 seconds
 WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly = 2000; // 2 seconds
@@ -166,21 +163,10 @@
 
         function processRecord(recordPayload, parentRecordPayload)
         {
-            var startTime = recordPayload.startTime;
-            var endTime = recordPayload.endTime;
+            // Convert the timestamps to seconds to match the resource timestamps.
+            var startTime = recordPayload.startTime / 1000;
+            var endTime = recordPayload.endTime / 1000;
 
-            // COMPATIBILITY (iOS8): old versions use milliseconds since the epoch, rather
-            // than seconds elapsed since timeline capturing started. We approximate the latter by
-            // subtracting the start timestamp, as old versions did not use monotonic times.
-            if (isNaN(this._legacyFirstRecordTimestamp))
-                this._legacyFirstRecordTimestamp = recordPayload.startTime;
-
-            // If the record's start time sems unreasonably large, treat it as a legacy timestamp.
-            if (startTime > WebInspector.StartTimeThresholdForLegacyRecordConversion) {
-                startTime = (startTime - this._legacyFirstRecordTimestamp) / 1000;
-                endTime = isNaN(endTime) ? NaN : (startTime - this._legacyFirstRecordTimestamp) / 1000;
-            }
-
             var callFrames = this._callFramesFromPayload(recordPayload.stackTrace);
 
             var significantCallFrame = null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js (174321 => 174322)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2014-10-04 19:55:49 UTC (rev 174321)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineContentView.js	2014-10-04 21:55:58 UTC (rev 174322)
@@ -98,9 +98,6 @@
     WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted, this._capturingStarted, this);
     WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._capturingStopped, this);
 
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerPaused, this);
-    WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerResumed, this);
-
     this.showOverviewTimelineView();
 };
 
@@ -410,22 +407,6 @@
         this._stopUpdatingCurrentTime();
     },
 
-    _debuggerPaused: function(event)
-    {
-        if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Replaying)
-            return;
-
-        this._stopUpdatingCurrentTime();
-    },
-
-    _debuggerResumed: function(event)
-    {
-        if (WebInspector.replayManager.sessionState === WebInspector.ReplayManager.SessionState.Replaying)
-            return;
-
-        this._startUpdatingCurrentTime();
-    },
-
     _recordingTimesUpdated: function(event)
     {
         if (!this._waitingToResetCurrentTime)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to