Title: [161761] trunk/Source/WebCore
Revision
161761
Author
[email protected]
Date
2014-01-11 07:51:31 -0800 (Sat, 11 Jan 2014)

Log Message

Web Inspector: Some ScriptDebugServer Cleanup
https://bugs.webkit.org/show_bug.cgi?id=126793

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

* bindings/js/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::didContinue):
(WebCore::PageScriptDebugServer::runEventLoopWhilePaused):
Move the special iOS WebThread EventLoop nesting handling here.

* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::handlePause):
* bindings/js/ScriptDebugServer.h:
* inspector/InspectorDebuggerAgent.cpp:
* inspector/InspectorDebuggerAgent.h:
Remove unused headers and functions.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161760 => 161761)


--- trunk/Source/WebCore/ChangeLog	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/ChangeLog	2014-01-11 15:51:31 UTC (rev 161761)
@@ -1,3 +1,23 @@
+2014-01-11  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Some ScriptDebugServer Cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=126793
+
+        Reviewed by Timothy Hatcher.
+
+        * bindings/js/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::didContinue):
+        (WebCore::PageScriptDebugServer::runEventLoopWhilePaused):
+        Move the special iOS WebThread EventLoop nesting handling here.
+
+        * bindings/js/ScriptDebugServer.cpp:
+        (WebCore::ScriptDebugServer::ScriptDebugServer):
+        (WebCore::ScriptDebugServer::handlePause):
+        * bindings/js/ScriptDebugServer.h:
+        * inspector/InspectorDebuggerAgent.cpp:
+        * inspector/InspectorDebuggerAgent.h:
+        Remove unused headers and functions.
+
 2014-01-11  David Kilzer  <[email protected]>
 
         [iOS] Add USE(IOSURFACE_CANVAS_BACKING_STORE) to fix build

Modified: trunk/Source/WebCore/bindings/js/PageScriptDebugServer.cpp (161760 => 161761)


--- trunk/Source/WebCore/bindings/js/PageScriptDebugServer.cpp	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/bindings/js/PageScriptDebugServer.cpp	2014-01-11 15:51:31 UTC (rev 161761)
@@ -52,6 +52,11 @@
 #include <wtf/PassOwnPtr.h>
 #include <wtf/StdLibExtras.h>
 
+#if PLATFORM(IOS)
+#include "JSDOMWindowBase.h"
+#include "WebCoreThreadInternal.h"
+#endif
+
 using namespace JSC;
 
 namespace WebCore {
@@ -148,11 +153,6 @@
 {
     // Page can be null if we are continuing because the Page closed.
     Page* page = toPage(globalObject);
-#if PLATFORM(IOS)
-    // FIXME: Can this happen in open source too, or is this iOS (multi-threaded) only?
-    if (!page)
-        return;
-#endif
     ASSERT(!page || page == m_pausedPage);
 
     m_pausedPage = 0;
@@ -174,9 +174,26 @@
 
 void PageScriptDebugServer::runEventLoopWhilePaused()
 {
+#if PLATFORM(IOS)
+    // On iOS, running an EventLoop causes us to run a nested WebRunLoop.
+    // Since the WebThread is autoreleased at the end of run loop iterations
+    // we need to gracefully handle releasing and reacquiring the lock.
+    ASSERT(WebThreadIsLockedOrDisabled());
+    {
+        if (WebThreadIsEnabled())
+            JSC::JSLock::DropAllLocks dropAllLocks(WebCore::JSDOMWindowBase::commonVM(), JSC::JSLock::DropAllLocks::AlwaysDropLocks);
+        WebRunLoopEnableNested();
+#endif
+
     EventLoop loop;
     while (!m_doneProcessingDebuggerEvents && !loop.ended())
         loop.cycle();
+
+#if PLATFORM(IOS)
+        WebRunLoopDisableNested();
+    }
+    ASSERT(WebThreadIsLockedOrDisabled());
+#endif
 }
 
 void PageScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool paused)

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp (161760 => 161761)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.cpp	2014-01-11 15:51:31 UTC (rev 161761)
@@ -33,15 +33,11 @@
 
 #include "ScriptDebugServer.h"
 
-#include "ContentSearchUtils.h"
 #include "EventLoop.h"
-#include "Frame.h"
 #include "JSDOMWindowCustom.h"
 #include "JSJavaScriptCallFrame.h"
 #include "_javascript_CallFrame.h"
 #include "PageConsole.h"
-#include "ScriptBreakpoint.h"
-#include "ScriptDebugListener.h"
 #include "Sound.h"
 #include <bindings/ScriptValue.h>
 #include <debugger/DebuggerCallFrame.h>
@@ -50,11 +46,6 @@
 #include <wtf/MainThread.h>
 #include <wtf/text/WTFString.h>
 
-#if PLATFORM(IOS)
-#include "JSDOMWindowBase.h"
-#include "WebCoreThreadInternal.h"
-#endif
-
 using namespace JSC;
 
 namespace WebCore {
@@ -63,7 +54,6 @@
     : Debugger(isInWorkerThread)
     , m_doneProcessingDebuggerEvents(true)
     , m_callingListeners(false)
-    , m_runningNestedMessageLoop(false)
     , m_recompileTimer(this, &ScriptDebugServer::recompileAllJSFunctions)
 {
 }
@@ -283,27 +273,9 @@
 
     TimerBase::fireTimersInNestedEventLoop();
 
-#if PLATFORM(IOS)
-    // On iOS, running an EventLoop causes us to run a nested WebRunLoop.
-    // Since the WebThread is autoreleased at the end of run loop iterations
-    // we need to gracefully handle releasing and reacquiring the lock.
-    ASSERT(WebThreadIsLockedOrDisabled());
-    {
-        if (WebThreadIsEnabled())
-            JSC::JSLock::DropAllLocks dropAllLocks(WebCore::JSDOMWindowBase::commonVM(), JSC::JSLock::DropAllLocks::AlwaysDropLocks);
-        WebRunLoopEnableNested();
-#endif
-
-    m_runningNestedMessageLoop = true;
     m_doneProcessingDebuggerEvents = false;
     runEventLoopWhilePaused();
-    m_runningNestedMessageLoop = false;
 
-#if PLATFORM(IOS)
-        WebRunLoopDisableNested();
-    }
-    ASSERT(WebThreadIsLockedOrDisabled());
-#endif
     didContinue(vmEntryGlobalObject);
     dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject);
 }

