Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (202382 => 202383)
--- trunk/Source/_javascript_Core/ChangeLog 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-06-23 18:52:54 UTC (rev 202383)
@@ -1,3 +1,22 @@
+2016-06-23 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Snapshots should be cleared at some point
+ https://bugs.webkit.org/show_bug.cgi?id=157907
+ <rdar://problem/26373610>
+
+ Reviewed by Timothy Hatcher.
+
+ * heap/HeapSnapshotBuilder.h:
+ * heap/HeapSnapshotBuilder.cpp:
+ (JSC::HeapSnapshotBuilder::resetNextAvailableObjectIdentifier):
+ Provide a way to reset the object identifier counter.
+
+ * inspector/agents/InspectorHeapAgent.h:
+ * inspector/agents/InspectorHeapAgent.cpp:
+ (Inspector::InspectorHeapAgent::clearHeapSnapshots):
+ Make clearHeapSnapshots protected, so it can be called from a
+ a PageHeapAgent on page navigations.
+
2016-06-22 Saam barati <[email protected]>
TypeProfiler and TypeProfilerLog don't play nicely with the concurrent JIT
Modified: trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp (202382 => 202383)
--- trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -39,6 +39,7 @@
unsigned HeapSnapshotBuilder::nextAvailableObjectIdentifier = 1;
unsigned HeapSnapshotBuilder::getNextObjectIdentifier() { return nextAvailableObjectIdentifier++; }
+void HeapSnapshotBuilder::resetNextAvailableObjectIdentifier() { HeapSnapshotBuilder::nextAvailableObjectIdentifier = 1; }
HeapSnapshotBuilder::HeapSnapshotBuilder(HeapProfiler& profiler)
: m_profiler(profiler)
Modified: trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.h (202382 => 202383)
--- trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.h 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/_javascript_Core/heap/HeapSnapshotBuilder.h 2016-06-23 18:52:54 UTC (rev 202383)
@@ -106,7 +106,8 @@
~HeapSnapshotBuilder();
static unsigned nextAvailableObjectIdentifier;
- static unsigned getNextObjectIdentifier();
+ static unsigned getNextObjectIdentifier();
+ static void resetNextAvailableObjectIdentifier();
// Performs a garbage collection that builds a snapshot of all live cells.
void buildSnapshot();
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (202382 => 202383)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -185,7 +185,7 @@
// FIXME: Provide preview information for Internal Objects? CodeBlock, Executable, etc.
- Structure* structure = cell->structure(m_environment.vm());
+ Structure* structure = cell->structure(vm);
if (!structure) {
errorString = ASCIILiteral("Unable to get object details - Structure");
return;
@@ -226,7 +226,7 @@
return;
JSCell* cell = optionalNode->cell;
- Structure* structure = cell->structure(m_environment.vm());
+ Structure* structure = cell->structure(vm);
if (!structure) {
errorString = ASCIILiteral("Unable to get object details");
return;
@@ -301,8 +301,13 @@
void InspectorHeapAgent::clearHeapSnapshots()
{
- if (HeapProfiler* heapProfiler = m_environment.vm().heapProfiler())
+ VM& vm = m_environment.vm();
+ JSLockHolder lock(vm);
+
+ if (HeapProfiler* heapProfiler = vm.heapProfiler()) {
heapProfiler->clearSnapshots();
+ HeapSnapshotBuilder::resetNextAvailableObjectIdentifier();
+ }
}
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h (202382 => 202383)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h 2016-06-23 18:52:54 UTC (rev 202383)
@@ -39,7 +39,7 @@
class InjectedScriptManager;
typedef String ErrorString;
-class JS_EXPORT_PRIVATE InspectorHeapAgent final : public InspectorAgentBase, public HeapBackendDispatcherHandler, public JSC::HeapObserver {
+class JS_EXPORT_PRIVATE InspectorHeapAgent : public InspectorAgentBase, public HeapBackendDispatcherHandler, public JSC::HeapObserver {
WTF_MAKE_NONCOPYABLE(InspectorHeapAgent);
public:
InspectorHeapAgent(AgentContext&);
@@ -51,20 +51,21 @@
// HeapBackendDispatcherHandler
void enable(ErrorString&) override;
void disable(ErrorString&) override;
- void gc(ErrorString&) override;
- void snapshot(ErrorString&, double* timestamp, String* snapshotData) override;
- void startTracking(ErrorString&) override;
- void stopTracking(ErrorString&) override;
- void getPreview(ErrorString&, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) override;
- void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) override;
+ void gc(ErrorString&) final;
+ void snapshot(ErrorString&, double* timestamp, String* snapshotData) final;
+ void startTracking(ErrorString&) final;
+ void stopTracking(ErrorString&) final;
+ void getPreview(ErrorString&, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) final;
+ void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) final;
// HeapObserver
void willGarbageCollect() override;
void didGarbageCollect(JSC::HeapOperation) override;
-private:
+protected:
void clearHeapSnapshots();
+private:
Optional<JSC::HeapSnapshotNode> nodeForHeapObjectIdentifier(ErrorString&, unsigned heapObjectIdentifier);
InjectedScriptManager& m_injectedScriptManager;
Modified: trunk/Source/WebCore/CMakeLists.txt (202382 => 202383)
--- trunk/Source/WebCore/CMakeLists.txt 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/CMakeLists.txt 2016-06-23 18:52:54 UTC (rev 202383)
@@ -1895,6 +1895,7 @@
inspector/NetworkResourcesData.cpp
inspector/PageConsoleAgent.cpp
inspector/PageDebuggerAgent.cpp
+ inspector/PageHeapAgent.cpp
inspector/PageRuntimeAgent.cpp
inspector/PageScriptDebugServer.cpp
inspector/TimelineRecordFactory.cpp
Modified: trunk/Source/WebCore/ChangeLog (202382 => 202383)
--- trunk/Source/WebCore/ChangeLog 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/ChangeLog 2016-06-23 18:52:54 UTC (rev 202383)
@@ -1,5 +1,42 @@
2016-06-23 Joseph Pecoraro <[email protected]>
+ Web Inspector: Snapshots should be cleared at some point
+ https://bugs.webkit.org/show_bug.cgi?id=157907
+ <rdar://problem/26373610>
+
+ Reviewed by Timothy Hatcher.
+
+ * CMakeLists.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * inspector/InspectorAllInOne.cpp:
+ New specialized agent.
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::InspectorController):
+ Construct a specialized HeapAgent.
+
+ * inspector/PageHeapAgent.h:
+ * inspector/PageHeapAgent.cpp:
+ (WebCore::PageHeapAgent::PageHeapAgent):
+ (WebCore::PageHeapAgent::enable):
+ (WebCore::PageHeapAgent::disable):
+ (WebCore::PageHeapAgent::mainFrameNavigated):
+ Clear backend snapshots on page navigations.
+ Set the PageHeapAgent instrumenting agent on enable/disable.
+
+ * inspector/InstrumentingAgents.cpp:
+ (WebCore::InstrumentingAgents::reset):
+ * inspector/InstrumentingAgents.h:
+ (WebCore::InstrumentingAgents::pageHeapAgent):
+ (WebCore::InstrumentingAgents::setPageHeapAgent):
+ Active PageHeapAgent.
+
+ * inspector/InspectorInstrumentation.cpp:
+ (WebCore::InspectorInstrumentation::didCommitLoadImpl):
+ Inform the PageHeapAgent when the mainframe navigates.
+
+2016-06-23 Joseph Pecoraro <[email protected]>
+
CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value
https://bugs.webkit.org/show_bug.cgi?id=159053
<rdar://problem/26638119>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (202382 => 202383)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-06-23 18:52:54 UTC (rev 202383)
@@ -4286,6 +4286,8 @@
A5F36D3A18F758720054C024 /* PageScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F36D3818F758720054C024 /* PageScriptDebugServer.cpp */; };
A5F36D3B18F758720054C024 /* PageScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = A5F36D3918F758720054C024 /* PageScriptDebugServer.h */; settings = {ATTRIBUTES = (Private, ); }; };
A5F6E16B132ED46E008EDAE3 /* Autocapitalize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */; };
+ A5F8CD121D18F32E00AC0E53 /* PageHeapAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = A5F8CD111D18EEC300AC0E53 /* PageHeapAgent.h */; };
+ A5F8CD131D18F33100AC0E53 /* PageHeapAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5F8CD101D18EEC300AC0E53 /* PageHeapAgent.cpp */; };
A6148A6212E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */; };
A6148A6712E41D940044A784 /* DOMHTMLKeygenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */; };
A6148A6812E41D940044A784 /* DOMHTMLKeygenElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = A6148A6612E41D940044A784 /* DOMHTMLKeygenElement.mm */; };
@@ -12077,6 +12079,8 @@
A5F36D3818F758720054C024 /* PageScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageScriptDebugServer.cpp; sourceTree = "<group>"; };
A5F36D3918F758720054C024 /* PageScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageScriptDebugServer.h; sourceTree = "<group>"; };
A5F6E16C132ED46E008EDAE3 /* Autocapitalize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Autocapitalize.cpp; sourceTree = "<group>"; };
+ A5F8CD101D18EEC300AC0E53 /* PageHeapAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageHeapAgent.cpp; sourceTree = "<group>"; };
+ A5F8CD111D18EEC300AC0E53 /* PageHeapAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageHeapAgent.h; sourceTree = "<group>"; };
A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLKeygenElementInternal.h; sourceTree = "<group>"; };
A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLKeygenElement.h; sourceTree = "<group>"; };
A6148A6612E41D940044A784 /* DOMHTMLKeygenElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLKeygenElement.mm; sourceTree = "<group>"; };
@@ -16559,6 +16563,8 @@
F382088B147D35F90010BC06 /* PageConsoleAgent.h */,
F34742DA134362F000531BC2 /* PageDebuggerAgent.cpp */,
F34742DB134362F000531BC2 /* PageDebuggerAgent.h */,
+ A5F8CD101D18EEC300AC0E53 /* PageHeapAgent.cpp */,
+ A5F8CD111D18EEC300AC0E53 /* PageHeapAgent.h */,
F382088C147D35F90010BC06 /* PageRuntimeAgent.cpp */,
F382088D147D35F90010BC06 /* PageRuntimeAgent.h */,
A5F36D3818F758720054C024 /* PageScriptDebugServer.cpp */,
@@ -27461,6 +27467,7 @@
CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */,
07C59B6917F784BA000FBCBB /* MediaSourceSettings.h in Headers */,
078E091517D14D1C00420AA1 /* MediaStream.h in Headers */,
+ A5F8CD121D18F32E00AC0E53 /* PageHeapAgent.h in Headers */,
078E094C17D1709600420AA1 /* MediaStreamAudioDestinationNode.h in Headers */,
0783228518013ED800999E0C /* MediaStreamAudioSource.h in Headers */,
FD671A78159BB07000197559 /* MediaStreamAudioSourceNode.h in Headers */,
@@ -31721,6 +31728,7 @@
9BD0BF9412A42BF50072FD43 /* ScopedEventQueue.cpp in Sources */,
BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
A84D82C211D3474800972990 /* ScriptableDocumentParser.cpp in Sources */,
+ A5F8CD131D18F33100AC0E53 /* PageHeapAgent.cpp in Sources */,
41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */,
93B70D6F09EB0C7C009D8468 /* ScriptController.cpp in Sources */,
A83E1C740E49042C00140B9C /* ScriptControllerMac.mm in Sources */,
Modified: trunk/Source/WebCore/inspector/InspectorAllInOne.cpp (202382 => 202383)
--- trunk/Source/WebCore/inspector/InspectorAllInOne.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/inspector/InspectorAllInOne.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -54,6 +54,7 @@
#include "NetworkResourcesData.cpp"
#include "PageConsoleAgent.cpp"
#include "PageDebuggerAgent.cpp"
+#include "PageHeapAgent.cpp"
#include "PageRuntimeAgent.cpp"
#include "PageScriptDebugServer.cpp"
#include "TimelineRecordFactory.cpp"
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (202382 => 202383)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -59,6 +59,7 @@
#include "Page.h"
#include "PageConsoleAgent.h"
#include "PageDebuggerAgent.h"
+#include "PageHeapAgent.h"
#include "PageRuntimeAgent.h"
#include "PageScriptDebugServer.h"
#include "Settings.h"
@@ -70,7 +71,6 @@
#include <inspector/InspectorFrontendDispatchers.h>
#include <inspector/InspectorFrontendRouter.h>
#include <inspector/agents/InspectorAgent.h>
-#include <inspector/agents/InspectorHeapAgent.h>
#include <inspector/agents/InspectorScriptProfilerAgent.h>
#include <runtime/JSLock.h>
#include <wtf/Stopwatch.h>
@@ -157,7 +157,7 @@
InspectorDOMStorageAgent* domStorageAgent = domStorageAgentPtr.get();
m_agents.append(WTFMove(domStorageAgentPtr));
- auto heapAgentPtr = std::make_unique<InspectorHeapAgent>(pageContext);
+ auto heapAgentPtr = std::make_unique<PageHeapAgent>(pageContext);
InspectorHeapAgent* heapAgent = heapAgentPtr.get();
m_agents.append(WTFMove(heapAgentPtr));
Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (202382 => 202383)
--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -56,6 +56,7 @@
#include "MainFrame.h"
#include "Page.h"
#include "PageDebuggerAgent.h"
+#include "PageHeapAgent.h"
#include "PageRuntimeAgent.h"
#include "RenderObject.h"
#include "RenderView.h"
@@ -742,6 +743,9 @@
if (PageDebuggerAgent* pageDebuggerAgent = instrumentingAgents.pageDebuggerAgent())
pageDebuggerAgent->mainFrameNavigated();
+
+ if (PageHeapAgent* pageHeapAgent = instrumentingAgents.pageHeapAgent())
+ pageHeapAgent->mainFrameNavigated();
}
if (InspectorDOMAgent* domAgent = instrumentingAgents.inspectorDOMAgent())
Modified: trunk/Source/WebCore/inspector/InstrumentingAgents.cpp (202382 => 202383)
--- trunk/Source/WebCore/inspector/InstrumentingAgents.cpp 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -64,6 +64,7 @@
m_inspectorApplicationCacheAgent = nullptr;
m_inspectorDebuggerAgent = nullptr;
m_pageDebuggerAgent = nullptr;
+ m_pageHeapAgent = nullptr;
m_inspectorDOMDebuggerAgent = nullptr;
}
Modified: trunk/Source/WebCore/inspector/InstrumentingAgents.h (202382 => 202383)
--- trunk/Source/WebCore/inspector/InstrumentingAgents.h 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.h 2016-06-23 18:52:54 UTC (rev 202383)
@@ -58,6 +58,7 @@
class InspectorTimelineAgent;
class Page;
class PageDebuggerAgent;
+class PageHeapAgent;
class PageRuntimeAgent;
class WebConsoleAgent;
@@ -128,6 +129,9 @@
PageDebuggerAgent* pageDebuggerAgent() const { return m_pageDebuggerAgent; }
void setPageDebuggerAgent(PageDebuggerAgent* agent) { m_pageDebuggerAgent = agent; }
+ PageHeapAgent* pageHeapAgent() const { return m_pageHeapAgent; }
+ void setPageHeapAgent(PageHeapAgent* agent) { m_pageHeapAgent = agent; }
+
InspectorDOMDebuggerAgent* inspectorDOMDebuggerAgent() const { return m_inspectorDOMDebuggerAgent; }
void setInspectorDOMDebuggerAgent(InspectorDOMDebuggerAgent* agent) { m_inspectorDOMDebuggerAgent = agent; }
@@ -160,6 +164,7 @@
InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent { nullptr };
Inspector::InspectorDebuggerAgent* m_inspectorDebuggerAgent { nullptr };
PageDebuggerAgent* m_pageDebuggerAgent { nullptr };
+ PageHeapAgent* m_pageHeapAgent { nullptr };
InspectorDOMDebuggerAgent* m_inspectorDOMDebuggerAgent { nullptr };
};
Copied: trunk/Source/WebCore/inspector/PageHeapAgent.cpp (from rev 202382, trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css) (0 => 202383)
--- trunk/Source/WebCore/inspector/PageHeapAgent.cpp (rev 0)
+++ trunk/Source/WebCore/inspector/PageHeapAgent.cpp 2016-06-23 18:52:54 UTC (rev 202383)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 Apple Inc. 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 INC. 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 INC. 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.
+ */
+
+#include "config.h"
+#include "PageHeapAgent.h"
+
+using namespace Inspector;
+
+namespace WebCore {
+
+PageHeapAgent::PageHeapAgent(PageAgentContext& context)
+ : InspectorHeapAgent(context)
+ , m_instrumentingAgents(context.instrumentingAgents)
+{
+}
+
+void PageHeapAgent::enable(ErrorString& errorString)
+{
+ InspectorHeapAgent::enable(errorString);
+ m_instrumentingAgents.setPageHeapAgent(this);
+}
+
+void PageHeapAgent::disable(ErrorString& errorString)
+{
+ InspectorHeapAgent::disable(errorString);
+ m_instrumentingAgents.setPageHeapAgent(nullptr);
+}
+
+void PageHeapAgent::mainFrameNavigated()
+{
+ clearHeapSnapshots();
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/inspector/PageHeapAgent.h (from rev 202382, trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css) (0 => 202383)
--- trunk/Source/WebCore/inspector/PageHeapAgent.h (rev 0)
+++ trunk/Source/WebCore/inspector/PageHeapAgent.h 2016-06-23 18:52:54 UTC (rev 202383)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2016 Apple Inc. 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 INC. 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 INC. 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.
+ */
+
+#pragma once
+
+#include "InspectorWebAgentBase.h"
+#include "InstrumentingAgents.h"
+#include <inspector/agents/InspectorHeapAgent.h>
+
+namespace WebCore {
+
+typedef String ErrorString;
+
+class PageHeapAgent final : public Inspector::InspectorHeapAgent {
+ WTF_MAKE_NONCOPYABLE(PageHeapAgent);
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ PageHeapAgent(PageAgentContext&);
+ virtual ~PageHeapAgent() { }
+
+ void enable(ErrorString&) override;
+ void disable(ErrorString&) override;
+
+ void mainFrameNavigated();
+
+private:
+ InstrumentingAgents& m_instrumentingAgents;
+};
+
+} // namespace WebCore
Modified: trunk/Source/WebInspectorUI/ChangeLog (202382 => 202383)
--- trunk/Source/WebInspectorUI/ChangeLog 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/ChangeLog 2016-06-23 18:52:54 UTC (rev 202383)
@@ -1,3 +1,91 @@
+2016-06-23 Joseph Pecoraro <[email protected]>
+
+ Web Inspector: Snapshots should be cleared at some point
+ https://bugs.webkit.org/show_bug.cgi?id=157907
+ <rdar://problem/26373610>
+
+ Reviewed by Timothy Hatcher.
+
+ Invalidate HeapSnapshotProxy objects when the page navigates.
+ This allows us to clear our frontend data for the snapshots.
+ When a snapshot is invalidated, it is disabled in the UI.
+ This means you cannot select the snapshot or see content
+ views for the snapshot. If you are in a snapshot when it is
+ invalidated, you are taken out to the snapshot list.
+
+ * UserInterface/Main.html:
+ New files.
+
+ * UserInterface/Proxies/HeapSnapshotProxy.js:
+ (WebInspector.HeapSnapshotProxy):
+ (WebInspector.HeapSnapshotProxy.invalidateSnapshotProxies):
+ (WebInspector.HeapSnapshotProxy.prototype.get invalid):
+ (WebInspector.HeapSnapshotProxy.prototype._invalidate):
+ Keep track of valid snapshots, and provide a static method to invalidate them.
+
+ (WebInspector.HeapSnapshotProxy.prototype.updateForCollectionEvent):
+ (WebInspector.HeapSnapshotProxy.prototype.allocationBucketCounts):
+ (WebInspector.HeapSnapshotProxy.prototype.instancesWithClassName):
+ (WebInspector.HeapSnapshotProxy.prototype.update):
+ (WebInspector.HeapSnapshotProxy.prototype.nodeWithIdentifier):
+ UI should only act on valid snapshots.
+
+ * UserInterface/Proxies/HeapSnapshotDiffProxy.js:
+ (WebInspector.HeapSnapshotDiffProxy.prototype.get invalid):
+ (WebInspector.HeapSnapshotDiffProxy.prototype.updateForCollectionEvent):
+ (WebInspector.HeapSnapshotDiffProxy.prototype.allocationBucketCounts):
+ (WebInspector.HeapSnapshotDiffProxy.prototype.instancesWithClassName):
+ (WebInspector.HeapSnapshotDiffProxy.prototype.update):
+ (WebInspector.HeapSnapshotDiffProxy.prototype.nodeWithIdentifier):
+ UI should only act on valid snapshots.
+
+ * UserInterface/Proxies/HeapSnapshotWorkerProxy.js:
+ (WebInspector.HeapSnapshotWorkerProxy.prototype._mainResourceDidChange):
+ Invalidate and discard snapshots when the main frame navigates.
+
+ (WebInspector.HeapSnapshotWorkerProxy.prototype._handleMessage):
+ (WebInspector.HeapSnapshotWorkerProxy):
+ * UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js:
+ (HeapSnapshotWorker.prototype.clearSnapshots):
+ (HeapSnapshotWorker.prototype._handleMessage):
+ (HeapSnapshotWorker):
+ A message may come in for a snapshot before it has been cleared.
+ If that is the case, the object may not exist. Return an error so
+ that the callback can be deleted on the calling side.
+
+ * UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js:
+ (WebInspector.HeapAllocationsTimelineDataGridNodePathComponent.prototype.get previousSibling):
+ (WebInspector.HeapAllocationsTimelineDataGridNodePathComponent.prototype.get nextSibling):
+ (WebInspector.HeapAllocationsTimelineDataGridNodePathComponent):
+ Don't show invalid snapshots in page component picker.
+
+ * UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css:
+ (.timeline-overview-graph.heap-allocations > img.snapshot.invalid):
+ * UserInterface/Views/HeapAllocationsTimelineDataGridNode.js:
+ (WebInspector.HeapAllocationsTimelineDataGridNode):
+ (WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCellContent):
+ (WebInspector.HeapAllocationsTimelineDataGridNode.prototype.createCells):
+ (WebInspector.HeapAllocationsTimelineDataGridNode.prototype._heapSnapshotInvalidated):
+ Give invalid snapshots an invalidated appearance in the snapshot list.
+
+ * UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js:
+ (WebInspector.HeapAllocationsTimelineOverviewGraph.prototype.layout):
+ * UserInterface/Views/HeapAllocationsTimelineView.css:
+ (.timeline-view.heap-allocations > .data-grid tr.invalid):
+ (.timeline-view.heap-allocations > .data-grid:not(:focus, .force-focus) tr.selected.invalid):
+ Give invalid snapshots an invalidated appearance in the overview graph.
+
+ * UserInterface/Views/HeapAllocationsTimelineView.js:
+ (WebInspector.HeapAllocationsTimelineView):
+ (WebInspector.HeapAllocationsTimelineView.prototype.get selectionPathComponents):
+ (WebInspector.HeapAllocationsTimelineView.prototype.closed):
+ (WebInspector.HeapAllocationsTimelineView.prototype._heapSnapshotCollectionEvent.updateHeapSnapshotForEvent):
+ (WebInspector.HeapAllocationsTimelineView.prototype._heapSnapshotCollectionEvent):
+ (WebInspector.HeapAllocationsTimelineView.prototype._heapSnapshotInvalidated):
+ (WebInspector.HeapAllocationsTimelineView.prototype._updateCompareHeapSnapshotButton):
+ (WebInspector.HeapAllocationsTimelineView.prototype._dataGridNodeSelected):
+ Handle interactions when snapshots in the list are invalidated.
+
2016-06-22 Brian Burg <[email protected]>
Web Inspector: don't start auto capturing if the Inspector window is not visible
Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Main.html 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2016-06-23 18:52:54 UTC (rev 202383)
@@ -427,6 +427,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
@@ -526,6 +527,7 @@
<script src=""
<script src=""
<script src=""
+ <script src=""
<script src=""
<script src=""
<script src=""
@@ -623,7 +625,6 @@
<script src=""
<script src=""
<script src=""
- <script src=""
<script src=""
<script src=""
<script src=""
Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotDiffProxy.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -61,9 +61,11 @@
get totalSize() { return this._totalSize; }
get totalObjectCount() { return this._totalObjectCount; }
get categories() { return this._categories; }
+ get invalid() { return this._snapshot1.invalid || this._snapshot2.invalid; }
updateForCollectionEvent(event)
{
+ console.assert(!this.invalid);
if (!event.data.affectedSnapshots.includes(this._snapshot2._identifier))
return;
@@ -74,11 +76,13 @@
allocationBucketCounts(bucketSizes, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
}
instancesWithClassName(className, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
});
@@ -86,6 +90,7 @@
update(callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
this._categories = Map.fromObject(categories);
callback();
@@ -94,6 +99,7 @@
nodeWithIdentifier(nodeIdentifier, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -37,6 +37,12 @@
this._totalObjectCount = totalObjectCount;
this._liveSize = liveSize;
this._categories = Map.fromObject(categories);
+
+ console.assert(!this.invalid);
+
+ if (!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
+ WebInspector.HeapSnapshotProxy.ValidSnapshotProxies = [];
+ WebInspector.HeapSnapshotProxy.ValidSnapshotProxies.push(this);
}
// Static
@@ -47,6 +53,17 @@
return new WebInspector.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, liveSize, categories);
}
+ static invalidateSnapshotProxies()
+ {
+ if (!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
+ return;
+
+ for (let snapshotProxy of WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
+ snapshotProxy._invalidate();
+
+ WebInspector.HeapSnapshotProxy.ValidSnapshotProxies = null;
+ }
+
// Public
get proxyObjectId() { return this._proxyObjectId; }
@@ -56,9 +73,11 @@
get totalObjectCount() { return this._totalObjectCount; }
get liveSize() { return this._liveSize; }
get categories() { return this._categories; }
+ get invalid() { return this._proxyObjectId === 0; }
updateForCollectionEvent(event)
{
+ console.assert(!this.invalid);
if (!event.data.affectedSnapshots.includes(this._identifier))
return;
@@ -69,11 +88,13 @@
allocationBucketCounts(bucketSizes, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "allocationBucketCounts", bucketSizes, callback);
}
instancesWithClassName(className, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "instancesWithClassName", className, (serializedNodes) => {
callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null, this._proxyObjectId)));
});
@@ -81,6 +102,7 @@
update(callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "update", ({liveSize, categories}) => {
this._liveSize = liveSize;
this._categories = Map.fromObject(categories);
@@ -90,12 +112,24 @@
nodeWithIdentifier(nodeIdentifier, callback)
{
+ console.assert(!this.invalid);
WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId, "nodeWithIdentifier", nodeIdentifier, (serializedNode) => {
callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId, serializedNode));
});
}
+
+ // Private
+
+ _invalidate()
+ {
+ this._proxyObjectId = 0;
+ this._liveSize = 0;
+
+ this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.Invalidated);
+ }
};
WebInspector.HeapSnapshotProxy.Event = {
- CollectedNodes: "heap-snapshot-proxy-did-collect-nodes"
+ CollectedNodes: "heap-snapshot-proxy-collected-nodes",
+ Invalidated: "heap-snapshot-proxy-invalidated",
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotWorkerProxy.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -100,7 +100,9 @@
if (!event.target.isMainFrame())
return;
- this.clearSnapshots(function(){});
+ this.clearSnapshots(() => {
+ WebInspector.HeapSnapshotProxy.invalidateSnapshotProxies();
+ });
}
_postMessage()
@@ -112,6 +114,13 @@
{
let data = ""
+ // Error.
+ if (data.error) {
+ console.assert(data.callId);
+ this._callbacks.delete(data.callId);
+ return;
+ }
+
// Event.
if (data.eventName) {
this.dispatchEventToListeners(data.eventName, data.eventData);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -40,6 +40,7 @@
};
this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes, this._heapSnapshotCollectedNodes, this);
+ this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
}
// Public
@@ -56,10 +57,12 @@
let fragment = document.createDocumentFragment();
let titleElement = fragment.appendChild(document.createElement("span"));
titleElement.textContent = this._data.name;
- let goToButton = fragment.appendChild(WebInspector.createGoToArrowButton());
- goToButton.addEventListener("click", (event) => {
- this._heapAllocationsView.showHeapSnapshotTimelineRecord(this._record);
- });
+ if (!this._record.heapSnapshot.invalid) {
+ let goToButton = fragment.appendChild(WebInspector.createGoToArrowButton());
+ goToButton.addEventListener("click", (event) => {
+ this._heapAllocationsView.showHeapSnapshotTimelineRecord(this._record);
+ });
+ }
return fragment;
case "timestamp":
@@ -92,6 +95,16 @@
this.needsRefresh();
}
+ // Protected
+
+ createCells()
+ {
+ super.createCells();
+
+ if (this._record.heapSnapshot.invalid)
+ this.element.classList.add("invalid");
+ }
+
// Private
_heapSnapshotCollectedNodes()
@@ -106,4 +119,11 @@
this._data.liveSize = newSize;
this.needsRefresh();
}
+
+ _heapSnapshotInvalidated()
+ {
+ this._data.liveSize = 0;
+
+ this.needsRefresh();
+ }
};
Copied: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js (from rev 202382, trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css) (0 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNodePathComponent.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 Apple Inc. 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 INC. 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 INC. 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.
+ */
+
+WebInspector.HeapAllocationsTimelineDataGridNodePathComponent = class HeapAllocationsTimelineDataGridNodePathComponent extends WebInspector.TimelineDataGridNodePathComponent
+{
+ // Protected
+
+ get previousSibling()
+ {
+ let previousSibling = this.timelineDataGridNode.previousSibling;
+ while (previousSibling && (previousSibling.hidden || previousSibling.record.heapSnapshot.invalid))
+ previousSibling = previousSibling.previousSibling;
+
+ if (!previousSibling)
+ return null;
+
+ return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(previousSibling);
+ }
+
+ get nextSibling()
+ {
+ let nextSibling = this.timelineDataGridNode.nextSibling;
+ while (nextSibling && (nextSibling.hidden || nextSibling.record.heapSnapshot.invalid))
+ nextSibling = nextSibling.nextSibling;
+
+ if (!nextSibling)
+ return null;
+
+ return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(nextSibling);
+ }
+};
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.css 2016-06-23 18:52:54 UTC (rev 202383)
@@ -35,6 +35,10 @@
height: 16px;
}
+.timeline-overview-graph.heap-allocations > img.snapshot.invalid {
+ opacity: 0.7;
+}
+
.timeline-overview-graph.heap-allocations > img.snapshot.selected {
content: url(../Images/HeapSnapshotSelected.svg);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineOverviewGraph.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -54,8 +54,12 @@
return;
this.element.removeChildren();
- this._selectedImageElement = null;
+ if (this._selectedImageElement) {
+ this._selectedImageElement.classList.remove("selected");
+ this._selectedImageElement = null;
+ }
+
// This may display records past the current time marker.
let visibleRecords = this._heapAllocationsTimeline.recordsInTimeRange(this.startTime, this.endTime);
if (!visibleRecords.length)
@@ -76,14 +80,20 @@
let imageElement = record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];
if (!imageElement) {
- imageElement = document.createElement("img");
+ imageElement = record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol] = document.createElement("img");
imageElement.classList.add("snapshot");
- imageElement.addEventListener("click", () => { this.selectedRecord = record; });
- record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol] = imageElement;
+ imageElement.addEventListener("click", () => {
+ if (record.heapSnapshot.invalid)
+ return;
+ this.selectedRecord = record;
+ });
}
imageElement.style.left = x + "px";
+ if (record.heapSnapshot.invalid)
+ imageElement.classList.add("invalid");
+
this.element.appendChild(imageElement);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.css 2016-06-23 18:52:54 UTC (rev 202383)
@@ -35,6 +35,14 @@
content: url(../Images/HeapSnapshot.svg);
}
+.timeline-view.heap-allocations > .data-grid tr.invalid {
+ color: gray;
+}
+
+.timeline-view.heap-allocations > .data-grid:not(:focus, .force-focus) tr.selected.invalid {
+ color: gray !important;
+}
+
.timeline-view.heap-allocations > .data-grid tr.baseline {
background: hsl(129, 29%, 77%);
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -99,6 +99,7 @@
timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._heapAllocationsTimelineRecordAdded, this);
+ WebInspector.HeapSnapshotProxy.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated, this._heapSnapshotInvalidated, this);
WebInspector.HeapSnapshotWorkerProxy.singleton().addEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
}
@@ -191,12 +192,10 @@
let secondSnapshotIdentifier = this._heapSnapshotDiff.snapshot2.identifier;
let diffComponent = new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot Comparison (%d and %d)").format(firstSnapshotIdentifier, secondSnapshotIdentifier), "snapshot-diff-icon", "snapshot-diff");
components.push(diffComponent);
- } else {
- if (this._dataGrid.selectedNode) {
- let heapSnapshotPathComponent = new WebInspector.TimelineDataGridNodePathComponent(this._dataGrid.selectedNode);
- heapSnapshotPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._snapshotPathComponentSelected, this);
- components.push(heapSnapshotPathComponent);
- }
+ } else if (this._dataGrid.selectedNode) {
+ let heapSnapshotPathComponent = new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(this._dataGrid.selectedNode);
+ heapSnapshotPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected, this._snapshotPathComponentSelected, this);
+ components.push(heapSnapshotPathComponent);
}
return components.concat(this._contentViewContainer.currentContentView.selectionPathComponents);
@@ -240,6 +239,7 @@
this._contentViewContainer.closeAllContentViews();
WebInspector.ContentView.removeEventListener(null, null, this);
+ WebInspector.HeapSnapshotProxy.removeEventListener(null, null, this);
WebInspector.HeapSnapshotWorkerProxy.singleton().removeEventListener("HeapSnapshot.CollectionEvent", this._heapSnapshotCollectionEvent, this);
}
@@ -294,6 +294,8 @@
_heapSnapshotCollectionEvent(event)
{
function updateHeapSnapshotForEvent(heapSnapshot) {
+ if (heapSnapshot.invalid)
+ return;
heapSnapshot.updateForCollectionEvent(event);
}
@@ -329,22 +331,42 @@
this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
}
+ _heapSnapshotInvalidated(event)
+ {
+ let heapSnapshot = event.target;
+
+ if (this._baselineHeapSnapshotTimelineRecord) {
+ if (heapSnapshot === this._baselineHeapSnapshotTimelineRecord.heapSnapshot)
+ this._cancelSelectComparisonHeapSnapshots();
+ }
+
+ if (this._heapSnapshotDiff) {
+ if (heapSnapshot === this._heapSnapshotDiff.snapshot1 || heapSnapshot === this._heapSnapshotDiff.snapshot2)
+ this.showHeapSnapshotList();
+ } else if (this._dataGrid.selectedNode) {
+ if (heapSnapshot === this._dataGrid.selectedNode.record.heapSnapshot)
+ this.showHeapSnapshotList();
+ }
+
+ this._updateCompareHeapSnapshotButton();
+ }
+
_updateCompareHeapSnapshotButton()
{
- let hasAtLeastTwoSnapshots = false;
+ let hasAtLeastTwoValidSnapshots = false;
let count = 0;
for (let node of this._dataGrid.children) {
- if (node.revealed && !node.hidden) {
+ if (node.revealed && !node.hidden && !node.record.heapSnapshot.invalid) {
count++;
if (count === 2) {
- hasAtLeastTwoSnapshots = true;
+ hasAtLeastTwoValidSnapshots = true;
break;
}
}
}
- this._compareHeapSnapshotsButtonItem.enabled = hasAtLeastTwoSnapshots;
+ this._compareHeapSnapshotsButtonItem.enabled = hasAtLeastTwoValidSnapshots;
}
_takeHeapSnapshotClicked()
@@ -405,7 +427,9 @@
return;
let heapAllocationsTimelineRecord = dataGridNode.record;
- if (this._baselineHeapSnapshotTimelineRecord === heapAllocationsTimelineRecord) {
+
+ // Cancel the selection if the heap snapshot is invalid, or was already selected as the baseline.
+ if (heapAllocationsTimelineRecord.heapSnapshot.invalid || this._baselineHeapSnapshotTimelineRecord === heapAllocationsTimelineRecord) {
this._dataGrid.selectedNode.deselect();
return;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js (202382 => 202383)
--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js 2016-06-23 18:43:43 UTC (rev 202382)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js 2016-06-23 18:52:54 UTC (rev 202383)
@@ -42,8 +42,7 @@
clearSnapshots()
{
- // FIXME: <https://webkit.org/b/157907> Web Inspector: Snapshots should be cleared at some point
- // this._objects.clear();
+ this._objects.clear();
this._snapshots = [];
}
@@ -105,8 +104,12 @@
if (data.methodName) {
console.assert(data.objectId, "Must have an objectId to call the method on");
let object = this._objects.get(data.objectId);
- let result = object[data.methodName](...data.methodArguments);
- self.postMessage({callId: data.callId, result});
+ if (!object)
+ self.postMessage({callId: data.callId, error: "No such object."});
+ else {
+ let result = object[data.methodName](...data.methodArguments);
+ self.postMessage({callId: data.callId, result});
+ }
return;
}