| Index: content/browser/indexed_db/indexed_db_connection.cc | 
| diff --git a/content/browser/indexed_db/indexed_db_connection.cc b/content/browser/indexed_db/indexed_db_connection.cc | 
| index 0c3cb35c010e67a465f12fd891998bff8441df93..09a94837db8a580306425f8e34defd72e1c3aca7 100644 | 
| --- a/content/browser/indexed_db/indexed_db_connection.cc | 
| +++ b/content/browser/indexed_db/indexed_db_connection.cc | 
| @@ -5,6 +5,12 @@ | 
| #include "content/browser/indexed_db/indexed_db_connection.h" | 
|  | 
| #include "base/logging.h" | 
| +#include "base/stl_util.h" | 
| +#include "content/browser/indexed_db/indexed_db_class_factory.h" | 
| +#include "content/browser/indexed_db/indexed_db_database_callbacks.h" | 
| +#include "content/browser/indexed_db/indexed_db_observer.h" | 
| +#include "content/browser/indexed_db/indexed_db_tracing.h" | 
| +#include "content/browser/indexed_db/indexed_db_transaction.h" | 
|  | 
| namespace content { | 
|  | 
| @@ -15,9 +21,11 @@ static int32_t next_id; | 
| }  // namespace | 
|  | 
| IndexedDBConnection::IndexedDBConnection( | 
| +    int child_process_id, | 
| scoped_refptr<IndexedDBDatabase> database, | 
| scoped_refptr<IndexedDBDatabaseCallbacks> callbacks) | 
| : id_(next_id++), | 
| +      child_process_id_(child_process_id), | 
| database_(database), | 
| callbacks_(callbacks), | 
| weak_factory_(this) {} | 
| @@ -85,8 +93,69 @@ void IndexedDBConnection::RemoveObservers( | 
| else | 
| pending_observer_ids.push_back(id_to_remove); | 
| } | 
| -  if (!pending_observer_ids.empty()) | 
| -    database_->RemovePendingObservers(this, pending_observer_ids); | 
| +  if (pending_observer_ids.empty()) | 
| +    return; | 
| + | 
| +  for (const auto& it : transactions_) { | 
| +    it.second->RemovePendingObservers(pending_observer_ids); | 
| +  } | 
| +} | 
| + | 
| +IndexedDBTransaction* IndexedDBConnection::CreateTransaction( | 
| +    int64_t id, | 
| +    const std::set<int64_t>& scope, | 
| +    blink::WebIDBTransactionMode mode, | 
| +    IndexedDBBackingStore::Transaction* backing_store_transaction) { | 
| +  DCHECK_EQ(GetTransaction(id), nullptr) << "Duplicate transaction id." << id; | 
| +  std::unique_ptr<IndexedDBTransaction> transaction = | 
| +      IndexedDBClassFactory::Get()->CreateIndexedDBTransaction( | 
| +          id, this, scope, mode, backing_store_transaction); | 
| +  IndexedDBTransaction* transaction_ptr = transaction.get(); | 
| +  transactions_[id] = std::move(transaction); | 
| +  return transaction_ptr; | 
| +} | 
| + | 
| +void IndexedDBConnection::AbortTransaction(IndexedDBTransaction* transaction) { | 
| +  IDB_TRACE1("IndexedDBDatabase::Abort", "txn.id", transaction->id()); | 
| +  transaction->Abort(); | 
| +} | 
| + | 
| +void IndexedDBConnection::AbortTransaction( | 
| +    IndexedDBTransaction* transaction, | 
| +    const IndexedDBDatabaseError& error) { | 
| +  IDB_TRACE1("IndexedDBDatabase::Abort(error)", "txn.id", transaction->id()); | 
| +  transaction->Abort(error); | 
| +} | 
| + | 
| +void IndexedDBConnection::AbortAllTransactions( | 
| +    const IndexedDBDatabaseError& error) { | 
| +  std::unordered_map<int64_t, std::unique_ptr<IndexedDBTransaction>> temp_map; | 
| +  std::swap(temp_map, transactions_); | 
| +  for (const auto& pair : temp_map) { | 
| +    IDB_TRACE1("IndexedDBDatabase::Abort(error)", "txn.id", pair.second->id()); | 
| +    pair.second->Abort(error); | 
| +  } | 
| +} | 
| + | 
| +IndexedDBTransaction* IndexedDBConnection::GetTransaction(int64_t id) { | 
| +  auto it = transactions_.find(id); | 
| +  if (it == transactions_.end()) | 
| +    return nullptr; | 
| +  return it->second.get(); | 
| +} | 
| + | 
| +base::WeakPtr<IndexedDBTransaction> | 
| +IndexedDBConnection::AddTransactionForTesting( | 
| +    std::unique_ptr<IndexedDBTransaction> transaction) { | 
| +  DCHECK(!base::ContainsKey(transactions_, transaction->id())); | 
| +  base::WeakPtr<IndexedDBTransaction> transaction_ptr = | 
| +      transaction->ptr_factory_.GetWeakPtr(); | 
| +  transactions_[transaction->id()] = std::move(transaction); | 
| +  return transaction_ptr; | 
| +} | 
| + | 
| +void IndexedDBConnection::RemoveTransaction(int64_t id) { | 
| +  transactions_.erase(id); | 
| } | 
|  | 
| }  // namespace content | 
|  |