Title: [173551] trunk/Source
Revision
173551
Author
[email protected]
Date
2014-09-11 18:50:24 -0700 (Thu, 11 Sep 2014)

Log Message

Web Inspector: Occasional ASSERT closing web inspector
https://bugs.webkit.org/show_bug.cgi?id=136762

Patch by Joseph Pecoraro <[email protected]> on 2014-09-11
Reviewed by Timothy Hatcher.

Source/_javascript_Core:

It is harmless, and indeed possible to have an empty set of listeners
now that each Page gets its own PageDebugServer instead of a shared
global. So we should replace the null checks with isEmpty checks.
Since nobody was ever returning null, convert to references as well.

* inspector/JSGlobalObjectScriptDebugServer.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::dispatchBreakpointActionLog):
(Inspector::ScriptDebugServer::dispatchBreakpointActionSound):
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
(Inspector::ScriptDebugServer::sourceParsed):
(Inspector::ScriptDebugServer::dispatchFunctionToListeners):
(Inspector::ScriptDebugServer::notifyDoneProcessingDebuggerEvents):
(Inspector::ScriptDebugServer::handlePause):
(Inspector::ScriptDebugServer::needPauseHandling): Deleted.
* inspector/ScriptDebugServer.h:

Source/WebCore:

* bindings/js/WorkerScriptDebugServer.h:
* inspector/PageScriptDebugServer.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (173550 => 173551)


--- trunk/Source/_javascript_Core/ChangeLog	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-09-12 01:50:24 UTC (rev 173551)
@@ -1,3 +1,27 @@
+2014-09-11  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Occasional ASSERT closing web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=136762
+
+        Reviewed by Timothy Hatcher.
+
+        It is harmless, and indeed possible to have an empty set of listeners
+        now that each Page gets its own PageDebugServer instead of a shared
+        global. So we should replace the null checks with isEmpty checks.
+        Since nobody was ever returning null, convert to references as well.
+
+        * inspector/JSGlobalObjectScriptDebugServer.h:
+        * inspector/ScriptDebugServer.cpp:
+        (Inspector::ScriptDebugServer::dispatchBreakpointActionLog):
+        (Inspector::ScriptDebugServer::dispatchBreakpointActionSound):
+        (Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
+        (Inspector::ScriptDebugServer::sourceParsed):
+        (Inspector::ScriptDebugServer::dispatchFunctionToListeners):
+        (Inspector::ScriptDebugServer::notifyDoneProcessingDebuggerEvents):
+        (Inspector::ScriptDebugServer::handlePause):
+        (Inspector::ScriptDebugServer::needPauseHandling): Deleted.
+        * inspector/ScriptDebugServer.h:
+
 2014-09-10  Michael Saboff  <[email protected]>
 
         Move JSScope out of JSFunction into separate JSCallee class

Modified: trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h (173550 => 173551)


--- trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/_javascript_Core/inspector/JSGlobalObjectScriptDebugServer.h	2014-09-12 01:50:24 UTC (rev 173551)
@@ -47,7 +47,7 @@
     virtual void recompileAllJSFunctions() override;
 
 private:
-    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) override { return &m_listeners; }
+    virtual ListenerSet& getListeners() override { return m_listeners; }
     virtual void didPause(JSC::JSGlobalObject*) override { }
     virtual void didContinue(JSC::JSGlobalObject*) override { }
     virtual void runEventLoopWhilePaused() override;

Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp (173550 => 173551)


--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.cpp	2014-09-12 01:50:24 UTC (rev 173551)
@@ -147,33 +147,31 @@
     if (m_callingListeners)
         return;
 
-    ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
-    if (!listeners)
+    ListenerSet& listeners = getListeners();
+    if (listeners.isEmpty())
         return;
-    ASSERT(!listeners->isEmpty());
 
     TemporaryChange<bool> change(m_callingListeners, true);
 
     Vector<ScriptDebugListener*> listenersCopy;
-    copyToVector(*listeners, listenersCopy);
+    copyToVector(listeners, listenersCopy);
     for (auto* listener : listenersCopy)
         listener->breakpointActionLog(exec, message);
 }
 
