Title: [202458] trunk/Source/_javascript_Core
Revision
202458
Author
[email protected]
Date
2016-06-24 15:52:47 -0700 (Fri, 24 Jun 2016)

Log Message

Unreviewed, rolling out r202443.
https://bugs.webkit.org/show_bug.cgi?id=159105

Introduced memory corruption crashes (Requested by ap on
#webkit).

Reverted changeset:

"Web Inspector: CRASH in backend at
Inspector::HeapFrontendDispatcher::garbageCollected + 552 when
closing frontend/inspected page"
https://bugs.webkit.org/show_bug.cgi?id=159075
http://trac.webkit.org/changeset/202443

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (202457 => 202458)


--- trunk/Source/_javascript_Core/ChangeLog	2016-06-24 22:44:10 UTC (rev 202457)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-06-24 22:52:47 UTC (rev 202458)
@@ -1,3 +1,19 @@
+2016-06-24  Commit Queue  <[email protected]>
+
+        Unreviewed, rolling out r202443.
+        https://bugs.webkit.org/show_bug.cgi?id=159105
+
+        Introduced memory corruption crashes (Requested by ap on
+        #webkit).
+
+        Reverted changeset:
+
+        "Web Inspector: CRASH in backend at
+        Inspector::HeapFrontendDispatcher::garbageCollected + 552 when
+        closing frontend/inspected page"
+        https://bugs.webkit.org/show_bug.cgi?id=159075
+        http://trac.webkit.org/changeset/202443
+
 2016-06-24  Brian Burg  <[email protected]>
 
         Web Inspector: CRASH in backend at Inspector::HeapFrontendDispatcher::garbageCollected + 552 when closing frontend/inspected page

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp (202457 => 202458)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2016-06-24 22:44:10 UTC (rev 202457)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.cpp	2016-06-24 22:52:47 UTC (rev 202458)
@@ -39,48 +39,6 @@
 
 namespace Inspector {
 
-class SendGarbageCollectionEventsTask {
-public:
-    SendGarbageCollectionEventsTask(HeapFrontendDispatcher&);
-    void addGarbageCollection(RefPtr<Inspector::Protocol::Heap::GarbageCollection>&&);
-    void reset();
-private:
-    void timerFired();
-
-    HeapFrontendDispatcher& m_frontendDispatcher;
-    Vector<RefPtr<Inspector::Protocol::Heap::GarbageCollection>> m_garbageCollections;
-    RunLoop::Timer<SendGarbageCollectionEventsTask> m_timer;
-};
-
-SendGarbageCollectionEventsTask::SendGarbageCollectionEventsTask(HeapFrontendDispatcher& frontendDispatcher)
-    : m_frontendDispatcher(frontendDispatcher)
-    , m_timer(RunLoop::current(), this, &SendGarbageCollectionEventsTask::timerFired)
-{
-}
-
-void SendGarbageCollectionEventsTask::addGarbageCollection(RefPtr<Inspector::Protocol::Heap::GarbageCollection>&& garbageCollection)
-{
-    m_garbageCollections.append(WTFMove(garbageCollection));
-
-    if (!m_timer.isActive())
-        m_timer.startOneShot(0);
-}
-
-void SendGarbageCollectionEventsTask::reset()
-{
-    m_timer.stop();
-    m_garbageCollections.clear();
-}
-
-void SendGarbageCollectionEventsTask::timerFired()
-{
-    // The timer is stopped on agent destruction, so this method will never be called after agent has been destroyed.
-    for (auto& event : m_garbageCollections)
-        m_frontendDispatcher.garbageCollected(event);
-
-    m_garbageCollections.clear();
-}
-
 InspectorHeapAgent::InspectorHeapAgent(AgentContext& context)
     : InspectorAgentBase(ASCIILiteral("Heap"))
     , m_injectedScriptManager(context.injectedScriptManager)
@@ -87,13 +45,11 @@
     , m_frontendDispatcher(std::make_unique<HeapFrontendDispatcher>(context.frontendRouter))
     , m_backendDispatcher(HeapBackendDispatcher::create(context.backendDispatcher, this))
     , m_environment(context.environment)
-    , m_sendGarbageCollectionEventsTask(std::make_unique<SendGarbageCollectionEventsTask>(*m_frontendDispatcher))
 {
 }
 
 InspectorHeapAgent::~InspectorHeapAgent()
 {
-    m_sendGarbageCollectionEventsTask->reset();
 }
 
 void InspectorHeapAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
@@ -125,7 +81,6 @@
     m_enabled = false;
 
     m_environment.vm().heap.removeObserver(this);
-    m_sendGarbageCollectionEventsTask->reset();
 
     clearHeapSnapshots();
 }
@@ -321,6 +276,9 @@
 
     // FIXME: Include number of bytes freed by collection.
 
+    double startTime = m_gcStartTime;
+    double endTime = m_environment.executionStopwatch()->elapsedTime();
+
     // Dispatch the event asynchronously because this method may be
     // called between collection and sweeping and we don't want to
     // create unexpected _javascript_ allocations that the Sweeper does
@@ -328,12 +286,16 @@
     // with WebKitLegacy's in process inspector which shares the same
     // VM as the inspected page.
 
-    m_sendGarbageCollectionEventsTask->addGarbageCollection(Inspector::Protocol::Heap::GarbageCollection::create()
-        .setType(protocolTypeForHeapOperation(operation))
-        .setStartTime(m_gcStartTime)
-        .setEndTime(m_environment.executionStopwatch()->elapsedTime())
-        .release());
+    RunLoop::current().dispatch([this, startTime, endTime, operation]() {
+        auto collection = Inspector::Protocol::Heap::GarbageCollection::create()
+            .setType(protocolTypeForHeapOperation(operation))
+            .setStartTime(startTime)
+            .setEndTime(endTime)
+            .release();
 
+        m_frontendDispatcher->garbageCollected(WTFMove(collection));
+    });
+
     m_gcStartTime = NAN;
 }
 

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h (202457 => 202458)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h	2016-06-24 22:44:10 UTC (rev 202457)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorHeapAgent.h	2016-06-24 22:52:47 UTC (rev 202458)
@@ -37,7 +37,6 @@
 namespace Inspector {
 
 class InjectedScriptManager;
-class SendGarbageCollectionEventsTask;
 typedef String ErrorString;
 
 class JS_EXPORT_PRIVATE InspectorHeapAgent : public InspectorAgentBase, public HeapBackendDispatcherHandler, public JSC::HeapObserver {
@@ -74,8 +73,6 @@
     RefPtr<HeapBackendDispatcher> m_backendDispatcher;
     InspectorEnvironment& m_environment;
 
-    std::unique_ptr<SendGarbageCollectionEventsTask> m_sendGarbageCollectionEventsTask;
-
     bool m_enabled { false };
     bool m_tracking { false };
     double m_gcStartTime { NAN };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to