From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- .../Modules/indexeddb/DOMWindowIndexedDatabase.cpp | 40 +++++++++++++--------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp') diff --git a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp index 75e7a66a6..803844156 100644 --- a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp +++ b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp @@ -29,11 +29,10 @@ #if ENABLE(INDEXED_DATABASE) #include "DOMWindow.h" +#include "DatabaseProvider.h" #include "Document.h" #include "IDBFactory.h" #include "Page.h" -#include "PageGroupIndexedDatabase.h" -#include "SecurityOrigin.h" namespace WebCore { @@ -56,22 +55,23 @@ DOMWindowIndexedDatabase* DOMWindowIndexedDatabase::from(DOMWindow* window) { DOMWindowIndexedDatabase* supplement = static_cast(Supplement::from(window, supplementName())); if (!supplement) { - supplement = new DOMWindowIndexedDatabase(window); - provideTo(window, supplementName(), adoptPtr(supplement)); + auto newSupplement = std::make_unique(window); + supplement = newSupplement.get(); + provideTo(window, supplementName(), WTFMove(newSupplement)); } return supplement; } -void DOMWindowIndexedDatabase::disconnectFrameForPageCache() +void DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension() { - m_suspendedIDBFactory = m_idbFactory.release(); - DOMWindowProperty::disconnectFrameForPageCache(); + m_suspendedIDBFactory = WTFMove(m_idbFactory); + DOMWindowProperty::disconnectFrameForDocumentSuspension(); } -void DOMWindowIndexedDatabase::reconnectFrameFromPageCache(Frame* frame) +void DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension(Frame* frame) { - DOMWindowProperty::reconnectFrameFromPageCache(frame); - m_idbFactory = m_suspendedIDBFactory.release(); + DOMWindowProperty::reconnectFrameFromDocumentSuspension(frame); + m_idbFactory = WTFMove(m_suspendedIDBFactory); } void DOMWindowIndexedDatabase::willDestroyGlobalObjectInCachedFrame() @@ -92,26 +92,32 @@ void DOMWindowIndexedDatabase::willDetachGlobalObjectFromFrame() DOMWindowProperty::willDetachGlobalObjectFromFrame(); } -IDBFactory* DOMWindowIndexedDatabase::indexedDB(DOMWindow* window) +IDBFactory* DOMWindowIndexedDatabase::indexedDB(DOMWindow& window) { - return from(window)->indexedDB(); + return from(&window)->indexedDB(); } IDBFactory* DOMWindowIndexedDatabase::indexedDB() { Document* document = m_window->document(); if (!document) - return 0; + return nullptr; Page* page = document->page(); if (!page) - return 0; + return nullptr; if (!m_window->isCurrentlyDisplayedInFrame()) - return 0; + return nullptr; + + if (!m_idbFactory) { + auto* connectionProxy = document->idbConnectionProxy(); + if (!connectionProxy) + return nullptr; + + m_idbFactory = IDBFactory::create(*connectionProxy); + } - if (!m_idbFactory) - m_idbFactory = IDBFactory::create(PageGroupIndexedDatabase::from(page->group())->factoryBackend()); return m_idbFactory.get(); } -- cgit v1.2.1