Commit ff08b7ad authored by joepeck@webkit.org's avatar joepeck@webkit.org

Unreviewed rollout of r162534, this caused inspector test failures.

* bindings/js/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
(WebCore::PageScriptDebugServer::removeListener):
(WebCore::PageScriptDebugServer::recompileAllJSFunctions):
(WebCore::PageScriptDebugServer::didRemoveLastListener):
* bindings/js/PageScriptDebugServer.h:
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsTimerFired):
* bindings/js/ScriptDebugServer.h:
* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::addListener):
(WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
(WebCore::WorkerScriptDebugServer::removeListener):
* inspector/InspectorProfilerAgent.cpp:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162550 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 11c799d2
2014-01-22 Joseph Pecoraro <pecoraro@apple.com>
Unreviewed rollout of r162534, this caused inspector test failures.
* bindings/js/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::addListener):
(WebCore::PageScriptDebugServer::removeListener):
(WebCore::PageScriptDebugServer::recompileAllJSFunctions):
(WebCore::PageScriptDebugServer::didRemoveLastListener):
* bindings/js/PageScriptDebugServer.h:
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::ScriptDebugServer):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsSoon):
(WebCore::ScriptDebugServer::recompileAllJSFunctionsTimerFired):
* bindings/js/ScriptDebugServer.h:
* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::addListener):
(WebCore::WorkerScriptDebugServer::recompileAllJSFunctions):
(WebCore::WorkerScriptDebugServer::removeListener):
* inspector/InspectorProfilerAgent.cpp:
2014-01-22 peavo@outlook.com <peavo@outlook.com>
Crashes in setTextForIterator
......@@ -94,12 +94,10 @@ void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* pag
OwnPtr<ListenerSet>& listeners = m_pageListenersMap.add(page, nullptr).iterator->value;
if (!listeners)
listeners = adoptPtr(new ListenerSet);
bool wasEmpty = listeners->isEmpty();
listeners->add(listener);
if (wasEmpty)
didAddFirstListener(page);
recompileAllJSFunctionsSoon();
page->setDebugger(this);
}
void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page)
......@@ -113,7 +111,6 @@ void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page*
ListenerSet* listeners = it->value.get();
listeners->remove(listener);
if (listeners->isEmpty()) {
m_pageListenersMap.remove(it);
didRemoveLastListener(page);
......@@ -123,7 +120,11 @@ void PageScriptDebugServer::removeListener(ScriptDebugListener* listener, Page*
void PageScriptDebugServer::recompileAllJSFunctions()
{
JSLockHolder lock(JSDOMWindow::commonVM());
Debugger::recompileAllJSFunctions(JSDOMWindow::commonVM());
// If JavaScript stack is not empty postpone recompilation.
if (JSDOMWindow::commonVM()->entryScope)
recompileAllJSFunctionsSoon();
else
Debugger::recompileAllJSFunctions(JSDOMWindow::commonVM());
}
ScriptDebugServer::ListenerSet* PageScriptDebugServer::getListenersForGlobalObject(JSGlobalObject* globalObject)
......@@ -160,13 +161,6 @@ void PageScriptDebugServer::didContinue(JSC::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);
......@@ -174,9 +168,8 @@ void PageScriptDebugServer::didRemoveLastListener(Page* page)
if (m_pausedPage == page)
m_doneProcessingDebuggerEvents = true;
// Clear debugger before recompiling because we do not need sourceParsed callbacks.
page->setDebugger(nullptr);
recompileAllJSFunctions();
recompileAllJSFunctionsSoon();
page->setDebugger(0);
}
void PageScriptDebugServer::runEventLoopWhilePaused()
......
......@@ -65,7 +65,6 @@ private:
virtual void runEventLoopWhilePaused();
void didAddFirstListener(Page*);
void didRemoveLastListener(Page*);
void setJavaScriptPaused(const PageGroup&, bool paused);
......
......@@ -40,7 +40,6 @@
#include "JavaScriptCallFrame.h"
#include "PageConsole.h"
#include "Sound.h"
#include "Timer.h"
#include <bindings/ScriptValue.h>
#include <debugger/DebuggerCallFrame.h>
#include <parser/SourceProvider.h>
......@@ -58,6 +57,7 @@ ScriptDebugServer::ScriptDebugServer(bool isInWorkerThread)
: Debugger(isInWorkerThread)
, m_doneProcessingDebuggerEvents(true)
, m_callingListeners(false)
, m_recompileTimer(this, &ScriptDebugServer::recompileAllJSFunctionsTimerFired)
{
}
......@@ -313,6 +313,16 @@ void ScriptDebugServer::handlePause(Debugger::ReasonForPause, JSGlobalObject* vm
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);
......
......@@ -34,6 +34,7 @@
#include "ScriptBreakpoint.h"
#include "ScriptDebugListener.h"
#include "Timer.h"
#include <bindings/ScriptObject.h>
#include <debugger/Debugger.h>
#include <wtf/HashMap.h>
......@@ -58,6 +59,7 @@ public:
void removeBreakpoint(JSC::BreakpointID);
void clearBreakpoints();
void recompileAllJSFunctionsSoon();
virtual void recompileAllJSFunctions() = 0;
const Vector<ScriptBreakpointAction>& getActionsForBreakpoint(JSC::BreakpointID);
......@@ -107,9 +109,12 @@ private:
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;
};
......
......@@ -55,13 +55,22 @@ void WorkerScriptDebugServer::addListener(ScriptDebugListener* listener)
if (!listener)
return;
bool wasEmpty = m_listeners.isEmpty();
if (m_listeners.isEmpty())
m_workerGlobalScope->script()->attachDebugger(this);
m_listeners.add(listener);
recompileAllJSFunctions();
}
if (wasEmpty) {
m_workerGlobalScope->script()->attachDebugger(this);
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);
}
void WorkerScriptDebugServer::removeListener(ScriptDebugListener* listener)
......@@ -70,19 +79,8 @@ 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()
......
......@@ -73,7 +73,7 @@ public:
private:
virtual void recompileScript() override
{
PageScriptDebugServer::shared().recompileAllJSFunctions();
PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
}
virtual void startProfiling(const String& title) override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment