Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Unified Diff: third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp

Issue 1880273002: [DevTools] Create last agents on attach, modify InspectorDatabaseAgent to support it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: two databases in the test Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
diff --git a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
index 434a9c5e9cb03bf7e777a24367a39a585e4a079c..13af0af44031a5fcd2d6ea08a94df69070d7d49f 100644
--- a/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/DatabaseTracker.cpp
@@ -30,6 +30,7 @@
#include "modules/webdatabase/DatabaseTracker.h"
+#include "core/dom/Document.h"
#include "core/dom/ExecutionContext.h"
#include "core/dom/ExecutionContextTask.h"
#include "modules/webdatabase/Database.h"
@@ -209,6 +210,23 @@ void DatabaseTracker::closeDatabasesImmediately(SecurityOrigin* origin, const St
(*it)->getDatabaseContext()->getExecutionContext()->postTask(BLINK_FROM_HERE, CloseOneDatabaseImmediatelyTask::create(originString, name, *it));
}
+void DatabaseTracker::forEachOpenDatabaseInPage(Page* page, PassOwnPtr<DatabaseCallback> callback)
+{
+ MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard);
+ if (!m_openDatabaseMap)
+ return;
+ for (auto& originMap : *m_openDatabaseMap) {
+ for (auto& nameDatabaseSet : *originMap.value) {
+ for (Database* database : *nameDatabaseSet.value) {
+ ExecutionContext* context = database->getExecutionContext();
+ ASSERT(context->isDocument());
+ if (toDocument(context)->frame()->page() == page)
+ (*callback)(database);
+ }
+ }
+ }
+}
+
void DatabaseTracker::closeOneDatabaseImmediately(const String& originString, const String& name, Database* database)
{
// First we have to confirm the 'database' is still in our collection.

Powered by Google App Engine
This is Rietveld 408576698