Chromium Code Reviews| Index: Source/modules/indexeddb/IDBDatabase.cpp |
| diff --git a/Source/modules/indexeddb/IDBDatabase.cpp b/Source/modules/indexeddb/IDBDatabase.cpp |
| index 8106fdc1cfbc22979f067cc5a57ffcf8ec7d7dd2..2e7adb4fb7b236e7e8acf8e40fa4f91eba2e66eb 100644 |
| --- a/Source/modules/indexeddb/IDBDatabase.cpp |
| +++ b/Source/modules/indexeddb/IDBDatabase.cpp |
| @@ -331,8 +331,10 @@ void IDBDatabase::closeConnection() |
| ASSERT(m_closePending); |
| ASSERT(m_transactions.isEmpty()); |
| - m_backend->close(); |
| - m_backend.clear(); |
| + if (m_backend) { |
| + m_backend->close(); |
| + m_backend.clear(); |
| + } |
| if (m_contextStopped || !executionContext()) |
| return; |
| @@ -402,10 +404,16 @@ bool IDBDatabase::hasPendingActivity() const |
| void IDBDatabase::stop() |
| { |
| - // Stop fires at a deterministic time, so we need to call close in it. |
| - close(); |
| - |
| m_contextStopped = true; |
| + |
| + // Normally, connections are not closed until all transactions are |
| + // finished, which requires a round-trip to the back end. In a worker |
| + // context, no more messages will be received once the context is torn |
| + // down. So in the case of context stop, just close immediately. |
|
alecflett
2014/01/15 23:40:23
The comment could be generalized here - I think so
jsbell
2014/01/15 23:56:56
By "Normally" I meant "on explicit close() or GC",
|
| + if (m_backend) { |
| + m_backend->close(); |
| + m_backend.clear(); |
| + } |
| } |
| const AtomicString& IDBDatabase::interfaceName() const |