#include "content/browser/indexed_db/indexed_db_transaction.h"
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/trace_event/base_tracing.h"
#include "content/browser/indexed_db/indexed_db_backing_store.h"
#include "content/browser/indexed_db/indexed_db_bucket_context.h"
#include "content/browser/indexed_db/indexed_db_bucket_context_handle.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.h"
#include "content/browser/indexed_db/indexed_db_database_callbacks.h"
#include "content/browser/indexed_db/indexed_db_lock_request_data.h"
#include "storage/browser/blob/blob_storage_context.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom.h"
#include "third_party/leveldatabase/env_chromium.h"
namespace content {
namespace {
std::string WriteBlobToFileResultToString(
storage::mojom::WriteBlobToFileResult result) { … }
bool g_inactivity_timeout_enabled = …;
enum UmaIDBException { … };
UmaIDBException ExceptionCodeToUmaEnum(blink::mojom::IDBException code) { … }
}
IndexedDBTransaction::TaskQueue::TaskQueue() = default;
IndexedDBTransaction::TaskQueue::~TaskQueue() = default;
void IndexedDBTransaction::TaskQueue::clear() { … }
IndexedDBTransaction::Operation IndexedDBTransaction::TaskQueue::pop() { … }
IndexedDBTransaction::TaskStack::TaskStack() = default;
IndexedDBTransaction::TaskStack::~TaskStack() = default;
void IndexedDBTransaction::TaskStack::clear() { … }
IndexedDBTransaction::AbortOperation IndexedDBTransaction::TaskStack::pop() { … }
IndexedDBTransaction::IndexedDBTransaction(
int64_t id,
IndexedDBConnection* connection,
const std::set<int64_t>& object_store_ids,
blink::mojom::IDBTransactionMode mode,
IndexedDBBucketContextHandle bucket_context,
IndexedDBBackingStore::Transaction* backing_store_transaction)
: … { … }
IndexedDBTransaction::~IndexedDBTransaction() { … }
void IndexedDBTransaction::BindReceiver(
mojo::PendingAssociatedReceiver<blink::mojom::IDBTransaction>
mojo_receiver) { … }
void IndexedDBTransaction::SetCommitFlag() { … }
void IndexedDBTransaction::ScheduleTask(blink::mojom::IDBTaskType type,
Operation task) { … }
void IndexedDBTransaction::ScheduleAbortTask(AbortOperation abort_task) { … }
leveldb::Status IndexedDBTransaction::Abort(
const IndexedDBDatabaseError& error) { … }
leveldb::Status IndexedDBTransaction::CommitPhaseTwoProxy(
IndexedDBTransaction* transaction) { … }
bool IndexedDBTransaction::IsTaskQueueEmpty() const { … }
bool IndexedDBTransaction::HasPendingTasks() const { … }
void IndexedDBTransaction::RegisterOpenCursor(IndexedDBCursor* cursor) { … }
void IndexedDBTransaction::UnregisterOpenCursor(IndexedDBCursor* cursor) { … }
void IndexedDBTransaction::DontAllowInactiveClientToBlockOthers(
storage::mojom::DisallowInactiveClientReason reason) { … }
bool IndexedDBTransaction::IsTransactionBlockingOtherClients() const { … }
void IndexedDBTransaction::Start() { … }
void IndexedDBTransaction::DisableInactivityTimeoutForTesting() { … }
void IndexedDBTransaction::CreateObjectStore(
int64_t object_store_id,
const std::u16string& name,
const blink::IndexedDBKeyPath& key_path,
bool auto_increment) { … }
void IndexedDBTransaction::DeleteObjectStore(int64_t object_store_id) { … }
void IndexedDBTransaction::Put(
int64_t object_store_id,
blink::mojom::IDBValuePtr input_value,
const blink::IndexedDBKey& key,
blink::mojom::IDBPutMode mode,
const std::vector<blink::IndexedDBIndexKeys>& index_keys,
blink::mojom::IDBTransaction::PutCallback callback) { … }
void IndexedDBTransaction::Commit(int64_t num_errors_handled) { … }
void IndexedDBTransaction::OnQuotaCheckDone(bool allowed) { … }
uint64_t IndexedDBTransaction::CreateExternalObjects(
blink::mojom::IDBValuePtr& value,
std::vector<IndexedDBExternalObject>* external_objects) { … }
leveldb::Status IndexedDBTransaction::BlobWriteComplete(
BlobWriteResult result,
storage::mojom::WriteBlobToFileResult error) { … }
leveldb::Status IndexedDBTransaction::DoPendingCommit() { … }
leveldb::Status IndexedDBTransaction::CommitPhaseTwo() { … }
std::tuple<IndexedDBTransaction::RunTasksResult, leveldb::Status>
IndexedDBTransaction::RunTasks() { … }
storage::mojom::IdbTransactionMetadataPtr
IndexedDBTransaction::GetIdbInternalsMetadata() const { … }
void IndexedDBTransaction::NotifyOfIdbInternalsRelevantChange() { … }
void IndexedDBTransaction::TimeoutFired() { … }
void IndexedDBTransaction::ResetTimeoutTimer() { … }
void IndexedDBTransaction::SetState(State state) { … }
void IndexedDBTransaction::CloseOpenCursors() { … }
std::vector<PartitionedLockManager::PartitionedLockRequest>
IndexedDBTransaction::BuildLockRequests() const { … }
}