17 #include <glog/logging.h> 41 IDBOpenDBRequest::~IDBOpenDBRequest() {}
51 status = connection->BeginTransaction(&transaction);
58 const int64_t new_version = version_.
value_or(is_new ? 1 : version);
61 if (new_version < version)
64 std::vector<std::string> store_names;
72 new IDBDatabase(connection, name_, new_version, store_names);
74 if (version != new_version) {
76 status = transaction.
CreateDb(name_, new_version);
84 idb_connection->VersionChangeTransaction(idb_trans);
89 this->transaction = idb_trans;
91 version, new_version);
97 idb_trans->DoCommit(&transaction);
99 if (idb_trans->aborted || idb_connection->is_closed()) {
100 if (!idb_connection->is_closed())
101 idb_connection->Close();
105 idb_connection->VersionChangeTransaction(
nullptr);
112 LOG(FATAL) <<
"Not reached";
120 NotImplemented(
"onblocked");
ExceptionOr< bool > DispatchEventInternal(RefPtr< Event > event, bool *did_listeners_throw)
DatabaseStatus ListObjectStores(const std::string &db_name, std::vector< std::string > *names)
void PerformOperation(SqliteTransaction *transaction) override
IDBOpenDBRequest(const std::string &name, optional< int64_t > version)
DatabaseStatus GetDbVersion(const std::string &db_name, int64_t *version)
Listener on_upgrade_needed
void CompleteError(JsError error)
DatabaseStatus CreateDb(const std::string &db_name, int64_t version)
IDBRequestReadyState ready_state
void CompleteSuccess(Any result)
T value_or(U &&default_value) const &
DatabaseStatus UpdateDbVersion(const std::string &db_name, int64_t version)
static JsError DOMException(ExceptionCode code)
Member< IDBTransaction > transaction
void DoOperation(const std::string &db_path)
void AddListenerField(EventType type, Listener *on_field)
IDBOpenDBRequestFactory()