#include "content/browser/indexed_db/indexed_db_connection.h"
#include <set>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/sequence_checker.h"
#include "base/trace_event/base_tracing.h"
#include "components/services/storage/privileged/mojom/indexed_db_client_state_checker.mojom.h"
#include "content/browser/indexed_db/indexed_db_callback_helpers.h"
#include "content/browser/indexed_db/indexed_db_cursor.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
#include "content/browser/indexed_db/indexed_db_transaction.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom.h"
IndexedDBIndexKeys;
IndexedDBKey;
IndexedDBKeyPath;
IndexedDBKeyRange;
swap;
namespace blink {
class IndexedDBKeyRange;
}
namespace content {
namespace {
static int32_t g_next_indexed_db_connection_id;
const char kBadTransactionMode[] = …;
const char kTransactionAlreadyExists[] = …;
}
mojo::PendingAssociatedRemote<blink::mojom::IDBDatabase>
IndexedDBConnection::MakeSelfOwnedReceiverAndBindRemote(
std::unique_ptr<IndexedDBConnection> connection) { … }
IndexedDBConnection::IndexedDBConnection(
IndexedDBBucketContext& bucket_context,
base::WeakPtr<IndexedDBDatabase> database,
base::RepeatingClosure on_version_change_ignored,
base::OnceCallback<void(IndexedDBConnection*)> on_close,
std::unique_ptr<IndexedDBDatabaseCallbacks> callbacks,
mojo::Remote<storage::mojom::IndexedDBClientStateChecker>
client_state_checker,
base::UnguessableToken client_token)
: … { … }
IndexedDBConnection::~IndexedDBConnection() { … }
bool IndexedDBConnection::IsConnected() const { … }
IndexedDBTransaction* IndexedDBConnection::CreateVersionChangeTransaction(
int64_t id,
const std::set<int64_t>& scope,
IndexedDBBackingStore::Transaction* backing_store_transaction) { … }
void IndexedDBConnection::DisallowInactiveClient(
storage::mojom::DisallowInactiveClientReason reason,
base::OnceCallback<void(bool)> callback) { … }
void IndexedDBConnection::RemoveTransaction(int64_t id) { … }
void IndexedDBConnection::AbortTransactionAndTearDownOnError(
IndexedDBTransaction* transaction,
const IndexedDBDatabaseError& error) { … }
void IndexedDBConnection::CloseAndReportForceClose() { … }
void IndexedDBConnection::RenameObjectStore(int64_t transaction_id,
int64_t object_store_id,
const std::u16string& new_name) { … }
void IndexedDBConnection::CreateTransaction(
mojo::PendingAssociatedReceiver<blink::mojom::IDBTransaction>
transaction_receiver,
int64_t transaction_id,
const std::vector<int64_t>& object_store_ids,
blink::mojom::IDBTransactionMode mode,
blink::mojom::IDBTransactionDurability durability) { … }
void IndexedDBConnection::VersionChangeIgnored() { … }
void IndexedDBConnection::Get(int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const IndexedDBKeyRange& key_range,
bool key_only,
blink::mojom::IDBDatabase::GetCallback callback) { … }
void IndexedDBConnection::GetAll(
int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const IndexedDBKeyRange& key_range,
bool key_only,
int64_t max_count,
blink::mojom::IDBDatabase::GetAllCallback callback) { … }
void IndexedDBConnection::SetIndexKeys(
int64_t transaction_id,
int64_t object_store_id,
const IndexedDBKey& primary_key,
const std::vector<IndexedDBIndexKeys>& index_keys) { … }
void IndexedDBConnection::SetIndexesReady(
int64_t transaction_id,
int64_t object_store_id,
const std::vector<int64_t>& index_ids) { … }
void IndexedDBConnection::OpenCursor(
int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const IndexedDBKeyRange& key_range,
blink::mojom::IDBCursorDirection direction,
bool key_only,
blink::mojom::IDBTaskType task_type,
blink::mojom::IDBDatabase::OpenCursorCallback callback) { … }
void IndexedDBConnection::Count(int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const IndexedDBKeyRange& key_range,
CountCallback callback) { … }
void IndexedDBConnection::DeleteRange(int64_t transaction_id,
int64_t object_store_id,
const IndexedDBKeyRange& key_range,
DeleteRangeCallback success_callback) { … }
void IndexedDBConnection::GetKeyGeneratorCurrentNumber(
int64_t transaction_id,
int64_t object_store_id,
GetKeyGeneratorCurrentNumberCallback callback) { … }
void IndexedDBConnection::Clear(int64_t transaction_id,
int64_t object_store_id,
ClearCallback callback) { … }
void IndexedDBConnection::CreateIndex(int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const std::u16string& name,
const IndexedDBKeyPath& key_path,
bool unique,
bool multi_entry) { … }
void IndexedDBConnection::DeleteIndex(int64_t transaction_id,
int64_t object_store_id,
int64_t index_id) { … }
void IndexedDBConnection::RenameIndex(int64_t transaction_id,
int64_t object_store_id,
int64_t index_id,
const std::u16string& new_name) { … }
void IndexedDBConnection::Abort(int64_t transaction_id) { … }
void IndexedDBConnection::DidBecomeInactive() { … }
const storage::BucketInfo& IndexedDBConnection::GetBucketInfo() { … }
storage::BucketLocator IndexedDBConnection::GetBucketLocator() { … }
IndexedDBTransaction* IndexedDBConnection::GetTransaction(int64_t id) const { … }
std::unique_ptr<IndexedDBDatabaseCallbacks>
IndexedDBConnection::AbortTransactionsAndClose(
CloseErrorHandling error_handling) { … }
leveldb::Status IndexedDBConnection::AbortAllTransactionsAndIgnoreErrors(
const IndexedDBDatabaseError& error) { … }
leveldb::Status IndexedDBConnection::AbortAllTransactions(
const IndexedDBDatabaseError& error) { … }
}