Skip to content

Commit

Permalink
IndexedDB: Remove observer transactions from frontend
Browse files Browse the repository at this point in the history
These transactions are no longer supported in the backend and we've
planned to remove them from the frontend for some time.  This CL
updates OnChanges() to no longer create this type of transaction
and removes the corresponding codepaths from IDBTransaction.

Bug: 717812
Change-Id: I5bd807d11411ad18cab2737025647fc00230dae8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526802
Commit-Queue: Chase Phillips <[email protected]>
Reviewed-by: Daniel Murphy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#642199}
  • Loading branch information
chasephillips authored and Commit Bot committed Mar 19, 2019
1 parent 872a179 commit 1b0da98
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 47 deletions.
8 changes: 1 addition & 7 deletions third_party/blink/renderer/modules/indexeddb/idb_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ void IDBDatabase::OnChanges(
if (observer_lookup_result != observers_.end()) {
IDBObserver* observer = observer_lookup_result->value;

IDBTransaction* transaction = nullptr;
auto transactions_lookup_result = transactions.find(map_entry.first);
if (transactions_lookup_result != transactions.end()) {
const std::pair<int64_t, Vector<int64_t>>& obs_txn =
Expand All @@ -206,16 +205,11 @@ void IDBDatabase::OnChanges(
for (int64_t store_id : obs_txn.second) {
stores.insert(metadata_.object_stores.at(store_id)->name);
}

transaction = IDBTransaction::CreateObserver(
GetExecutionContext(), obs_txn.first, stores, this);
}

observer->Callback()->InvokeAndReportException(
observer, IDBObserverChanges::Create(this, transaction, observations,
observer, IDBObserverChanges::Create(this, nullptr, observations,
map_entry.second));
if (transaction)
transaction->SetActive(false);
}
}
}
Expand Down
30 changes: 0 additions & 30 deletions third_party/blink/renderer/modules/indexeddb/idb_transaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,6 @@

namespace blink {

IDBTransaction* IDBTransaction::CreateObserver(
ExecutionContext* execution_context,
int64_t id,
const HashSet<String>& scope,
IDBDatabase* db) {
DCHECK(!scope.IsEmpty()) << "Observer transactions must operate on a "
"well-defined set of stores";
IDBTransaction* transaction =
MakeGarbageCollected<IDBTransaction>(execution_context, id, scope, db);
return transaction;
}

IDBTransaction* IDBTransaction::CreateNonVersionChange(
ScriptState* script_state,
int64_t id,
Expand All @@ -81,24 +69,6 @@ IDBTransaction* IDBTransaction::CreateVersionChange(
open_db_request, old_metadata);
}

IDBTransaction::IDBTransaction(ExecutionContext* execution_context,
int64_t id,
const HashSet<String>& scope,
IDBDatabase* db)
: ContextLifecycleObserver(execution_context),
id_(id),
database_(db),
mode_(mojom::IDBTransactionMode::ReadOnly),
scope_(scope),
state_(kActive),
event_queue_(
EventQueue::Create(execution_context, TaskType::kDatabaseAccess)) {
DCHECK(database_);
DCHECK(!scope_.IsEmpty()) << "Observer transactions must operate "
"on a well-defined set of stores";
database_->TransactionCreated(this);
}

IDBTransaction::IDBTransaction(ScriptState* script_state,
int64_t id,
const HashSet<String>& scope,
Expand Down
10 changes: 0 additions & 10 deletions third_party/blink/renderer/modules/indexeddb/idb_transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ class MODULES_EXPORT IDBTransaction final
DEFINE_WRAPPERTYPEINFO();

public:
static IDBTransaction* CreateObserver(ExecutionContext*,
int64_t,
const HashSet<String>& scope,
IDBDatabase*);

static IDBTransaction* CreateNonVersionChange(ScriptState*,
int64_t,
const HashSet<String>& scope,
Expand All @@ -84,11 +79,6 @@ class MODULES_EXPORT IDBTransaction final
IDBOpenDBRequest*,
const IDBDatabaseMetadata& old_metadata);

// For observer transactions.
IDBTransaction(ExecutionContext*,
int64_t,
const HashSet<String>& scope,
IDBDatabase*);
// For non-upgrade transactions.
IDBTransaction(ScriptState*,
int64_t,
Expand Down

0 comments on commit 1b0da98

Please sign in to comment.