https://bugs.webkit.org/show_bug.cgi?id=127409
Reviewed by Timothy Hatcher.
* bindings/js/ScriptDebugServer.h:
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::ScriptDebugServer):
Remove m_recompileTimer and the recompile soon function.
We can just recompile immediately in all existing cases.
* bindings/js/PageScriptDebugServer.h:
* bindings/js/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
(WebCore::PageScriptDebugServer::removeListener):
(WebCore::PageScriptDebugServer::recompileAllJSFunctions):
(WebCore::PageScriptDebugServer::didAddFirstListener):
(WebCore::PageScriptDebugServer::didRemoveLastListener):
Add a "didAddFirstListener" to match "didRemoveLastListener".
Only recompile functions when we attach the debugger and when
we detach the last listener.
* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::addListener):
(WebCore::WorkerScriptDebugServer::removeListener):
(WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
Same thing. Also rearrange the functions to read better.
* inspector/InspectorProfilerAgent.cpp:
Use the direct recompile function instead of the removed "soon" version.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162534
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-01-21 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Remove recompileAllJSFunctions timer in ScriptDebugServer
+ https://bugs.webkit.org/show_bug.cgi?id=127409
+
+ Reviewed by Timothy Hatcher.
+
+ * bindings/js/ScriptDebugServer.h:
+ * bindings/js/ScriptDebugServer.cpp:
+ (WebCore::ScriptDebugServer::ScriptDebugServer):
+ Remove m_recompileTimer and the recompile soon function.
+ We can just recompile immediately in all existing cases.
+
+ * bindings/js/PageScriptDebugServer.h:
+ * bindings/js/PageScriptDebugServer.cpp:
+ (WebCore::PageScriptDebugServer::addListener):
+ (WebCore::PageScriptDebugServer::removeListener):
+ (WebCore::PageScriptDebugServer::recompileAllJSFunctions):
+ (WebCore::PageScriptDebugServer::didAddFirstListener):
+ (WebCore::PageScriptDebugServer::didRemoveLastListener):
+ Add a "didAddFirstListener" to match "didRemoveLastListener".
+ Only recompile functions when we attach the debugger and when
+ we detach the last listener.
+
+ * bindings/js/WorkerScriptDebugServer.cpp:
+ (WebCore::WorkerScriptDebugServer::addListener):
+ (WebCore::WorkerScriptDebugServer::removeListener):
+ (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
+ Same thing. Also rearrange the functions to read better.
+
+ * inspector/InspectorProfilerAgent.cpp:
+ Use the direct recompile function instead of the removed "soon" version.
+
2014-01-22 Robert Sipka <sipka@inf.u-szeged.hu>
[curl] Improve detecting and handling of SSL client certificate
OwnPtr<ListenerSet>& listeners = m_pageListenersMap.add(page, nullptr).iterator->value;
if (!listeners)
listeners = adoptPtr(new ListenerSet);
+
+ bool wasEmpty = listeners->isEmpty();
listeners->add(listener);
- recompileAllJSFunctionsSoon();
- page->setDebugger(this);
+ if (wasEmpty)
+ didAddFirstListener(page);
}
void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
ListenerSet* listeners = it->value.get();
listeners->remove(listener);
+
if (listeners->isEmpty()) {
m_pageListenersMap.remove(it);
didRemoveLastListener(page);
void PageScriptDebugServer::recompileAllJSFunctions()
{
JSLockHolder lock(JSDOMWindow::commonVM());
- // If JavaScript stack is not empty postpone recompilation.
- if (JSDOMWindow::commonVM()->entryScope)
- recompileAllJSFunctionsSoon();
- else
- Debugger::recompileAllJSFunctions(JSDOMWindow::commonVM());
+ Debugger::recompileAllJSFunctions(JSDOMWindow::commonVM());
}
ScriptDebugServer::ListenerSet* PageScriptDebugServer::getListenersForGlobalObject(JSGlobalObject* globalObject)
setJavaScriptPaused(page->group(), false);
}
+void PageScriptDebugServer::didAddFirstListener(Page* page)
+{
+ // Set debugger before recompiling to get sourceParsed callbacks.
+ page->setDebugger(this);
+ recompileAllJSFunctions();
+}
+
void PageScriptDebugServer::didRemoveLastListener(Page* page)
{
ASSERT(page);
if (m_pausedPage == page)
m_doneProcessingDebuggerEvents = true;
- recompileAllJSFunctionsSoon();
- page->setDebugger(0);
+ // Clear debugger before recompiling because we do not need sourceParsed callbacks.
+ page->setDebugger(nullptr);
+ recompileAllJSFunctions();
}
void PageScriptDebugServer::runEventLoopWhilePaused()
virtual void runEventLoopWhilePaused();
+ void didAddFirstListener(Page*);
void didRemoveLastListener(Page*);
void setJavaScriptPaused(const PageGroup&, bool paused);
#include "JavaScriptCallFrame.h"
#include "PageConsole.h"
#include "Sound.h"
+#include "Timer.h"
#include <bindings/ScriptValue.h>
#include <debugger/DebuggerCallFrame.h>
#include <parser/SourceProvider.h>
: Debugger(isInWorkerThread)
, m_doneProcessingDebuggerEvents(true)
, m_callingListeners(false)
- , m_recompileTimer(this, &ScriptDebugServer::recompileAllJSFunctionsTimerFired)
{
}
dispatchFunctionToListeners(&ScriptDebugServer::dispatchDidContinue, vmEntryGlobalObject);
}
-void ScriptDebugServer::recompileAllJSFunctionsSoon()
-{
- m_recompileTimer.startOneShot(0);
-}
-
-void ScriptDebugServer::recompileAllJSFunctionsTimerFired(Timer<ScriptDebugServer>&)
-{
- recompileAllJSFunctions();
-}
-
const Vector<ScriptBreakpointAction>& ScriptDebugServer::getActionsForBreakpoint(JSC::BreakpointID breakpointID)
{
ASSERT(breakpointID != JSC::noBreakpointID);
#include "ScriptBreakpoint.h"
#include "ScriptDebugListener.h"
-#include "Timer.h"
#include <bindings/ScriptObject.h>
#include <debugger/Debugger.h>
#include <wtf/HashMap.h>
void removeBreakpoint(JSC::BreakpointID);
void clearBreakpoints();
- void recompileAllJSFunctionsSoon();
virtual void recompileAllJSFunctions() = 0;
const Vector<ScriptBreakpointAction>& getActionsForBreakpoint(JSC::BreakpointID);
virtual void handlePause(JSC::Debugger::ReasonForPause, JSC::JSGlobalObject*) override final;
virtual void notifyDoneProcessingDebuggerEvents() override final;
- void recompileAllJSFunctionsTimerFired(Timer<ScriptDebugServer>&);
-
unsigned m_hitCount;
bool m_callingListeners;
BreakpointIDToActionsMap m_breakpointIDToActions;
- Timer<ScriptDebugServer> m_recompileTimer;
friend class DebuggerCallFrameScope;
};
if (!listener)
return;
- if (m_listeners.isEmpty())
- m_workerGlobalScope->script()->attachDebugger(this);
+ bool wasEmpty = m_listeners.isEmpty();
m_listeners.add(listener);
- recompileAllJSFunctions();
-}
-
-void WorkerScriptDebugServer::recompileAllJSFunctions()
-{
- JSC::VM* vm = m_workerGlobalScope->script()->vm();
- JSC::JSLockHolder lock(vm);
- // If JavaScript stack is not empty postpone recompilation.
- if (vm->entryScope)
- recompileAllJSFunctionsSoon();
- else
- JSC::Debugger::recompileAllJSFunctions(vm);
+ if (wasEmpty) {
+ m_workerGlobalScope->script()->attachDebugger(this);
+ recompileAllJSFunctions();
+ }
}
void WorkerScriptDebugServer::removeListener(ScriptDebugListener* listener)
return;
m_listeners.remove(listener);
- if (m_listeners.isEmpty())
+
+ if (m_listeners.isEmpty()) {
m_workerGlobalScope->script()->detachDebugger(this);
+ recompileAllJSFunctions();
+ }
+}
+
+void WorkerScriptDebugServer::recompileAllJSFunctions()
+{
+ JSC::VM* vm = m_workerGlobalScope->script()->vm();
+
+ JSC::JSLockHolder lock(vm);
+ JSC::Debugger::recompileAllJSFunctions(vm);
}
void WorkerScriptDebugServer::runEventLoopWhilePaused()
private:
virtual void recompileScript() override
{
- PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ PageScriptDebugServer::shared().recompileAllJSFunctions();
}
virtual void startProfiling(const String& title) override