-void ScriptDebugServer::dispatchBreakpointActionSound(ExecState* exec, int breakpointActionIdentifier)
+void ScriptDebugServer::dispatchBreakpointActionSound(ExecState*, int breakpointActionIdentifier)
 {
     if (m_callingListeners)
         return;
 
-    ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
-    if (!listeners)
+    ListenerSet& listeners = getListeners();
+    if (listeners.isEmpty())
         return;
-    ASSERT(!listeners->isEmpty());
 
     TemporaryChange<bool> change(m_callingListeners, true);
 
     Vector<ScriptDebugListener*> listenersCopy;
-    copyToVector(*listeners, listenersCopy);
+    copyToVector(listeners, listenersCopy);
     for (auto* listener : listenersCopy)
         listener->breakpointActionSound(breakpointActionIdentifier);
 }
@@ -183,15 +181,14 @@
     if (m_callingListeners)
         return;
 
-    ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
-    if (!listeners)
+    ListenerSet& listeners = getListeners();
+    if (listeners.isEmpty())
         return;
-    ASSERT(!listeners->isEmpty());
 
     TemporaryChange<bool> change(m_callingListeners, true);
 
     Vector<ScriptDebugListener*> listenersCopy;
-    copyToVector(*listeners, listenersCopy);
+    copyToVector(listeners, listenersCopy);
     for (auto* listener : listenersCopy)
         listener->breakpointActionProbe(exec, action, m_hitCount, sample);
 }
@@ -251,49 +248,42 @@
     if (m_callingListeners)
         return;
 
-    ListenerSet* listeners = getListenersForGlobalObject(exec->lexicalGlobalObject());
-    if (!listeners)
+    ListenerSet& listeners = getListeners();
+    if (listeners.isEmpty())
         return;
-    ASSERT(!listeners->isEmpty());
 
     TemporaryChange<bool> change(m_callingListeners, true);
 
     bool isError = errorLine != -1;
     if (isError)
-        dispatchFailedToParseSource(*listeners, sourceProvider, errorLine, errorMessage);
+        dispatchFailedToParseSource(listeners, sourceProvider, errorLine, errorMessage);
     else
-        dispatchDidParseSource(*listeners, sourceProvider, isContentScript(exec));
+        dispatchDidParseSource(listeners, sourceProvider, isContentScript(exec));
 }
 
-void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, _javascript_ExecutionCallback callback)
+void ScriptDebugServer::dispatchFunctionToListeners(_javascript_ExecutionCallback callback)
 {
-    Vector<ScriptDebugListener*> copy;
-    copyToVector(listeners, copy);
-    for (size_t i = 0; i < copy.size(); ++i)
-        (this->*callback)(copy[i]);
-}
-
-void ScriptDebugServer::dispatchFunctionToListeners(_javascript_ExecutionCallback callback, JSGlobalObject* globalObject)
-{
     if (m_callingListeners)
         return;
 
     TemporaryChange<bool> change(m_callingListeners, true);
 
-    if (ListenerSet* listeners = getListenersForGlobalObject(globalObject)) {
-        if (!listeners->isEmpty())
-            dispatchFunctionToListeners(*listeners, callback);
-    }
+    ListenerSet& listeners = getListeners();
+    if (!listeners.isEmpty())
+        dispatchFunctionToListeners(listeners, callback);
 }
 
-void ScriptDebugServer::notifyDoneProcessingDebuggerEvents()
+void ScriptDebugServer::dispatchFunctionToListeners(const ListenerSet& listeners, _javascript_ExecutionCallback callback)
 {
-    m_doneProcessingDebuggerEvents = true;
+    Vector<ScriptDebugListener*> copy;
+    copyToVector(listeners, copy);
+    for (size_t i = 0; i < copy.size(); ++i)
+        (this->*callback)(copy[i]);
 }
 
-bool ScriptDebugServer::needPauseHandling(JSGlobalObject* globalObject)
+void ScriptDebugServer::notifyDoneProcessingDebuggerEvents()
 {
-    return !!getListenersForGlobalObject(globalObject);
+    m_doneProcessingDebuggerEvents = true;
 }
 
 void ScriptDebugServer::handleBreakpointHit(const JSC::Breakpoint& breakpoint)
@@ -316,7 +306,7 @@
 
 void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vmEntryGlobalObject)
 {
-    dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause, vmEntryGlobalObject);
+    dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidPause);
     LegacyProfiler::profiler()->didPause(currentDebuggerCallFrame());
     didPause(vmEntryGlobalObject);
 
