Chromium Code Reviews| Index: Source/modules/webdatabase/DatabaseContext.cpp |
| diff --git a/Source/modules/webdatabase/DatabaseContext.cpp b/Source/modules/webdatabase/DatabaseContext.cpp |
| index 5ff09d800b9396717989dfd74c75865ea4cf1a84..a9828bc84b95f4576ccf98e5b70b6a7a4e2f30bc 100644 |
| --- a/Source/modules/webdatabase/DatabaseContext.cpp |
| +++ b/Source/modules/webdatabase/DatabaseContext.cpp |
| @@ -105,6 +105,8 @@ DatabaseContext::DatabaseContext(ExecutionContext* context) |
| // For debug accounting only. We must do this before we register the |
| // instance. The assertions assume this. |
| DatabaseManager::manager().didConstructDatabaseContext(); |
| + if (context->isWorkerGlobalScope()) |
| + toWorkerGlobalScope(context)->registerTerminationObserver(this); |
| } |
| DatabaseContext::~DatabaseContext() |
| @@ -129,11 +131,13 @@ void DatabaseContext::contextDestroyed() |
| { |
| RefPtrWillBeRawPtr<DatabaseContext> protector(this); |
| stopDatabases(); |
| + if (executionContext()->isWorkerGlobalScope()) |
|
sof
2014/04/23 09:04:26
Clarifying question: is this access of the WorkerG
tkent
2014/04/23 09:13:35
Yes, it's safe.
|
| + toWorkerGlobalScope(executionContext())->unregisterTerminationObserver(this); |
| DatabaseManager::manager().unregisterDatabaseContext(this); |
| ActiveDOMObject::contextDestroyed(); |
| } |
| -void DatabaseContext::willStop() |
| +void DatabaseContext::wasRequestedToTerminate() |
| { |
| DatabaseManager::manager().interruptAllDatabasesForContext(this); |
| } |