Web Inspector: Remove duplication among ScriptDebugServer subclasses
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 00:43:58 +0000 (00:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 Nov 2015 00:43:58 +0000 (00:43 +0000)
commit2a566dacfbd5ff87197bd6bb789751706565511a
treea0cc5aa7764b65ed605469a81b72eb6e79889784
parent777964d4921f35adf7b2436f8e8e5f82eeb67504
Web Inspector: Remove duplication among ScriptDebugServer subclasses
https://bugs.webkit.org/show_bug.cgi?id=150860

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-11-03
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

ScriptDebugServer expects a list of listeners to dispatch events to.
However each of its subclasses had their own implementation of the
list because of different handling when the first was added or when
the last was removed. Extract common code into ScriptDebugServer
which simplifies things.

Subclasses now only implement a virtual methods "attachDebugger"
and "detachDebugger" which is the unique work done when the first
listener is added or last is removed.

* inspector/JSGlobalObjectScriptDebugServer.cpp:
(Inspector::JSGlobalObjectScriptDebugServer::attachDebugger):
(Inspector::JSGlobalObjectScriptDebugServer::detachDebugger):
(Inspector::JSGlobalObjectScriptDebugServer::addListener): Deleted.
(Inspector::JSGlobalObjectScriptDebugServer::removeListener): Deleted.
* inspector/JSGlobalObjectScriptDebugServer.h:
* inspector/ScriptDebugServer.cpp:
(Inspector::ScriptDebugServer::dispatchBreakpointActionLog):
(Inspector::ScriptDebugServer::dispatchBreakpointActionSound):
(Inspector::ScriptDebugServer::dispatchBreakpointActionProbe):
(Inspector::ScriptDebugServer::sourceParsed):
(Inspector::ScriptDebugServer::dispatchFunctionToListeners):
(Inspector::ScriptDebugServer::addListener):
(Inspector::ScriptDebugServer::removeListener):
* inspector/ScriptDebugServer.h:
* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::enable):
(Inspector::InspectorDebuggerAgent::disable):
* inspector/agents/InspectorDebuggerAgent.h:
* inspector/agents/JSGlobalObjectDebuggerAgent.cpp:
(Inspector::JSGlobalObjectDebuggerAgent::startListeningScriptDebugServer): Deleted.
(Inspector::JSGlobalObjectDebuggerAgent::stopListeningScriptDebugServer): Deleted.
* inspector/agents/JSGlobalObjectDebuggerAgent.h:

* inspector/ScriptDebugListener.h:
(Inspector::ScriptDebugListener::Script::Script):
Drive-by convert Script to a struct, it has public fields and is used as such.

Source/WebCore:

Refactoring covered by existing tests.

* bindings/js/WorkerScriptDebugServer.cpp:
(WebCore::WorkerScriptDebugServer::attachDebugger):
(WebCore::WorkerScriptDebugServer::detachDebugger):
(WebCore::WorkerScriptDebugServer::addListener): Deleted.
(WebCore::WorkerScriptDebugServer::removeListener): Deleted.
* bindings/js/WorkerScriptDebugServer.h:
* inspector/PageDebuggerAgent.cpp:
(WebCore::PageDebuggerAgent::startListeningScriptDebugServer): Deleted.
(WebCore::PageDebuggerAgent::stopListeningScriptDebugServer): Deleted.
* inspector/PageDebuggerAgent.h:
* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::attachDebugger):
(WebCore::PageScriptDebugServer::detachDebugger):
(WebCore::PageScriptDebugServer::addListener): Deleted.
(WebCore::PageScriptDebugServer::removeListener): Deleted.
* inspector/PageScriptDebugServer.h:
* inspector/WorkerDebuggerAgent.cpp:
(WebCore::WorkerDebuggerAgent::startListeningScriptDebugServer): Deleted.
(WebCore::WorkerDebuggerAgent::stopListeningScriptDebugServer): Deleted.
* inspector/WorkerDebuggerAgent.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191997 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp
Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h
Source/JavaScriptCore/inspector/ScriptDebugListener.h
Source/JavaScriptCore/inspector/ScriptDebugServer.cpp
Source/JavaScriptCore/inspector/ScriptDebugServer.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/JSGlobalObjectDebuggerAgent.h
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/WorkerScriptDebugServer.cpp
Source/WebCore/bindings/js/WorkerScriptDebugServer.h
Source/WebCore/inspector/PageDebuggerAgent.cpp
Source/WebCore/inspector/PageDebuggerAgent.h
Source/WebCore/inspector/PageScriptDebugServer.cpp
Source/WebCore/inspector/PageScriptDebugServer.h
Source/WebCore/inspector/WorkerDebuggerAgent.cpp
Source/WebCore/inspector/WorkerDebuggerAgent.h