15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2008 Apple Inc. All Rights Reserved. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2011 Google, Inc. All Rights Reserved. 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met: 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1. Redistributions of source code must retain the above copyright 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above copyright 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer in the 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * documentation and/or other materials provided with the distribution. 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#include "config.h" 2953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/DatabaseContext.h" 3053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles) 3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/dom/Document.h" 321e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "core/dom/ExecutionContext.h" 3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/Database.h" 3453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/DatabaseManager.h" 3553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/DatabaseTask.h" 3653e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webdatabase/DatabaseThread.h" 3751b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "platform/weborigin/SchemeRegistry.h" 3851b2906e11752df6c18351cf520e30522d3b53a1Torne (Richard Coles)#include "platform/weborigin/SecurityOrigin.h" 3909380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "wtf/Assertions.h" 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 41c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// How the DatabaseContext Life-Cycle works? 44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// ======================================== 45926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// ... in other words, who's keeping the DatabaseContext alive and how long does 46926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// it need to stay alive? 47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 48926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// The DatabaseContext is referenced from RefPtrs in: 491e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// 1. ExecutionContext 50926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 2. Database 51926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 52926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// At Birth: 53926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// ======== 54926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// We create a DatabaseContext only when there is a need i.e. the script tries to 55926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// open a Database via DatabaseManager::openDatabase(). 56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 57bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)// The DatabaseContext constructor will call ref(). This lets DatabaseContext keep itself alive. 58bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)// Note that paired deref() is called from contextDestroyed(). 59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 601e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// Once a DatabaseContext is associated with a ExecutionContext, it will 611e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// live until after the ExecutionContext destructs. This is true even if 62926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// we don't succeed in opening any Databases for that context. When we do 631e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// succeed in opening Databases for this ExecutionContext, the Database 64926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// will re-use the same DatabaseContext. 65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 66926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// At Shutdown: 67926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// =========== 68926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// During shutdown, the DatabaseContext needs to: 691e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// 1. "outlive" the ExecutionContext. 70926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// - This is needed because the DatabaseContext needs to remove itself from the 711e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// ExecutionContext's ActiveDOMObject list and ContextLifecycleObserver 72926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// list. This removal needs to be executed on the script's thread. Hence, we 731e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// rely on the ExecutionContext's shutdown process to call 74926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// stop() and contextDestroyed() to give us a chance to clean these up from 75926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// the script thread. 76926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 77926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 2. "outlive" the Databases. 78926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// - This is because they may make use of the DatabaseContext to execute a close 79926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// task and shutdown in an orderly manner. When the Databases are destructed, 80926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// they will deref the DatabaseContext from the DatabaseThread. 81926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 821e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// During shutdown, the ExecutionContext is shutting down on the script thread 83926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// while the Databases are shutting down on the DatabaseThread. Hence, there can be 841e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// a race condition as to whether the ExecutionContext or the Databases 85926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// destruct first. 86926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// 871e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// The RefPtrs in the Databases and ExecutionContext will ensure that the 88926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// DatabaseContext will outlive both regardless of which of the 2 destructs first. 89926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 9007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben MurdochPassRefPtrWillBeRawPtr<DatabaseContext> DatabaseContext::create(ExecutionContext* context) 91bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){ 9207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch RefPtrWillBeRawPtr<DatabaseContext> self = adoptRefWillBeNoop(new DatabaseContext(context)); 9307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch DatabaseManager::manager().registerDatabaseContext(self.get()); 94bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) return self.release(); 95bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)} 965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 971e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)DatabaseContext::DatabaseContext(ExecutionContext* context) 98926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) : ActiveDOMObject(context) 995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) , m_hasOpenDatabases(false) 100926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) , m_hasRequestedTermination(false) 1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 102926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // ActiveDOMObject expects this to be called to set internal flags. 103926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) suspendIfNeeded(); 104926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 105926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // For debug accounting only. We must do this before we register the 106926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // instance. The assertions assume this. 107926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) DatabaseManager::manager().didConstructDatabaseContext(); 1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)DatabaseContext::~DatabaseContext() 1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 112926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // For debug accounting only. We must call this last. The assertions assume 113926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // this. 114926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) DatabaseManager::manager().didDestructDatabaseContext(); 1155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 11707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdochvoid DatabaseContext::trace(Visitor* visitor) 11807a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch{ 119197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#if ENABLE(OILPAN) 12007a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch visitor->trace(m_databaseThread); 121197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#endif 12207a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch} 12307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch 1241e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)// This is called if the associated ExecutionContext is destructing while 125926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// we're still associated with it. That's our cue to disassociate and shutdown. 126926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// To do this, we stop the database and let everything shutdown naturally 127926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// because the database closing process may still make use of this context. 128926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)// It is not safe to just delete the context here. 129926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)void DatabaseContext::contextDestroyed() 1305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 13107a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch RefPtrWillBeRawPtr<DatabaseContext> protector(this); 132926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) stopDatabases(); 13307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch DatabaseManager::manager().unregisterDatabaseContext(this); 134591b958dee2cf159d33a0b931e6231072eaf38d5Ben Murdoch ActiveDOMObject::contextDestroyed(); 135926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 136926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 1377242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// stop() is from stopActiveDOMObjects() which indicates that the owner 1387242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// LocalFrame is shutting down. Initiate the orderly shutdown by stopping the 1397242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci// associated databases. 140926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)void DatabaseContext::stop() 141926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 142926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) stopDatabases(); 143926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)} 144926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 14507a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben MurdochDatabaseContext* DatabaseContext::backend() 146926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles){ 14707a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch return this; 1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)DatabaseThread* DatabaseContext::databaseThread() 1515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) if (!m_databaseThread && !m_hasOpenDatabases) { 153926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // It's OK to ask for the m_databaseThread after we've requested 154926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // termination because we're still using it to execute the closing 155926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // of the database. However, it is NOT OK to create a new thread 156926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // after we've requested termination. 157926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) ASSERT(!m_hasRequestedTermination); 158926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // Create the database thread on first request - but not if at least one database was already opened, 1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) // because in that case we already had a database thread and terminated it and should not create another. 1615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) m_databaseThread = DatabaseThread::create(); 162a854de003a23bf3c7f95ec0f8154ada64092ff5cTorne (Richard Coles) m_databaseThread->start(); 1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return m_databaseThread.get(); 1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1687242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tuccibool DatabaseContext::databaseThreadAvailable() 169d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 1707242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci return databaseThread() && !m_hasRequestedTermination; 171d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 172d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 173d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)void DatabaseContext::stopDatabases() 1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 175926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // Though we initiate termination of the DatabaseThread here in 176926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // stopDatabases(), we can't clear the m_databaseThread ref till we get to 177926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // the destructor. This is because the Databases that are managed by 178926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // DatabaseThread still rely on this ref between the context and the thread 179926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // to execute the task for closing the database. By the time we get to the 180926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // destructor, we're guaranteed that the databases are destructed (which is 181926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // why our ref count is 0 then and we're destructing). Then, the 182926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // m_databaseThread RefPtr destructor will deref and delete the 183926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) // DatabaseThread. 184926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) 1857242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci if (databaseThreadAvailable()) { 186926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) m_hasRequestedTermination = true; 1877242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci // This blocks until the database thread finishes the cleanup task. 1887242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci m_databaseThread->terminate(); 189926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) } 1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)bool DatabaseContext::allowDatabaseAccess() const 1935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1947242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci return toDocument(executionContext())->isActive(); 1955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 197bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)SecurityOrigin* DatabaseContext::securityOrigin() const 198bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){ 199bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) return executionContext()->securityOrigin(); 200bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)} 201bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) 202bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)bool DatabaseContext::isContextThread() const 203bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles){ 204bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) return executionContext()->isContextThread(); 205bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)} 206bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) 207c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink 208