Changeset 109319 in webkit
- Timestamp:
- Feb 29, 2012 11:46:27 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r109192 r109319 1388 1388 storage/Database.cpp 1389 1389 storage/DatabaseAuthorizer.cpp 1390 storage/DatabaseContext.cpp 1390 1391 storage/DatabaseSync.cpp 1391 1392 storage/DatabaseTask.cpp -
trunk/Source/WebCore/ChangeLog
r109313 r109319 1 2012-02-29 Adam Barth <abarth@webkit.org> 2 3 ScriptExecutionContext has too many ifdef ENABLE(SQL_DATABASE) 4 https://bugs.webkit.org/show_bug.cgi?id=79633 5 6 Reviewed by Eric Seidel. 7 8 This class creates a DatabaseContext object to supplement the 9 ScriptExecutionContext with database-specific information. This new 10 object lets us remove a bunch of database-specific (and ifdefed) logic 11 from ScriptExecutionContext.(cpp|h). 12 13 * CMakeLists.txt: 14 * GNUmakefile.list.am: 15 * Target.pri: 16 * WebCore.exp.in: 17 * WebCore.gypi: 18 * WebCore.vcproj/WebCore.vcproj: 19 * WebCore.xcodeproj/project.pbxproj: 20 * dom/ScriptExecutionContext.cpp: 21 (WebCore::ScriptExecutionContext::ScriptExecutionContext): 22 (WebCore::ScriptExecutionContext::~ScriptExecutionContext): 23 (WebCore): 24 * dom/ScriptExecutionContext.h: 25 (WebCore): 26 (ScriptExecutionContext): 27 * history/PageCache.cpp: 28 (WebCore::logCanCacheFrameDecision): 29 (WebCore::PageCache::canCachePageContainingThisFrame): 30 * loader/FrameLoader.cpp: 31 (WebCore::FrameLoader::stopLoading): 32 * platform/Supplementable.h: 33 (WebCore::Supplementable::provideSupplement): 34 (WebCore::Supplementable::requireSupplement): 35 (Supplementable): 36 * storage/AbstractDatabase.cpp: 37 (WebCore::AbstractDatabase::AbstractDatabase): 38 * storage/AbstractDatabase.h: 39 (WebCore): 40 (WebCore::AbstractDatabase::databaseContext): 41 (AbstractDatabase): 42 * storage/Database.cpp: 43 (WebCore::Database::openDatabase): 44 (WebCore::Database::Database): 45 (WebCore::Database::openAndVerifyVersion): 46 (WebCore::Database::markAsDeletedAndClose): 47 (WebCore::Database::close): 48 (WebCore::Database::closeImmediately): 49 (WebCore::Database::performOpenAndVerify): 50 (WebCore::Database::scheduleTransaction): 51 (WebCore::Database::scheduleTransactionStep): 52 (WebCore::Database::transactionClient): 53 (WebCore::Database::transactionCoordinator): 54 (WebCore::Database::tableNames): 55 (WebCore::Database::securityOrigin): 56 * storage/DatabaseContext.cpp: Added. 57 (WebCore): 58 (WebCore::existingDatabaseContextFrom): 59 (WebCore::DatabaseContext::DatabaseContext): 60 (WebCore::DatabaseContext::~DatabaseContext): 61 (WebCore::DatabaseContext::from): 62 (WebCore::DatabaseContext::databaseThread): 63 (WebCore::DatabaseContext::hasOpenDatabases): 64 (WebCore::DatabaseContext::stopDatabases): 65 * storage/DatabaseContext.h: Added. 66 (WebCore): 67 (DatabaseContext): 68 (WebCore::DatabaseContext::setHasOpenDatabases): 69 * storage/SQLTransaction.cpp: 70 (WebCore::SQLTransaction::checkAndHandleClosedOrInterruptedDatabase): 71 (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown): 72 * workers/WorkerThread.cpp: 73 (WebCore::WorkerThreadShutdownStartTask::performTask): 74 1 75 2012-02-29 Shinya Kawanaka <shinyak@chromium.org> 2 76 -
trunk/Source/WebCore/GNUmakefile.list.am
r109192 r109319 3862 3862 Source/WebCore/storage/DOMWindowSQLDatabase.cpp \ 3863 3863 Source/WebCore/storage/DOMWindowSQLDatabase.h \ 3864 Source/WebCore/storage/Database.cpp \ 3865 Source/WebCore/storage/Database.h \ 3864 3866 Source/WebCore/storage/DatabaseAuthorizer.cpp \ 3865 3867 Source/WebCore/storage/DatabaseAuthorizer.h \ 3866 3868 Source/WebCore/storage/DatabaseCallback.h \ 3867 Source/WebCore/storage/Database.cpp \ 3869 Source/WebCore/storage/DatabaseContext.cpp \ 3870 Source/WebCore/storage/DatabaseContext.h \ 3868 3871 Source/WebCore/storage/DatabaseDetails.h \ 3869 Source/WebCore/storage/Database.h \3870 3872 Source/WebCore/storage/DatabaseSync.cpp \ 3871 3873 Source/WebCore/storage/DatabaseSync.h \ -
trunk/Source/WebCore/Target.pri
r109192 r109319 1305 1305 storage/Database.cpp \ 1306 1306 storage/DatabaseAuthorizer.cpp \ 1307 storage/DatabaseContext.cpp \ 1307 1308 storage/DatabaseSync.cpp \ 1308 1309 storage/StorageTask.cpp \ -
trunk/Source/WebCore/WebCore.exp.in
r109255 r109319 420 420 __ZN7WebCore15DOMWrapperWorld13clearWrappersEv 421 421 __ZN7WebCore15DOMWrapperWorldD1Ev 422 __ZN7WebCore15DatabaseContext16hasOpenDatabasesEPNS_22ScriptExecutionContextE 422 423 __ZN7WebCore15DatabaseTracker12deleteOriginEPNS_14SecurityOriginE 423 424 __ZN7WebCore15DatabaseTracker14deleteDatabaseEPNS_14SecurityOriginERKN3WTF6StringE -
trunk/Source/WebCore/WebCore.gypi
r109297 r109319 4641 4641 'storage/DatabaseAuthorizer.h', 4642 4642 'storage/DatabaseCallback.h', 4643 'storage/DatabaseContext.cpp', 4644 'storage/DatabaseContext.h', 4643 4645 'storage/DatabaseSync.cpp', 4644 4646 'storage/DatabaseSync.h', -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r109192 r109319 70683 70683 </File> 70684 70684 <File 70685 RelativePath="..\storage\DatabaseContext.cpp" 70686 > 70687 </File> 70688 <File 70689 RelativePath="..\storage\DatabaseContext.h" 70690 > 70691 </File> 70692 <File 70685 70693 RelativePath="..\storage\DatabaseSync.cpp" 70686 70694 > -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r109192 r109319 3314 3314 97205ABB1239292700B17380 /* PluginDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97205AB91239292700B17380 /* PluginDocument.cpp */; }; 3315 3315 97205ABC1239292700B17380 /* PluginDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 97205ABA1239292700B17380 /* PluginDocument.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3316 9724585214FB724800CA8746 /* DatabaseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9724585014FB724800CA8746 /* DatabaseContext.cpp */; }; 3317 9724585314FB724800CA8746 /* DatabaseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 9724585114FB724800CA8746 /* DatabaseContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3316 3318 9728C3131268E4390041E89B /* MarkupAccumulator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9728C3111268E4390041E89B /* MarkupAccumulator.cpp */; }; 3317 3319 9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */ = {isa = PBXBuildFile; fileRef = 9728C3121268E4390041E89B /* MarkupAccumulator.h */; }; … … 10181 10183 97205AB91239292700B17380 /* PluginDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginDocument.cpp; sourceTree = "<group>"; }; 10182 10184 97205ABA1239292700B17380 /* PluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginDocument.h; sourceTree = "<group>"; }; 10185 9724585014FB724800CA8746 /* DatabaseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseContext.cpp; sourceTree = "<group>"; }; 10186 9724585114FB724800CA8746 /* DatabaseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseContext.h; sourceTree = "<group>"; }; 10183 10187 9728C3111268E4390041E89B /* MarkupAccumulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkupAccumulator.cpp; sourceTree = "<group>"; }; 10184 10188 9728C3121268E4390041E89B /* MarkupAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkupAccumulator.h; sourceTree = "<group>"; }; … … 13895 13899 B5D36019112F8B560048DEA8 /* DatabaseCallback.h */, 13896 13900 B59DD68D1190298E007E9684 /* DatabaseCallback.idl */, 13901 9724585014FB724800CA8746 /* DatabaseContext.cpp */, 13902 9724585114FB724800CA8746 /* DatabaseContext.h */, 13897 13903 5116D9750CF177BD00C2B84D /* DatabaseDetails.h */, 13898 13904 B523CF031182675400EBB29C /* DatabaseSync.cpp */, … … 20665 20671 BC60D6E80D28D83400B9918F /* DOMCoreException.h */, 20666 20672 BC60D6EB0D28D99900B9918F /* DOMCoreException.idl */, 20667 BC9A6142146859D9006057FD /* EventNames.in */,20668 20673 BC9A6141146859D9006057FD /* DOMExceptions.in */, 20669 20674 A8185F3609765765005826D9 /* DOMImplementation.cpp */, … … 20714 20719 939885C108B7E3D100E707C4 /* EventNames.cpp */, 20715 20720 939885C208B7E3D100E707C4 /* EventNames.h */, 20721 BC9A6142146859D9006057FD /* EventNames.in */, 20716 20722 8F6756191288B17B0047ACA3 /* EventQueue.h */, 20717 20723 CE5CB1B314EDAB6F00BB2795 /* EventSender.h */, … … 21551 21557 51A45B560CAD7FD7000D2BE9 /* DatabaseAuthorizer.h in Headers */, 21552 21558 B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */, 21559 9724585314FB724800CA8746 /* DatabaseContext.h in Headers */, 21553 21560 5116D9770CF177BD00C2B84D /* DatabaseDetails.h in Headers */, 21554 21561 B523CF0B1182675400EBB29C /* DatabaseSync.h in Headers */, … … 23853 23860 BC2272BD0E82EAAE00E7F975 /* StyleRareNonInheritedData.h in Headers */, 23854 23861 BC2272870E82E70700E7F975 /* StyleReflection.h in Headers */, 23862 E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */, 23855 23863 3138A9E51474434600B0ED12 /* StyleShader.h in Headers */, 23856 23864 A8EA800C0A19516E00A8EF5F /* StyleSheet.h in Headers */, … … 24357 24365 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, 24358 24366 FD537353137B651800008DCE /* ZeroPole.h in Headers */, 24359 E4BBED4D14FCDBA1003F0B98 /* StyleRule.h in Headers */,24360 24367 ); 24361 24368 runOnlyForDeploymentPostprocessing = 0; … … 24965 24972 5196116A0CAC56570010A80C /* Database.cpp in Sources */, 24966 24973 51A45B570CAD7FD7000D2BE9 /* DatabaseAuthorizer.cpp in Sources */, 24974 9724585214FB724800CA8746 /* DatabaseContext.cpp in Sources */, 24967 24975 B523CF0A1182675400EBB29C /* DatabaseSync.cpp in Sources */, 24968 24976 519611EB0CAC749C0010A80C /* DatabaseTask.cpp in Sources */, … … 26918 26926 BC2272E30E82EE9B00E7F975 /* StyleRareInheritedData.cpp in Sources */, 26919 26927 BC2272BC0E82EAAE00E7F975 /* StyleRareNonInheritedData.cpp in Sources */, 26928 E4BBED4C14FCDBA1003F0B98 /* StyleRule.cpp in Sources */, 26920 26929 A8EA800D0A19516E00A8EF5F /* StyleSheet.cpp in Sources */, 26921 26930 A8EA800B0A19516E00A8EF5F /* StyleSheetList.cpp in Sources */, … … 27310 27319 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, 27311 27320 FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, 27312 E4BBED4C14FCDBA1003F0B98 /* StyleRule.cpp in Sources */,27313 27321 ); 27314 27322 runOnlyForDeploymentPostprocessing = 0; -
trunk/Source/WebCore/dom/ScriptExecutionContext.cpp
r107239 r109319 31 31 #include "ContentSecurityPolicy.h" 32 32 #include "DOMTimer.h" 33 #include "Database.h"34 #include "DatabaseTask.h"35 #include "DatabaseThread.h"36 33 #include "ErrorEvent.h" 37 34 #include "EventListener.h" … … 95 92 , m_inDispatchErrorEvent(false) 96 93 , m_activeDOMObjectsAreSuspended(false) 97 #if ENABLE(SQL_DATABASE)98 , m_hasOpenDatabases(false)99 #endif100 94 { 101 95 } … … 116 110 (*iter)->contextDestroyed(); 117 111 } 118 #if ENABLE(SQL_DATABASE)119 if (m_databaseThread) {120 ASSERT(m_databaseThread->terminationRequested());121 m_databaseThread = 0;122 }123 #endif124 112 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 125 113 if (m_fileThread) { … … 133 121 #endif 134 122 } 135 136 #if ENABLE(SQL_DATABASE)137 138 DatabaseThread* ScriptExecutionContext::databaseThread()139 {140 if (!m_databaseThread && !m_hasOpenDatabases) {141 // Create the database thread on first request - but not if at least one database was already opened,142 // because in that case we already had a database thread and terminated it and should not create another.143 m_databaseThread = DatabaseThread::create();144 if (!m_databaseThread->start())145 m_databaseThread = 0;146 }147 148 return m_databaseThread.get();149 }150 151 void ScriptExecutionContext::stopDatabases(DatabaseTaskSynchronizer* cleanupSync)152 {153 ASSERT(isContextThread());154 if (m_databaseThread)155 m_databaseThread->requestTermination(cleanupSync);156 else if (cleanupSync)157 cleanupSync->taskCompleted();158 }159 160 #endif161 123 162 124 void ScriptExecutionContext::processMessagePortMessagesSoon() -
trunk/Source/WebCore/dom/ScriptExecutionContext.h
r107239 r109319 33 33 #include "ScriptCallStack.h" 34 34 #include "SecurityContext.h" 35 #include "Supplementable.h" 35 36 #include <wtf/Forward.h> 36 37 #include <wtf/HashMap.h> … … 57 58 class PublicURLManager; 58 59 #endif 59 #if ENABLE(SQL_DATABASE)60 class Database;61 class DatabaseTaskSynchronizer;62 class DatabaseThread;63 #endif64 60 65 61 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) … … 67 63 #endif 68 64 69 class ScriptExecutionContext : public SecurityContext {65 class ScriptExecutionContext : public SecurityContext, public Supplementable<ScriptExecutionContext> { 70 66 public: 71 67 ScriptExecutionContext(); … … 78 74 virtual bool allowDatabaseAccess() const = 0; 79 75 virtual void databaseExceededQuota(const String& name) = 0; 80 DatabaseThread* databaseThread();81 void setHasOpenDatabases() { m_hasOpenDatabases = true; }82 bool hasOpenDatabases() const { return m_hasOpenDatabases; }83 // When the database cleanup is done, cleanupSync will be signalled.84 void stopDatabases(DatabaseTaskSynchronizer*);85 76 #endif 86 77 virtual bool isContextThread() const { return true; } … … 225 216 ActiveDOMObject::ReasonForSuspension m_reasonForSuspendingActiveDOMObjects; 226 217 227 #if ENABLE(SQL_DATABASE)228 RefPtr<DatabaseThread> m_databaseThread;229 bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed.230 #endif231 232 218 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) 233 219 RefPtr<FileThread> m_fileThread; -
trunk/Source/WebCore/history/PageCache.cpp
r107607 r109319 32 32 #include "CachedPage.h" 33 33 #include "DOMWindow.h" 34 #include "DatabaseContext.h" 34 35 #include "DeviceMotionController.h" 35 36 #include "DeviceOrientationController.h" … … 121 122 } 122 123 #if ENABLE(SQL_DATABASE) 123 if ( frame->document()->hasOpenDatabases()) {124 if (DatabaseContext::hasOpenDatabases(frame->document())) { 124 125 PCLOG(" -Frame has open database handles"); 125 126 cannotCache = true; … … 264 265 && (!frame->domWindow() || !frame->domWindow()->hasEventListeners(eventNames().unloadEvent)) 265 266 #if ENABLE(SQL_DATABASE) 266 && ! document->hasOpenDatabases()267 && !DatabaseContext::hasOpenDatabases(document) 267 268 #endif 268 269 #if ENABLE(SHARED_WORKERS) -
trunk/Source/WebCore/loader/FrameLoader.cpp
r108465 r109319 47 47 #include "Console.h" 48 48 #include "ContentSecurityPolicy.h" 49 #include "DatabaseContext.h" 49 50 #include "DOMImplementation.h" 50 51 #include "DOMWindow.h" … … 419 420 420 421 #if ENABLE(SQL_DATABASE) 421 doc->stopDatabases(0); 422 // FIXME: Should the DatabaseContext watch for something like ActiveDOMObject::stop() rather than being special-cased here? 423 DatabaseContext::stopDatabases(doc, 0); 422 424 #endif 423 425 } -
trunk/Source/WebCore/platform/Supplementable.h
r108958 r109319 30 30 #include <wtf/PassOwnPtr.h> 31 31 #include <wtf/text/AtomicString.h> 32 #include <wtf/text/AtomicStringHash.h> 32 33 33 34 namespace WebCore { … … 58 59 { 59 60 ASSERT(!m_supplements.get(key.impl())); 60 m_supplements.set(key .impl(), supplement);61 m_supplements.set(key, supplement); 61 62 } 62 63 63 64 Supplement<T>* requireSupplement(const AtomicString& key) 64 65 { 65 return m_supplements.get(key .impl());66 return m_supplements.get(key); 66 67 } 67 68 68 69 private: 69 typedef HashMap<AtomicString Impl*, OwnPtr<Supplement<T> > > SupplementMap;70 typedef HashMap<AtomicString, OwnPtr<Supplement<T> > > SupplementMap; 70 71 SupplementMap m_supplements; 71 72 }; -
trunk/Source/WebCore/storage/AbstractDatabase.cpp
r104803 r109319 33 33 34 34 #include "DatabaseAuthorizer.h" 35 #include "DatabaseContext.h" 35 36 #include "DatabaseTracker.h" 36 37 #include "ExceptionCode.h" … … 189 190 const String& displayName, unsigned long estimatedSize, DatabaseType databaseType) 190 191 : m_scriptExecutionContext(context) 192 , m_databaseContext(DatabaseContext::from(context)) 191 193 , m_name(name.isolatedCopy()) 192 194 , m_expectedVersion(expectedVersion.isolatedCopy()) -
trunk/Source/WebCore/storage/AbstractDatabase.h
r101492 r109319 43 43 44 44 class DatabaseAuthorizer; 45 class DatabaseContext; 45 46 class ScriptExecutionContext; 46 47 class SecurityOrigin; … … 87 88 virtual void closeImmediately() = 0; 88 89 90 DatabaseContext* databaseContext() const { return m_databaseContext; } 91 89 92 protected: 90 93 friend class ChangeVersionWrapper; … … 125 128 static const char* databaseInfoTableName(); 126 129 130 RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin; 127 131 RefPtr<ScriptExecutionContext> m_scriptExecutionContext; 128 RefPtr<SecurityOrigin> m_contextThreadSecurityOrigin;132 DatabaseContext* m_databaseContext; // Owned by m_scriptExecutionContext. 129 133 130 134 String m_name; -
trunk/Source/WebCore/storage/Database.cpp
r108015 r109319 35 35 #include "CrossThreadTask.h" 36 36 #include "DatabaseCallback.h" 37 #include "DatabaseContext.h" 37 38 #include "DatabaseTask.h" 38 39 #include "DatabaseThread.h" … … 110 111 DatabaseTracker::tracker().setDatabaseDetails(context->securityOrigin(), name, displayName, estimatedSize); 111 112 112 context->setHasOpenDatabases();113 DatabaseContext::from(context)->setHasOpenDatabases(); 113 114 114 115 InspectorInstrumentation::didOpenDatabase(context, database, context->securityOrigin()->host(), name, expectedVersion); … … 131 132 132 133 ScriptController::initializeThreading(); 133 ASSERT( m_scriptExecutionContext->databaseThread());134 ASSERT(databaseContext()->databaseThread()); 134 135 } 135 136 … … 180 181 { 181 182 DatabaseTaskSynchronizer synchronizer; 182 if (! m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer))183 if (!databaseContext()->databaseThread() || databaseContext()->databaseThread()->terminationRequested(&synchronizer)) 183 184 return false; 184 185 185 186 bool success = false; 186 187 OwnPtr<DatabaseOpenTask> task = DatabaseOpenTask::create(this, setVersionInNewDatabase, &synchronizer, e, errorMessage, success); 187 m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());188 databaseContext()->databaseThread()->scheduleImmediateTask(task.release()); 188 189 synchronizer.waitForTaskCompletion(); 189 190 … … 193 194 void Database::markAsDeletedAndClose() 194 195 { 195 if (m_deleted || ! m_scriptExecutionContext->databaseThread())196 if (m_deleted || !databaseContext()->databaseThread()) 196 197 return; 197 198 … … 200 201 201 202 DatabaseTaskSynchronizer synchronizer; 202 if ( m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer)) {203 if (databaseContext()->databaseThread()->terminationRequested(&synchronizer)) { 203 204 LOG(StorageAPI, "Database handle %p is on a terminated DatabaseThread, cannot be marked for normal closure\n", this); 204 205 return; … … 206 207 207 208 OwnPtr<DatabaseCloseTask> task = DatabaseCloseTask::create(this, &synchronizer); 208 m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());209 databaseContext()->databaseThread()->scheduleImmediateTask(task.release()); 209 210 synchronizer.waitForTaskCompletion(); 210 211 } … … 212 213 void Database::close() 213 214 { 214 ASSERT( m_scriptExecutionContext->databaseThread());215 ASSERT(currentThread() == m_scriptExecutionContext->databaseThread()->getThreadID());215 ASSERT(databaseContext()->databaseThread()); 216 ASSERT(currentThread() == databaseContext()->databaseThread()->getThreadID()); 216 217 217 218 { … … 226 227 // Must ref() before calling databaseThread()->recordDatabaseClosed(). 227 228 RefPtr<Database> protect = this; 228 m_scriptExecutionContext->databaseThread()->recordDatabaseClosed(this);229 m_scriptExecutionContext->databaseThread()->unscheduleDatabaseTasks(this);229 databaseContext()->databaseThread()->recordDatabaseClosed(this); 230 databaseContext()->databaseThread()->unscheduleDatabaseTasks(this); 230 231 DatabaseTracker::tracker().removeOpenDatabase(this); 231 232 } … … 234 235 { 235 236 ASSERT(m_scriptExecutionContext->isContextThread()); 236 DatabaseThread* databaseThread = scriptExecutionContext()->databaseThread();237 DatabaseThread* databaseThread = databaseContext()->databaseThread(); 237 238 if (databaseThread && !databaseThread->terminationRequested() && opened()) { 238 239 logErrorMessage("forcibly closing database"); … … 249 250 { 250 251 if (AbstractDatabase::performOpenAndVerify(setVersionInNewDatabase, e, errorMessage)) { 251 if ( m_scriptExecutionContext->databaseThread())252 m_scriptExecutionContext->databaseThread()->recordDatabaseOpen(this);252 if (databaseContext()->databaseThread()) 253 databaseContext()->databaseThread()->recordDatabaseOpen(this); 253 254 254 255 return true; … … 312 313 transaction = m_transactionQueue.takeFirst(); 313 314 314 if (transaction && m_scriptExecutionContext->databaseThread()) {315 if (transaction && databaseContext()->databaseThread()) { 315 316 OwnPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); 316 317 LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for transaction %p\n", task.get(), task->transaction()); 317 318 m_transactionInProgress = true; 318 m_scriptExecutionContext->databaseThread()->scheduleTask(task.release());319 databaseContext()->databaseThread()->scheduleTask(task.release()); 319 320 } else 320 321 m_transactionInProgress = false; … … 323 324 void Database::scheduleTransactionStep(SQLTransaction* transaction, bool immediately) 324 325 { 325 if (! m_scriptExecutionContext->databaseThread())326 if (!databaseContext()->databaseThread()) 326 327 return; 327 328 … … 329 330 LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); 330 331 if (immediately) 331 m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());332 databaseContext()->databaseThread()->scheduleImmediateTask(task.release()); 332 333 else 333 m_scriptExecutionContext->databaseThread()->scheduleTask(task.release());334 databaseContext()->databaseThread()->scheduleTask(task.release()); 334 335 } 335 336 … … 391 392 SQLTransactionClient* Database::transactionClient() const 392 393 { 393 return m_scriptExecutionContext->databaseThread()->transactionClient();394 return databaseContext()->databaseThread()->transactionClient(); 394 395 } 395 396 396 397 SQLTransactionCoordinator* Database::transactionCoordinator() const 397 398 { 398 return m_scriptExecutionContext->databaseThread()->transactionCoordinator();399 return databaseContext()->databaseThread()->transactionCoordinator(); 399 400 } 400 401 … … 405 406 Vector<String> result; 406 407 DatabaseTaskSynchronizer synchronizer; 407 if (! m_scriptExecutionContext->databaseThread() || m_scriptExecutionContext->databaseThread()->terminationRequested(&synchronizer))408 if (!databaseContext()->databaseThread() || databaseContext()->databaseThread()->terminationRequested(&synchronizer)) 408 409 return result; 409 410 410 411 OwnPtr<DatabaseTableNamesTask> task = DatabaseTableNamesTask::create(this, &synchronizer, result); 411 m_scriptExecutionContext->databaseThread()->scheduleImmediateTask(task.release());412 databaseContext()->databaseThread()->scheduleImmediateTask(task.release()); 412 413 synchronizer.waitForTaskCompletion(); 413 414 … … 419 420 if (m_scriptExecutionContext->isContextThread()) 420 421 return m_contextThreadSecurityOrigin.get(); 421 if (currentThread() == m_scriptExecutionContext->databaseThread()->getThreadID())422 if (currentThread() == databaseContext()->databaseThread()->getThreadID()) 422 423 return m_databaseThreadSecurityOrigin.get(); 423 424 return 0; -
trunk/Source/WebCore/storage/SQLTransaction.cpp
r105657 r109319 34 34 #include "Database.h" 35 35 #include "DatabaseAuthorizer.h" 36 #include "DatabaseContext.h" 36 37 #include "DatabaseThread.h" 37 38 #include "ExceptionCode.h" … … 164 165 165 166 // The next steps should be executed only if we're on the DB thread. 166 if (currentThread() != database()-> scriptExecutionContext()->databaseThread()->getThreadID())167 if (currentThread() != database()->databaseContext()->databaseThread()->getThreadID()) 167 168 return; 168 169 … … 216 217 void SQLTransaction::notifyDatabaseThreadIsShuttingDown() 217 218 { 218 ASSERT(currentThread() == database()-> scriptExecutionContext()->databaseThread()->getThreadID());219 ASSERT(currentThread() == database()->databaseContext()->databaseThread()->getThreadID()); 219 220 220 221 // If the transaction is in progress, we should roll it back here, since this is our last -
trunk/Source/WebCore/workers/WorkerThread.cpp
r108119 r109319 31 31 #include "WorkerThread.h" 32 32 33 #include "DatabaseContext.h" 33 34 #include "DedicatedWorkerContext.h" 34 35 #include "InspectorInstrumentation.h" … … 216 217 217 218 #if ENABLE(SQL_DATABASE) 219 // FIXME: Should we stop the databases as part of stopActiveDOMObjects() below? 218 220 DatabaseTaskSynchronizer cleanupSync; 219 workerContext->stopDatabases(&cleanupSync);221 DatabaseContext::stopDatabases(workerContext, &cleanupSync); 220 222 #endif 221 223 -
trunk/Source/WebKit/mac/ChangeLog
r109255 r109319 1 2012-02-29 Adam Barth <abarth@webkit.org> 2 3 ScriptExecutionContext has too many ifdef ENABLE(SQL_DATABASE) 4 https://bugs.webkit.org/show_bug.cgi?id=79633 5 6 Reviewed by Eric Seidel. 7 8 * WebView/WebFrame.mm: 9 (-[WebFrame _cacheabilityDictionary]): 10 1 11 2012-02-29 Tim Horton <timothy_horton@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r109254 r109319 61 61 #import <WebCore/ColorMac.h> 62 62 #import <WebCore/DOMImplementation.h> 63 #import <WebCore/DatabaseContext.h> 63 64 #import <WebCore/DocumentFragment.h> 64 65 #import <WebCore/DocumentLoader.h> … … 1121 1122 if (Document* document = _private->coreFrame->document()) { 1122 1123 #if ENABLE(SQL_DATABASE) 1123 if ( document->hasOpenDatabases())1124 if (DatabaseContext::hasOpenDatabases(document)) 1124 1125 [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases]; 1125 1126 #endif
Note: See TracChangeset
for help on using the changeset viewer.