@@ -325,7 +315,7 @@
 
     didContinue(vmEntryGlobalObject);
     LegacyProfiler::profiler()->didContinue(currentDebuggerCallFrame());
-    dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject);
+    dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue);
 }
 
 const BreakpointActions& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID)

Modified: trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h (173550 => 173551)


--- trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/_javascript_Core/inspector/ScriptDebugServer.h	2014-09-12 01:50:24 UTC (rev 173551)
@@ -74,7 +74,7 @@
     ScriptDebugServer(bool isInWorkerThread = false);
     ~ScriptDebugServer();
 
-    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) = 0;
+    virtual ListenerSet& getListeners() = 0;
     virtual void didPause(JSC::JSGlobalObject*) = 0;
     virtual void didContinue(JSC::JSGlobalObject*) = 0;
     virtual void runEventLoopWhilePaused() = 0;
@@ -83,7 +83,7 @@
 
     bool evaluateBreakpointAction(const ScriptBreakpointAction&);
 
-    void dispatchFunctionToListeners(_javascript_ExecutionCallback, JSC::JSGlobalObject*);
+    void dispatchFunctionToListeners(_javascript_ExecutionCallback);
     void dispatchFunctionToListeners(const ListenerSet& listeners, _javascript_ExecutionCallback);
     void dispatchDidPause(ScriptDebugListener*);
     void dispatchDidContinue(ScriptDebugListener*);
@@ -99,7 +99,7 @@
     typedef HashMap<JSC::BreakpointID, BreakpointActions> BreakpointIDToActionsMap;
 
     virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg) override final;
-    virtual bool needPauseHandling(JSC::JSGlobalObject*) override final;
+    virtual bool needPauseHandling(JSC::JSGlobalObject*) override final { return true; }
     virtual void handleBreakpointHit(const JSC::Breakpoint&) override final;
     virtual void handleExceptionInBreakpointCondition(JSC::ExecState*, JSC::JSValue exception) const override final;
     virtual void handlePause(JSC::Debugger::ReasonForPause, JSC::JSGlobalObject*) override final;

Modified: trunk/Source/WebCore/ChangeLog (173550 => 173551)


--- trunk/Source/WebCore/ChangeLog	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/WebCore/ChangeLog	2014-09-12 01:50:24 UTC (rev 173551)
@@ -1,3 +1,13 @@
+2014-09-11  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Occasional ASSERT closing web inspector
+        https://bugs.webkit.org/show_bug.cgi?id=136762
+
+        Reviewed by Timothy Hatcher.
+
+        * bindings/js/WorkerScriptDebugServer.h:
+        * inspector/PageScriptDebugServer.h:
+
 2014-09-11  Chris Dumez  <[email protected]>
 
         Simplify DOM tree traversal in FrameSelection::setSelectionFromNone()

Modified: trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.h (173550 => 173551)


--- trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.h	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/WebCore/bindings/js/WorkerScriptDebugServer.h	2014-09-12 01:50:24 UTC (rev 173551)
@@ -53,7 +53,7 @@
     void interruptAndRunTask(PassOwnPtr<ScriptDebugServer::Task>);
 
 private:
-    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) override { return &m_listeners; }
+    virtual ListenerSet& getListeners() override { return m_listeners; }
     virtual void didPause(JSC::JSGlobalObject*) override { }
     virtual void didContinue(JSC::JSGlobalObject*) override { }
     virtual void runEventLoopWhilePaused() override;

Modified: trunk/Source/WebCore/inspector/PageScriptDebugServer.h (173550 => 173551)


--- trunk/Source/WebCore/inspector/PageScriptDebugServer.h	2014-09-12 01:04:05 UTC (rev 173550)
+++ trunk/Source/WebCore/inspector/PageScriptDebugServer.h	2014-09-12 01:50:24 UTC (rev 173551)
@@ -51,7 +51,7 @@
     virtual void recompileAllJSFunctions() override;
 
 private:
-    virtual ListenerSet* getListenersForGlobalObject(JSC::JSGlobalObject*) override { return &m_listeners; }
+    virtual ListenerSet& getListeners() override { return m_listeners; }
     virtual void didPause(JSC::JSGlobalObject*) override;
     virtual void didContinue(JSC::JSGlobalObject*) override;
     virtual void runEventLoopWhilePaused() override;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to