Modified: trunk/Source/WebCore/bindings/js/ScriptDebugServer.h (161760 => 161761)


--- trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/bindings/js/ScriptDebugServer.h	2014-01-11 15:51:31 UTC (rev 161761)
@@ -62,8 +62,6 @@
     void recompileAllJSFunctionsSoon();
     virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0;
 
-    bool runningNestedMessageLoop() { return m_runningNestedMessageLoop; }
-
     class Task {
         WTF_MAKE_FAST_ALLOCATED;
     public:
@@ -95,22 +93,20 @@
     void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, bool isContentScript);
     void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage);
 
-    virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg) OVERRIDE;
-
     bool m_doneProcessingDebuggerEvents;
 
 private:
     typedef Vector<ScriptBreakpointAction> BreakpointActions;
     typedef HashMap<JSC::BreakpointID, BreakpointActions> BreakpointIDToActionsMap;
 
-    virtual bool needPauseHandling(JSC::JSGlobalObject*) OVERRIDE;
-    virtual void handleBreakpointHit(const JSC::Breakpoint&) OVERRIDE;
-    virtual void handleExceptionInBreakpointCondition(JSC::ExecState*, JSC::JSValue exception) const OVERRIDE;
-    virtual void handlePause(JSC::Debugger::ReasonForPause, JSC::JSGlobalObject*) OVERRIDE;
-    virtual void notifyDoneProcessingDebuggerEvents() OVERRIDE;
+    virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const String& errorMsg) OVERRIDE FINAL;
+    virtual bool needPauseHandling(JSC::JSGlobalObject*) OVERRIDE FINAL;
+    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;
+    virtual void notifyDoneProcessingDebuggerEvents() OVERRIDE FINAL;
 
     bool m_callingListeners;
-    bool m_runningNestedMessageLoop;
     BreakpointIDToActionsMap m_breakpointIDToActions;
     Timer<ScriptDebugServer> m_recompileTimer;
 

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp (161760 => 161761)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp	2014-01-11 15:51:31 UTC (rev 161761)
@@ -149,11 +149,6 @@
     return scriptDebugServer().isPaused();
 }
 
-bool InspectorDebuggerAgent::runningNestedMessageLoop()
-{
-    return scriptDebugServer().runningNestedMessageLoop();
-}
-
 void InspectorDebuggerAgent::addMessageToConsole(MessageSource source, MessageType type)
 {
     if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontPauseOnExceptions && source == ConsoleAPIMessageSource && type == AssertMessageType)

Modified: trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h (161760 => 161761)


--- trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2014-01-11 14:17:12 UTC (rev 161760)
+++ trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h	2014-01-11 15:51:31 UTC (rev 161761)
@@ -74,7 +74,6 @@
     virtual void willDestroyFrontendAndBackend() OVERRIDE;
 
     bool isPaused();
-    bool runningNestedMessageLoop();
     void addMessageToConsole(MessageSource, MessageType);
 
     // Part of the protocol.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to