#include "third_party/blink/renderer/modules/indexeddb/idb_object_store.h"
#include <limits>
#include <memory>
#include <utility>
#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/numerics/safe_conversions.h"
#include "third_party/blink/public/mojom/indexeddb/indexeddb.mojom-blink.h"
#include "third_party/blink/public/platform/web_blob_info.h"
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_factory.h"
#include "third_party/blink/renderer/bindings/core/v8/to_v8_traits.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_union_idbcursor_idbindex_idbobjectstore.h"
#include "third_party/blink/renderer/core/dom/dom_string_list.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_any.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_database.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_key.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h"
#include "third_party/blink/renderer/modules/indexeddb/idb_value_wrapping.h"
#include "third_party/blink/renderer/modules/indexeddb/indexed_db_blink_mojom_traits.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "v8/include/v8.h"
namespace blink {
IDBObjectStore::IDBObjectStore(scoped_refptr<IDBObjectStoreMetadata> metadata,
IDBTransaction* transaction)
: … { … }
void IDBObjectStore::Trace(Visitor* visitor) const { … }
void IDBObjectStore::setName(const String& name,
ExceptionState& exception_state) { … }
ScriptValue IDBObjectStore::keyPath(ScriptState* script_state) const { … }
DOMStringList* IDBObjectStore::indexNames() const { … }
IDBRequest* IDBObjectStore::get(ScriptState* script_state,
const ScriptValue& key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::getKey(ScriptState* script_state,
const ScriptValue& key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::getAll(ScriptState* script_state,
const ScriptValue& key_range,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::getAll(ScriptState* script_state,
const ScriptValue& key_range,
uint32_t max_count,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state,
const ScriptValue& key_range,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state,
const ScriptValue& key_range,
uint32_t max_count,
ExceptionState& exception_state) { … }
static Vector<std::unique_ptr<IDBKey>> GenerateIndexKeysForValue(
v8::Isolate* isolate,
const IDBObjectStoreMetadata& store_metadata,
const IDBIndexMetadata& index_metadata,
const ScriptValue& object_value) { … }
IDBRequest* IDBObjectStore::add(ScriptState* script_state,
const ScriptValue& value,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::add(ScriptState* script_state,
const ScriptValue& value,
const ScriptValue& key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::put(ScriptState* script_state,
const ScriptValue& value,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::put(ScriptState* script_state,
const ScriptValue& value,
const ScriptValue& key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::DoPut(ScriptState* script_state,
mojom::IDBPutMode put_mode,
const ScriptValue& value,
const ScriptValue& key_value,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::DoPut(ScriptState* script_state,
mojom::IDBPutMode put_mode,
const IDBRequest::Source* source,
const ScriptValue& value,
const IDBKey* key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::Delete(ScriptState* script_state,
const ScriptValue& key,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::deleteFunction(
ScriptState* script_state,
IDBKeyRange* key_range,
IDBRequest::AsyncTraceState metrics) { … }
IDBRequest* IDBObjectStore::getKeyGeneratorCurrentNumber(
ScriptState* script_state,
IDBRequest::AsyncTraceState metrics) { … }
IDBRequest* IDBObjectStore::clear(ScriptState* script_state,
ExceptionState& exception_state) { … }
namespace {
class IndexPopulator final : public NativeEventListener { … };
}
IDBIndex* IDBObjectStore::createIndex(ScriptState* script_state,
const String& name,
const IDBKeyPath& key_path,
const IDBIndexParameters* options,
ExceptionState& exception_state) { … }
IDBIndex* IDBObjectStore::index(const String& name,
ExceptionState& exception_state) { … }
void IDBObjectStore::deleteIndex(const String& name,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state,
const ScriptValue& range,
const String& direction_string,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state,
IDBKeyRange* range,
mojom::IDBCursorDirection direction,
mojom::IDBTaskType task_type,
IDBRequest::AsyncTraceState metrics) { … }
IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* script_state,
const ScriptValue& range,
const String& direction_string,
ExceptionState& exception_state) { … }
IDBRequest* IDBObjectStore::count(ScriptState* script_state,
const ScriptValue& range,
ExceptionState& exception_state) { … }
void IDBObjectStore::MarkDeleted() { … }
void IDBObjectStore::ClearIndexCache() { … }
void IDBObjectStore::RevertMetadata(
scoped_refptr<IDBObjectStoreMetadata> old_metadata) { … }
void IDBObjectStore::RevertDeletedIndexMetadata(IDBIndex& deleted_index) { … }
void IDBObjectStore::RenameIndex(int64_t index_id, const String& new_name) { … }
int64_t IDBObjectStore::FindIndexId(const String& name) const { … }
IDBDatabase& IDBObjectStore::db() const { … }
}