Web Inspector: Database: lazily create the agent
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 18:53:47 +0000 (18:53 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Mar 2019 18:53:47 +0000 (18:53 +0000)
commit367f719a78c1b9b9025c0cda38161d369eaee4e2
tree5770fff6a3a75471edaff2c4cf3247037ad92d24
parent04d41d9db24cab461cf619b7852600e5f2839afd
Web Inspector: Database: lazily create the agent
https://bugs.webkit.org/show_bug.cgi?id=195587
<rdar://problem/48791735>

Reviewed by Timothy Hatcher.

Source/WebCore:

No change in functionality.

* inspector/agents/InspectorDatabaseAgent.h:
* inspector/agents/InspectorDatabaseAgent.cpp:
(WebCore::InspectorDatabaseAgent::didCommitLoad): Added.
(WebCore::InspectorDatabaseAgent::didOpenDatabase):
(WebCore::InspectorDatabaseAgent::InspectorDatabaseAgent):
(WebCore::InspectorDatabaseAgent::enable):
(WebCore::InspectorDatabaseAgent::disable):
(WebCore::InspectorDatabaseAgent::getDatabaseTableNames):
(WebCore::InspectorDatabaseAgent::executeSQL):
(WebCore::InspectorDatabaseAgent::databaseId):
(WebCore::InspectorDatabaseAgent::findByFileName):
(WebCore::InspectorDatabaseAgent::databaseForId):
(WebCore::InspectorDatabaseAgent::clearResources): Deleted.
(WebCore::InspectorDatabaseAgent::~InspectorDatabaseAgent): Deleted.
* inspector/InspectorDatabaseResource.h:
(WebCore::InspectorDatabaseResource::database const):
(WebCore::InspectorDatabaseResource::setDatabase):
(WebCore::InspectorDatabaseResource::database): Deleted.
* inspector/InspectorDatabaseResource.cpp:
(WebCore::InspectorDatabaseResource::create):
(WebCore::InspectorDatabaseResource::InspectorDatabaseResource):
(WebCore::InspectorDatabaseResource::bind):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didOpenDatabase):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didCommitLoadImpl):
(WebCore::InspectorInstrumentation::didOpenDatabaseImpl):
Pass the `Database` as a reference instead of a pointer. Retrieve any information directly
from the `Database`, rather than using the arguments that were used to create it.

* Modules/webdatabase/Database.h:
(WebCore::Database::expectedVersion const): Deleted.
* Modules/webdatabase/Database.cpp:
(WebCore::Database::expectedVersion const): Added.
* Modules/webdatabase/DatabaseManager.cpp:
(WebCore::DatabaseManager::openDatabase):
* Modules/webdatabase/DatabaseTracker.h:
* Modules/webdatabase/DatabaseTracker.cpp:
(WebCore::DatabaseTracker::closeAllDatabases):
(WebCore::DatabaseTracker::openDatabases): Added.
Expose various values used by `InspectorDatabaseAgent` and `InspectorDatabaseResource`.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
(WebCore::InspectorController::createLazyAgents):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::WorkerInspectorController):

* inspector/CommandLineAPIHost.h:
(WebCore::CommandLineAPIHost::init):
* inspector/CommandLineAPIHost.cpp:
(WebCore::CommandLineAPIHost::disconnect):
(WebCore::CommandLineAPIHost::inspect):
(WebCore::CommandLineAPIHost::clearConsoleMessages):
(WebCore::CommandLineAPIHost::databaseId):
(WebCore::CommandLineAPIHost::storageId):
Rather than pass each agent individually, pass the entire `InstrumentingAgents` so that the
current agent can be used instead of whatever was initially created.

LayoutTests:

* inspector/protocol/backend-dispatcher-argument-errors.html:
* inspector/runtime/CommandLineAPI-inspect.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/protocol/backend-dispatcher-argument-errors-expected.txt
LayoutTests/inspector/protocol/backend-dispatcher-argument-errors.html
LayoutTests/inspector/runtime/CommandLineAPI-inspect.html
Source/WebCore/ChangeLog
Source/WebCore/Modules/webdatabase/Database.cpp
Source/WebCore/Modules/webdatabase/Database.h
Source/WebCore/Modules/webdatabase/DatabaseManager.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.cpp
Source/WebCore/Modules/webdatabase/DatabaseTracker.h
Source/WebCore/inspector/CommandLineAPIHost.cpp
Source/WebCore/inspector/CommandLineAPIHost.h
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorDatabaseResource.cpp
Source/WebCore/inspector/InspectorDatabaseResource.h
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/agents/InspectorDatabaseAgent.cpp
Source/WebCore/inspector/agents/InspectorDatabaseAgent.h