| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "modules/indexeddb/IDBAny.h" | 38 #include "modules/indexeddb/IDBAny.h" |
| 39 #include "modules/indexeddb/IDBCursorWithValue.h" | 39 #include "modules/indexeddb/IDBCursorWithValue.h" |
| 40 #include "modules/indexeddb/IDBDatabase.h" | 40 #include "modules/indexeddb/IDBDatabase.h" |
| 41 #include "modules/indexeddb/IDBKeyPath.h" | 41 #include "modules/indexeddb/IDBKeyPath.h" |
| 42 #include "modules/indexeddb/IDBTracing.h" | 42 #include "modules/indexeddb/IDBTracing.h" |
| 43 #include "platform/Histogram.h" | 43 #include "platform/Histogram.h" |
| 44 #include "platform/SharedBuffer.h" | 44 #include "platform/SharedBuffer.h" |
| 45 #include "platform/bindings/ScriptState.h" | 45 #include "platform/bindings/ScriptState.h" |
| 46 #include "platform/wtf/PtrUtil.h" |
| 46 #include "public/platform/WebBlobInfo.h" | 47 #include "public/platform/WebBlobInfo.h" |
| 47 #include "public/platform/WebData.h" | 48 #include "public/platform/WebData.h" |
| 48 #include "public/platform/WebVector.h" | 49 #include "public/platform/WebVector.h" |
| 49 #include "public/platform/modules/indexeddb/WebIDBKey.h" | 50 #include "public/platform/modules/indexeddb/WebIDBKey.h" |
| 50 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" | 51 #include "public/platform/modules/indexeddb/WebIDBKeyRange.h" |
| 51 #include "v8/include/v8.h" | 52 #include "v8/include/v8.h" |
| 52 | 53 |
| 53 using blink::WebBlobInfo; | 54 using blink::WebBlobInfo; |
| 54 using blink::WebIDBCallbacks; | 55 using blink::WebIDBCallbacks; |
| 55 using blink::WebIDBCursor; | 56 using blink::WebIDBCursor; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 DOMStringList* index_names = DOMStringList::Create(); | 121 DOMStringList* index_names = DOMStringList::Create(); |
| 121 for (const auto& it : Metadata().indexes) | 122 for (const auto& it : Metadata().indexes) |
| 122 index_names->Append(it.value->name); | 123 index_names->Append(it.value->name); |
| 123 index_names->Sort(); | 124 index_names->Sort(); |
| 124 return index_names; | 125 return index_names; |
| 125 } | 126 } |
| 126 | 127 |
| 127 IDBRequest* IDBObjectStore::get(ScriptState* script_state, | 128 IDBRequest* IDBObjectStore::get(ScriptState* script_state, |
| 128 const ScriptValue& key, | 129 const ScriptValue& key, |
| 129 ExceptionState& exception_state) { | 130 ExceptionState& exception_state) { |
| 130 IDB_TRACE("IDBObjectStore::get"); | 131 IDB_TRACE("IDBObjectStore::getCall"); |
| 132 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 133 nullptr, "IDBObjectStore::get", this); |
| 131 if (IsDeleted()) { | 134 if (IsDeleted()) { |
| 132 exception_state.ThrowDOMException( | 135 exception_state.ThrowDOMException( |
| 133 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 136 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 134 return nullptr; | 137 return nullptr; |
| 135 } | 138 } |
| 136 if (!transaction_->IsActive()) { | 139 if (!transaction_->IsActive()) { |
| 137 exception_state.ThrowDOMException(kTransactionInactiveError, | 140 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 138 transaction_->InactiveErrorMessage()); | 141 transaction_->InactiveErrorMessage()); |
| 139 return nullptr; | 142 return nullptr; |
| 140 } | 143 } |
| 141 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 144 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 142 ExecutionContext::From(script_state), key, exception_state); | 145 ExecutionContext::From(script_state), key, exception_state); |
| 143 if (exception_state.HadException()) | 146 if (exception_state.HadException()) |
| 144 return nullptr; | 147 return nullptr; |
| 145 if (!key_range) { | 148 if (!key_range) { |
| 146 exception_state.ThrowDOMException( | 149 exception_state.ThrowDOMException( |
| 147 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 150 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
| 148 return nullptr; | 151 return nullptr; |
| 149 } | 152 } |
| 150 if (!BackendDB()) { | 153 if (!BackendDB()) { |
| 151 exception_state.ThrowDOMException(kInvalidStateError, | 154 exception_state.ThrowDOMException(kInvalidStateError, |
| 152 IDBDatabase::kDatabaseClosedErrorMessage); | 155 IDBDatabase::kDatabaseClosedErrorMessage); |
| 153 return nullptr; | 156 return nullptr; |
| 154 } | 157 } |
| 155 | 158 |
| 156 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 159 IDBRequest* request = |
| 157 transaction_.Get()); | 160 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 161 std::move(metrics)); |
| 158 BackendDB()->Get(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, | 162 BackendDB()->Get(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, |
| 159 key_range, /*key_only=*/false, | 163 key_range, /*key_only=*/false, |
| 160 request->CreateWebCallbacks().release()); | 164 request->CreateWebCallbacks().release()); |
| 161 return request; | 165 return request; |
| 162 } | 166 } |
| 163 | 167 |
| 164 IDBRequest* IDBObjectStore::getKey(ScriptState* script_state, | 168 IDBRequest* IDBObjectStore::getKey(ScriptState* script_state, |
| 165 const ScriptValue& key, | 169 const ScriptValue& key, |
| 166 ExceptionState& exception_state) { | 170 ExceptionState& exception_state) { |
| 167 IDB_TRACE("IDBObjectStore::getKey"); | 171 IDB_TRACE("IDBObjectStore::getKeyCall"); |
| 172 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 173 nullptr, "IDBObjectStore::getKey", this); |
| 168 if (IsDeleted()) { | 174 if (IsDeleted()) { |
| 169 exception_state.ThrowDOMException( | 175 exception_state.ThrowDOMException( |
| 170 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 176 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 171 return nullptr; | 177 return nullptr; |
| 172 } | 178 } |
| 173 if (!transaction_->IsActive()) { | 179 if (!transaction_->IsActive()) { |
| 174 exception_state.ThrowDOMException(kTransactionInactiveError, | 180 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 175 transaction_->InactiveErrorMessage()); | 181 transaction_->InactiveErrorMessage()); |
| 176 return nullptr; | 182 return nullptr; |
| 177 } | 183 } |
| 178 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 184 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 179 ExecutionContext::From(script_state), key, exception_state); | 185 ExecutionContext::From(script_state), key, exception_state); |
| 180 if (exception_state.HadException()) | 186 if (exception_state.HadException()) |
| 181 return nullptr; | 187 return nullptr; |
| 182 if (!key_range) { | 188 if (!key_range) { |
| 183 exception_state.ThrowDOMException( | 189 exception_state.ThrowDOMException( |
| 184 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 190 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
| 185 return nullptr; | 191 return nullptr; |
| 186 } | 192 } |
| 187 if (!BackendDB()) { | 193 if (!BackendDB()) { |
| 188 exception_state.ThrowDOMException(kInvalidStateError, | 194 exception_state.ThrowDOMException(kInvalidStateError, |
| 189 IDBDatabase::kDatabaseClosedErrorMessage); | 195 IDBDatabase::kDatabaseClosedErrorMessage); |
| 190 return nullptr; | 196 return nullptr; |
| 191 } | 197 } |
| 192 | 198 |
| 193 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 199 IDBRequest* request = |
| 194 transaction_.Get()); | 200 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 201 std::move(metrics)); |
| 195 BackendDB()->Get(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, | 202 BackendDB()->Get(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, |
| 196 key_range, /*key_only=*/true, | 203 key_range, /*key_only=*/true, |
| 197 request->CreateWebCallbacks().release()); | 204 request->CreateWebCallbacks().release()); |
| 198 return request; | 205 return request; |
| 199 } | 206 } |
| 200 | 207 |
| 201 IDBRequest* IDBObjectStore::getAll(ScriptState* script_state, | 208 IDBRequest* IDBObjectStore::getAll(ScriptState* script_state, |
| 202 const ScriptValue& key_range, | 209 const ScriptValue& key_range, |
| 203 ExceptionState& exception_state) { | 210 ExceptionState& exception_state) { |
| 204 return getAll(script_state, key_range, std::numeric_limits<uint32_t>::max(), | 211 return getAll(script_state, key_range, std::numeric_limits<uint32_t>::max(), |
| 205 exception_state); | 212 exception_state); |
| 206 } | 213 } |
| 207 | 214 |
| 208 IDBRequest* IDBObjectStore::getAll(ScriptState* script_state, | 215 IDBRequest* IDBObjectStore::getAll(ScriptState* script_state, |
| 209 const ScriptValue& key_range, | 216 const ScriptValue& key_range, |
| 210 unsigned long max_count, | 217 unsigned long max_count, |
| 211 ExceptionState& exception_state) { | 218 ExceptionState& exception_state) { |
| 212 IDB_TRACE("IDBObjectStore::getAll"); | 219 IDB_TRACE("IDBObjectStore::getAllCall"); |
| 220 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 221 nullptr, "IDBObjectStore::getAll", this); |
| 213 if (!max_count) | 222 if (!max_count) |
| 214 max_count = std::numeric_limits<uint32_t>::max(); | 223 max_count = std::numeric_limits<uint32_t>::max(); |
| 215 | 224 |
| 216 if (IsDeleted()) { | 225 if (IsDeleted()) { |
| 217 exception_state.ThrowDOMException( | 226 exception_state.ThrowDOMException( |
| 218 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 227 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 219 return nullptr; | 228 return nullptr; |
| 220 } | 229 } |
| 221 if (!transaction_->IsActive()) { | 230 if (!transaction_->IsActive()) { |
| 222 exception_state.ThrowDOMException(kTransactionInactiveError, | 231 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 223 transaction_->InactiveErrorMessage()); | 232 transaction_->InactiveErrorMessage()); |
| 224 return nullptr; | 233 return nullptr; |
| 225 } | 234 } |
| 226 IDBKeyRange* range = IDBKeyRange::FromScriptValue( | 235 IDBKeyRange* range = IDBKeyRange::FromScriptValue( |
| 227 ExecutionContext::From(script_state), key_range, exception_state); | 236 ExecutionContext::From(script_state), key_range, exception_state); |
| 228 if (exception_state.HadException()) | 237 if (exception_state.HadException()) |
| 229 return nullptr; | 238 return nullptr; |
| 230 if (!BackendDB()) { | 239 if (!BackendDB()) { |
| 231 exception_state.ThrowDOMException(kInvalidStateError, | 240 exception_state.ThrowDOMException(kInvalidStateError, |
| 232 IDBDatabase::kDatabaseClosedErrorMessage); | 241 IDBDatabase::kDatabaseClosedErrorMessage); |
| 233 return nullptr; | 242 return nullptr; |
| 234 } | 243 } |
| 235 | 244 |
| 236 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 245 IDBRequest* request = |
| 237 transaction_.Get()); | 246 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 247 std::move(metrics)); |
| 238 BackendDB()->GetAll(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, | 248 BackendDB()->GetAll(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, |
| 239 range, max_count, false, | 249 range, max_count, false, |
| 240 request->CreateWebCallbacks().release()); | 250 request->CreateWebCallbacks().release()); |
| 241 return request; | 251 return request; |
| 242 } | 252 } |
| 243 | 253 |
| 244 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state, | 254 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state, |
| 245 const ScriptValue& key_range, | 255 const ScriptValue& key_range, |
| 246 ExceptionState& exception_state) { | 256 ExceptionState& exception_state) { |
| 247 return getAllKeys(script_state, key_range, | 257 return getAllKeys(script_state, key_range, |
| 248 std::numeric_limits<uint32_t>::max(), exception_state); | 258 std::numeric_limits<uint32_t>::max(), exception_state); |
| 249 } | 259 } |
| 250 | 260 |
| 251 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state, | 261 IDBRequest* IDBObjectStore::getAllKeys(ScriptState* script_state, |
| 252 const ScriptValue& key_range, | 262 const ScriptValue& key_range, |
| 253 unsigned long max_count, | 263 unsigned long max_count, |
| 254 ExceptionState& exception_state) { | 264 ExceptionState& exception_state) { |
| 255 IDB_TRACE("IDBObjectStore::getAll"); | 265 IDB_TRACE("IDBObjectStore::getAllKeysCall"); |
| 266 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 267 nullptr, "IDBObjectStore::getAllKeys", this); |
| 256 if (!max_count) | 268 if (!max_count) |
| 257 max_count = std::numeric_limits<uint32_t>::max(); | 269 max_count = std::numeric_limits<uint32_t>::max(); |
| 258 | 270 |
| 259 if (IsDeleted()) { | 271 if (IsDeleted()) { |
| 260 exception_state.ThrowDOMException( | 272 exception_state.ThrowDOMException( |
| 261 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 273 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 262 return nullptr; | 274 return nullptr; |
| 263 } | 275 } |
| 264 if (!transaction_->IsActive()) { | 276 if (!transaction_->IsActive()) { |
| 265 exception_state.ThrowDOMException(kTransactionInactiveError, | 277 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 266 transaction_->InactiveErrorMessage()); | 278 transaction_->InactiveErrorMessage()); |
| 267 return nullptr; | 279 return nullptr; |
| 268 } | 280 } |
| 269 IDBKeyRange* range = IDBKeyRange::FromScriptValue( | 281 IDBKeyRange* range = IDBKeyRange::FromScriptValue( |
| 270 ExecutionContext::From(script_state), key_range, exception_state); | 282 ExecutionContext::From(script_state), key_range, exception_state); |
| 271 if (exception_state.HadException()) | 283 if (exception_state.HadException()) |
| 272 return nullptr; | 284 return nullptr; |
| 273 if (!BackendDB()) { | 285 if (!BackendDB()) { |
| 274 exception_state.ThrowDOMException(kInvalidStateError, | 286 exception_state.ThrowDOMException(kInvalidStateError, |
| 275 IDBDatabase::kDatabaseClosedErrorMessage); | 287 IDBDatabase::kDatabaseClosedErrorMessage); |
| 276 return nullptr; | 288 return nullptr; |
| 277 } | 289 } |
| 278 | 290 |
| 279 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 291 IDBRequest* request = |
| 280 transaction_.Get()); | 292 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 293 std::move(metrics)); |
| 281 BackendDB()->GetAll(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, | 294 BackendDB()->GetAll(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, |
| 282 range, max_count, true, | 295 range, max_count, true, |
| 283 request->CreateWebCallbacks().release()); | 296 request->CreateWebCallbacks().release()); |
| 284 return request; | 297 return request; |
| 285 } | 298 } |
| 286 | 299 |
| 287 static void GenerateIndexKeysForValue(v8::Isolate* isolate, | 300 static void GenerateIndexKeysForValue(v8::Isolate* isolate, |
| 288 const IDBIndexMetadata& index_metadata, | 301 const IDBIndexMetadata& index_metadata, |
| 289 const ScriptValue& object_value, | 302 const ScriptValue& object_value, |
| 290 IndexKeys* index_keys) { | 303 IndexKeys* index_keys) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 316 for (const IDBKey* key : array) | 329 for (const IDBKey* key : array) |
| 317 key_type_histogram.Count(static_cast<int>(key->GetType())); | 330 key_type_histogram.Count(static_cast<int>(key->GetType())); |
| 318 index_keys->AppendVector(array); | 331 index_keys->AppendVector(array); |
| 319 } | 332 } |
| 320 } | 333 } |
| 321 | 334 |
| 322 IDBRequest* IDBObjectStore::add(ScriptState* script_state, | 335 IDBRequest* IDBObjectStore::add(ScriptState* script_state, |
| 323 const ScriptValue& value, | 336 const ScriptValue& value, |
| 324 const ScriptValue& key, | 337 const ScriptValue& key, |
| 325 ExceptionState& exception_state) { | 338 ExceptionState& exception_state) { |
| 326 IDB_TRACE("IDBObjectStore::add"); | 339 IDB_TRACE("IDBObjectStore::addCall"); |
| 327 return put(script_state, kWebIDBPutModeAddOnly, IDBAny::Create(this), value, | 340 return put(script_state, kWebIDBPutModeAddOnly, IDBAny::Create(this), value, |
| 328 key, exception_state); | 341 key, exception_state); |
| 329 } | 342 } |
| 330 | 343 |
| 331 IDBRequest* IDBObjectStore::put(ScriptState* script_state, | 344 IDBRequest* IDBObjectStore::put(ScriptState* script_state, |
| 332 const ScriptValue& value, | 345 const ScriptValue& value, |
| 333 const ScriptValue& key, | 346 const ScriptValue& key, |
| 334 ExceptionState& exception_state) { | 347 ExceptionState& exception_state) { |
| 335 IDB_TRACE("IDBObjectStore::put"); | 348 IDB_TRACE("IDBObjectStore::putCall"); |
| 336 return put(script_state, kWebIDBPutModeAddOrUpdate, IDBAny::Create(this), | 349 return put(script_state, kWebIDBPutModeAddOrUpdate, IDBAny::Create(this), |
| 337 value, key, exception_state); | 350 value, key, exception_state); |
| 338 } | 351 } |
| 339 | 352 |
| 340 IDBRequest* IDBObjectStore::put(ScriptState* script_state, | 353 IDBRequest* IDBObjectStore::put(ScriptState* script_state, |
| 341 WebIDBPutMode put_mode, | 354 WebIDBPutMode put_mode, |
| 342 IDBAny* source, | 355 IDBAny* source, |
| 343 const ScriptValue& value, | 356 const ScriptValue& value, |
| 344 const ScriptValue& key_value, | 357 const ScriptValue& key_value, |
| 345 ExceptionState& exception_state) { | 358 ExceptionState& exception_state) { |
| 346 IDBKey* key = key_value.IsUndefined() | 359 IDBKey* key = key_value.IsUndefined() |
| 347 ? nullptr | 360 ? nullptr |
| 348 : ScriptValue::To<IDBKey*>(script_state->GetIsolate(), | 361 : ScriptValue::To<IDBKey*>(script_state->GetIsolate(), |
| 349 key_value, exception_state); | 362 key_value, exception_state); |
| 350 if (exception_state.HadException()) | 363 if (exception_state.HadException()) |
| 351 return nullptr; | 364 return nullptr; |
| 352 return put(script_state, put_mode, source, value, key, exception_state); | 365 return put(script_state, put_mode, source, value, key, exception_state); |
| 353 } | 366 } |
| 354 | 367 |
| 355 IDBRequest* IDBObjectStore::put(ScriptState* script_state, | 368 IDBRequest* IDBObjectStore::put(ScriptState* script_state, |
| 356 WebIDBPutMode put_mode, | 369 WebIDBPutMode put_mode, |
| 357 IDBAny* source, | 370 IDBAny* source, |
| 358 const ScriptValue& value, | 371 const ScriptValue& value, |
| 359 IDBKey* key, | 372 IDBKey* key, |
| 360 ExceptionState& exception_state) { | 373 ExceptionState& exception_state) { |
| 374 const char* tracing_name = nullptr; |
| 375 switch (put_mode) { |
| 376 case kWebIDBPutModeAddOrUpdate: |
| 377 tracing_name = "IDBObjectStore::put"; |
| 378 break; |
| 379 case kWebIDBPutModeAddOnly: |
| 380 tracing_name = "IDBObjectStore::add"; |
| 381 break; |
| 382 case kWebIDBPutModeCursorUpdate: |
| 383 tracing_name = "IDBCursor::update"; |
| 384 break; |
| 385 } |
| 386 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 387 nullptr, tracing_name, this); |
| 361 if (IsDeleted()) { | 388 if (IsDeleted()) { |
| 362 exception_state.ThrowDOMException( | 389 exception_state.ThrowDOMException( |
| 363 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 390 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 364 return nullptr; | 391 return nullptr; |
| 365 } | 392 } |
| 366 if (!transaction_->IsActive()) { | 393 if (!transaction_->IsActive()) { |
| 367 exception_state.ThrowDOMException(kTransactionInactiveError, | 394 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 368 transaction_->InactiveErrorMessage()); | 395 transaction_->InactiveErrorMessage()); |
| 369 return nullptr; | 396 return nullptr; |
| 370 } | 397 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 clone = DeserializeScriptValue(script_state, serialized_value.Get(), | 525 clone = DeserializeScriptValue(script_state, serialized_value.Get(), |
| 499 &blob_info); | 526 &blob_info); |
| 500 } | 527 } |
| 501 IndexKeys keys; | 528 IndexKeys keys; |
| 502 GenerateIndexKeysForValue(script_state->GetIsolate(), *it.value, clone, | 529 GenerateIndexKeysForValue(script_state->GetIsolate(), *it.value, clone, |
| 503 &keys); | 530 &keys); |
| 504 index_ids.push_back(it.key); | 531 index_ids.push_back(it.key); |
| 505 index_keys.push_back(keys); | 532 index_keys.push_back(keys); |
| 506 } | 533 } |
| 507 | 534 |
| 508 IDBRequest* request = | 535 IDBRequest* request = IDBRequest::Create( |
| 509 IDBRequest::Create(script_state, source, transaction_.Get()); | 536 script_state, source, transaction_.Get(), std::move(metrics)); |
| 510 Vector<char> wire_bytes; | 537 Vector<char> wire_bytes; |
| 511 serialized_value->ToWireBytes(wire_bytes); | 538 serialized_value->ToWireBytes(wire_bytes); |
| 512 RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes); | 539 RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes); |
| 513 | 540 |
| 514 request->StorePutOperationBlobs(serialized_value->BlobDataHandles()); | 541 request->StorePutOperationBlobs(serialized_value->BlobDataHandles()); |
| 515 | 542 |
| 516 BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info, | 543 BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info, |
| 517 key, static_cast<WebIDBPutMode>(put_mode), | 544 key, static_cast<WebIDBPutMode>(put_mode), |
| 518 request->CreateWebCallbacks().release(), index_ids, | 545 request->CreateWebCallbacks().release(), index_ids, |
| 519 index_keys); | 546 index_keys); |
| 520 return request; | 547 return request; |
| 521 } | 548 } |
| 522 | 549 |
| 523 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, | 550 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, |
| 524 const ScriptValue& key, | 551 const ScriptValue& key, |
| 525 ExceptionState& exception_state) { | 552 ExceptionState& exception_state) { |
| 526 IDB_TRACE("IDBObjectStore::delete"); | 553 IDB_TRACE("IDBObjectStore::deleteCall"); |
| 554 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 555 nullptr, "IDBObjectStore::delete", this); |
| 527 if (IsDeleted()) { | 556 if (IsDeleted()) { |
| 528 exception_state.ThrowDOMException( | 557 exception_state.ThrowDOMException( |
| 529 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 558 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 530 return nullptr; | 559 return nullptr; |
| 531 } | 560 } |
| 532 if (!transaction_->IsActive()) { | 561 if (!transaction_->IsActive()) { |
| 533 exception_state.ThrowDOMException(kTransactionInactiveError, | 562 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 534 transaction_->InactiveErrorMessage()); | 563 transaction_->InactiveErrorMessage()); |
| 535 return nullptr; | 564 return nullptr; |
| 536 } | 565 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 548 exception_state.ThrowDOMException( | 577 exception_state.ThrowDOMException( |
| 549 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 578 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
| 550 return nullptr; | 579 return nullptr; |
| 551 } | 580 } |
| 552 if (!BackendDB()) { | 581 if (!BackendDB()) { |
| 553 exception_state.ThrowDOMException(kInvalidStateError, | 582 exception_state.ThrowDOMException(kInvalidStateError, |
| 554 IDBDatabase::kDatabaseClosedErrorMessage); | 583 IDBDatabase::kDatabaseClosedErrorMessage); |
| 555 return nullptr; | 584 return nullptr; |
| 556 } | 585 } |
| 557 | 586 |
| 558 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 587 IDBRequest* request = |
| 559 transaction_.Get()); | 588 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 589 std::move(metrics)); |
| 560 BackendDB()->DeleteRange(transaction_->Id(), Id(), key_range, | 590 BackendDB()->DeleteRange(transaction_->Id(), Id(), key_range, |
| 561 request->CreateWebCallbacks().release()); | 591 request->CreateWebCallbacks().release()); |
| 562 return request; | 592 return request; |
| 563 } | 593 } |
| 564 | 594 |
| 565 IDBRequest* IDBObjectStore::clear(ScriptState* script_state, | 595 IDBRequest* IDBObjectStore::clear(ScriptState* script_state, |
| 566 ExceptionState& exception_state) { | 596 ExceptionState& exception_state) { |
| 567 IDB_TRACE("IDBObjectStore::clear"); | 597 IDB_TRACE("IDBObjectStore::clearCall"); |
| 598 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 599 nullptr, "IDBObjectStore::clear", this); |
| 568 if (IsDeleted()) { | 600 if (IsDeleted()) { |
| 569 exception_state.ThrowDOMException( | 601 exception_state.ThrowDOMException( |
| 570 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 602 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 571 return nullptr; | 603 return nullptr; |
| 572 } | 604 } |
| 573 if (!transaction_->IsActive()) { | 605 if (!transaction_->IsActive()) { |
| 574 exception_state.ThrowDOMException(kTransactionInactiveError, | 606 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 575 transaction_->InactiveErrorMessage()); | 607 transaction_->InactiveErrorMessage()); |
| 576 return nullptr; | 608 return nullptr; |
| 577 } | 609 } |
| 578 if (transaction_->IsReadOnly()) { | 610 if (transaction_->IsReadOnly()) { |
| 579 exception_state.ThrowDOMException( | 611 exception_state.ThrowDOMException( |
| 580 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); | 612 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); |
| 581 return nullptr; | 613 return nullptr; |
| 582 } | 614 } |
| 583 if (!BackendDB()) { | 615 if (!BackendDB()) { |
| 584 exception_state.ThrowDOMException(kInvalidStateError, | 616 exception_state.ThrowDOMException(kInvalidStateError, |
| 585 IDBDatabase::kDatabaseClosedErrorMessage); | 617 IDBDatabase::kDatabaseClosedErrorMessage); |
| 586 return nullptr; | 618 return nullptr; |
| 587 } | 619 } |
| 588 | 620 |
| 589 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 621 IDBRequest* request = |
| 590 transaction_.Get()); | 622 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 623 std::move(metrics)); |
| 591 BackendDB()->Clear(transaction_->Id(), Id(), | 624 BackendDB()->Clear(transaction_->Id(), Id(), |
| 592 request->CreateWebCallbacks().release()); | 625 request->CreateWebCallbacks().release()); |
| 593 return request; | 626 return request; |
| 594 } | 627 } |
| 595 | 628 |
| 596 namespace { | 629 namespace { |
| 597 // This class creates the index keys for a given index by extracting | 630 // This class creates the index keys for a given index by extracting |
| 598 // them from the SerializedScriptValue, for all the existing values in | 631 // them from the SerializedScriptValue, for all the existing values in |
| 599 // the object store. It only needs to be kept alive by virtue of being | 632 // the object store. It only needs to be kept alive by virtue of being |
| 600 // a listener on an IDBRequest object, in the same way that JavaScript | 633 // a listener on an IDBRequest object, in the same way that JavaScript |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 const int64_t object_store_id_; | 721 const int64_t object_store_id_; |
| 689 RefPtr<const IDBIndexMetadata> index_metadata_; | 722 RefPtr<const IDBIndexMetadata> index_metadata_; |
| 690 }; | 723 }; |
| 691 } // namespace | 724 } // namespace |
| 692 | 725 |
| 693 IDBIndex* IDBObjectStore::createIndex(ScriptState* script_state, | 726 IDBIndex* IDBObjectStore::createIndex(ScriptState* script_state, |
| 694 const String& name, | 727 const String& name, |
| 695 const IDBKeyPath& key_path, | 728 const IDBKeyPath& key_path, |
| 696 const IDBIndexParameters& options, | 729 const IDBIndexParameters& options, |
| 697 ExceptionState& exception_state) { | 730 ExceptionState& exception_state) { |
| 698 IDB_TRACE("IDBObjectStore::createIndex"); | 731 IDB_TRACE("IDBObjectStore::createIndexCall"); |
| 732 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 733 nullptr, "IDBObjectStore::createIndex", this); |
| 699 if (!transaction_->IsVersionChange()) { | 734 if (!transaction_->IsVersionChange()) { |
| 700 exception_state.ThrowDOMException( | 735 exception_state.ThrowDOMException( |
| 701 kInvalidStateError, | 736 kInvalidStateError, |
| 702 IDBDatabase::kNotVersionChangeTransactionErrorMessage); | 737 IDBDatabase::kNotVersionChangeTransactionErrorMessage); |
| 703 return nullptr; | 738 return nullptr; |
| 704 } | 739 } |
| 705 if (IsDeleted()) { | 740 if (IsDeleted()) { |
| 706 exception_state.ThrowDOMException( | 741 exception_state.ThrowDOMException( |
| 707 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 742 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 708 return nullptr; | 743 return nullptr; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 IDBIndex* index = IDBIndex::Create(index_metadata, this, transaction_.Get()); | 781 IDBIndex* index = IDBIndex::Create(index_metadata, this, transaction_.Get()); |
| 747 index_map_.Set(name, index); | 782 index_map_.Set(name, index); |
| 748 metadata_->indexes.Set(index_id, index_metadata); | 783 metadata_->indexes.Set(index_id, index_metadata); |
| 749 | 784 |
| 750 DCHECK(!exception_state.HadException()); | 785 DCHECK(!exception_state.HadException()); |
| 751 if (exception_state.HadException()) | 786 if (exception_state.HadException()) |
| 752 return nullptr; | 787 return nullptr; |
| 753 | 788 |
| 754 IDBRequest* index_request = | 789 IDBRequest* index_request = |
| 755 openCursor(script_state, nullptr, kWebIDBCursorDirectionNext, | 790 openCursor(script_state, nullptr, kWebIDBCursorDirectionNext, |
| 756 kWebIDBTaskTypePreemptive); | 791 kWebIDBTaskTypePreemptive, std::move(metrics)); |
| 757 index_request->PreventPropagation(); | 792 index_request->PreventPropagation(); |
| 758 | 793 |
| 759 // This is kept alive by being the success handler of the request, which is in | 794 // This is kept alive by being the success handler of the request, which is in |
| 760 // turn kept alive by the owning transaction. | 795 // turn kept alive by the owning transaction. |
| 761 IndexPopulator* index_populator = IndexPopulator::Create( | 796 IndexPopulator* index_populator = IndexPopulator::Create( |
| 762 script_state, transaction()->db(), transaction_->Id(), Id(), | 797 script_state, transaction()->db(), transaction_->Id(), Id(), |
| 763 std::move(index_metadata)); | 798 std::move(index_metadata)); |
| 764 index_request->setOnsuccess(index_populator); | 799 index_request->setOnsuccess(index_populator); |
| 765 return index; | 800 return index; |
| 766 } | 801 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 transaction_->IndexDeleted(it->value); | 873 transaction_->IndexDeleted(it->value); |
| 839 it->value->MarkDeleted(); | 874 it->value->MarkDeleted(); |
| 840 index_map_.erase(name); | 875 index_map_.erase(name); |
| 841 } | 876 } |
| 842 } | 877 } |
| 843 | 878 |
| 844 IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state, | 879 IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state, |
| 845 const ScriptValue& range, | 880 const ScriptValue& range, |
| 846 const String& direction_string, | 881 const String& direction_string, |
| 847 ExceptionState& exception_state) { | 882 ExceptionState& exception_state) { |
| 848 IDB_TRACE("IDBObjectStore::openCursor"); | 883 IDB_TRACE("IDBObjectStore::openCursorCall"); |
| 884 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 885 nullptr, "IDBObjectStore::openCursor", this); |
| 849 if (IsDeleted()) { | 886 if (IsDeleted()) { |
| 850 exception_state.ThrowDOMException( | 887 exception_state.ThrowDOMException( |
| 851 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 888 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 852 return nullptr; | 889 return nullptr; |
| 853 } | 890 } |
| 854 if (!transaction_->IsActive()) { | 891 if (!transaction_->IsActive()) { |
| 855 exception_state.ThrowDOMException(kTransactionInactiveError, | 892 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 856 transaction_->InactiveErrorMessage()); | 893 transaction_->InactiveErrorMessage()); |
| 857 return nullptr; | 894 return nullptr; |
| 858 } | 895 } |
| 859 | 896 |
| 860 WebIDBCursorDirection direction = | 897 WebIDBCursorDirection direction = |
| 861 IDBCursor::StringToDirection(direction_string); | 898 IDBCursor::StringToDirection(direction_string); |
| 862 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 899 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 863 ExecutionContext::From(script_state), range, exception_state); | 900 ExecutionContext::From(script_state), range, exception_state); |
| 864 if (exception_state.HadException()) | 901 if (exception_state.HadException()) |
| 865 return nullptr; | 902 return nullptr; |
| 866 | 903 |
| 867 if (!BackendDB()) { | 904 if (!BackendDB()) { |
| 868 exception_state.ThrowDOMException(kInvalidStateError, | 905 exception_state.ThrowDOMException(kInvalidStateError, |
| 869 IDBDatabase::kDatabaseClosedErrorMessage); | 906 IDBDatabase::kDatabaseClosedErrorMessage); |
| 870 return nullptr; | 907 return nullptr; |
| 871 } | 908 } |
| 872 | 909 |
| 873 return openCursor(script_state, key_range, direction, kWebIDBTaskTypeNormal); | 910 return openCursor(script_state, key_range, direction, kWebIDBTaskTypeNormal, |
| 911 std::move(metrics)); |
| 874 } | 912 } |
| 875 | 913 |
| 876 IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state, | 914 IDBRequest* IDBObjectStore::openCursor( |
| 877 IDBKeyRange* range, | 915 ScriptState* script_state, |
| 878 WebIDBCursorDirection direction, | 916 IDBKeyRange* range, |
| 879 WebIDBTaskType task_type) { | 917 WebIDBCursorDirection direction, |
| 880 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 918 WebIDBTaskType task_type, |
| 881 transaction_.Get()); | 919 std::unique_ptr<IDBRequest::ScopedMetricsTracker> metrics) { |
| 920 IDBRequest* request = |
| 921 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 922 std::move(metrics)); |
| 882 request->SetCursorDetails(IndexedDB::kCursorKeyAndValue, direction); | 923 request->SetCursorDetails(IndexedDB::kCursorKeyAndValue, direction); |
| 883 | 924 |
| 884 BackendDB()->OpenCursor(transaction_->Id(), Id(), | 925 BackendDB()->OpenCursor(transaction_->Id(), Id(), |
| 885 IDBIndexMetadata::kInvalidId, range, direction, false, | 926 IDBIndexMetadata::kInvalidId, range, direction, false, |
| 886 task_type, request->CreateWebCallbacks().release()); | 927 task_type, request->CreateWebCallbacks().release()); |
| 887 return request; | 928 return request; |
| 888 } | 929 } |
| 889 | 930 |
| 890 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* script_state, | 931 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* script_state, |
| 891 const ScriptValue& range, | 932 const ScriptValue& range, |
| 892 const String& direction_string, | 933 const String& direction_string, |
| 893 ExceptionState& exception_state) { | 934 ExceptionState& exception_state) { |
| 894 IDB_TRACE("IDBObjectStore::openKeyCursor"); | 935 IDB_TRACE("IDBObjectStore::openKeyCursorCall"); |
| 936 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 937 nullptr, "IDBObjectStore::openKeyCursor", this); |
| 895 if (IsDeleted()) { | 938 if (IsDeleted()) { |
| 896 exception_state.ThrowDOMException( | 939 exception_state.ThrowDOMException( |
| 897 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 940 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 898 return nullptr; | 941 return nullptr; |
| 899 } | 942 } |
| 900 if (!transaction_->IsActive()) { | 943 if (!transaction_->IsActive()) { |
| 901 exception_state.ThrowDOMException(kTransactionInactiveError, | 944 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 902 transaction_->InactiveErrorMessage()); | 945 transaction_->InactiveErrorMessage()); |
| 903 return nullptr; | 946 return nullptr; |
| 904 } | 947 } |
| 905 | 948 |
| 906 WebIDBCursorDirection direction = | 949 WebIDBCursorDirection direction = |
| 907 IDBCursor::StringToDirection(direction_string); | 950 IDBCursor::StringToDirection(direction_string); |
| 908 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 951 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 909 ExecutionContext::From(script_state), range, exception_state); | 952 ExecutionContext::From(script_state), range, exception_state); |
| 910 if (exception_state.HadException()) | 953 if (exception_state.HadException()) |
| 911 return nullptr; | 954 return nullptr; |
| 912 | 955 |
| 913 if (!BackendDB()) { | 956 if (!BackendDB()) { |
| 914 exception_state.ThrowDOMException(kInvalidStateError, | 957 exception_state.ThrowDOMException(kInvalidStateError, |
| 915 IDBDatabase::kDatabaseClosedErrorMessage); | 958 IDBDatabase::kDatabaseClosedErrorMessage); |
| 916 return nullptr; | 959 return nullptr; |
| 917 } | 960 } |
| 918 | 961 |
| 919 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 962 IDBRequest* request = |
| 920 transaction_.Get()); | 963 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 964 std::move(metrics)); |
| 921 request->SetCursorDetails(IndexedDB::kCursorKeyOnly, direction); | 965 request->SetCursorDetails(IndexedDB::kCursorKeyOnly, direction); |
| 922 | 966 |
| 923 BackendDB()->OpenCursor(transaction_->Id(), Id(), | 967 BackendDB()->OpenCursor(transaction_->Id(), Id(), |
| 924 IDBIndexMetadata::kInvalidId, key_range, direction, | 968 IDBIndexMetadata::kInvalidId, key_range, direction, |
| 925 true, kWebIDBTaskTypeNormal, | 969 true, kWebIDBTaskTypeNormal, |
| 926 request->CreateWebCallbacks().release()); | 970 request->CreateWebCallbacks().release()); |
| 927 return request; | 971 return request; |
| 928 } | 972 } |
| 929 | 973 |
| 930 IDBRequest* IDBObjectStore::count(ScriptState* script_state, | 974 IDBRequest* IDBObjectStore::count(ScriptState* script_state, |
| 931 const ScriptValue& range, | 975 const ScriptValue& range, |
| 932 ExceptionState& exception_state) { | 976 ExceptionState& exception_state) { |
| 933 IDB_TRACE("IDBObjectStore::count"); | 977 IDB_TRACE("IDBObjectStore::countCall"); |
| 978 auto metrics = WTF::MakeUnique<IDBRequest::ScopedMetricsTracker>( |
| 979 nullptr, "IDBObjectStore::count", this); |
| 934 if (IsDeleted()) { | 980 if (IsDeleted()) { |
| 935 exception_state.ThrowDOMException( | 981 exception_state.ThrowDOMException( |
| 936 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 982 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 937 return nullptr; | 983 return nullptr; |
| 938 } | 984 } |
| 939 if (!transaction_->IsActive()) { | 985 if (!transaction_->IsActive()) { |
| 940 exception_state.ThrowDOMException(kTransactionInactiveError, | 986 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 941 transaction_->InactiveErrorMessage()); | 987 transaction_->InactiveErrorMessage()); |
| 942 return nullptr; | 988 return nullptr; |
| 943 } | 989 } |
| 944 | 990 |
| 945 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 991 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 946 ExecutionContext::From(script_state), range, exception_state); | 992 ExecutionContext::From(script_state), range, exception_state); |
| 947 if (exception_state.HadException()) | 993 if (exception_state.HadException()) |
| 948 return nullptr; | 994 return nullptr; |
| 949 | 995 |
| 950 if (!BackendDB()) { | 996 if (!BackendDB()) { |
| 951 exception_state.ThrowDOMException(kInvalidStateError, | 997 exception_state.ThrowDOMException(kInvalidStateError, |
| 952 IDBDatabase::kDatabaseClosedErrorMessage); | 998 IDBDatabase::kDatabaseClosedErrorMessage); |
| 953 return nullptr; | 999 return nullptr; |
| 954 } | 1000 } |
| 955 | 1001 |
| 956 IDBRequest* request = IDBRequest::Create(script_state, IDBAny::Create(this), | 1002 IDBRequest* request = |
| 957 transaction_.Get()); | 1003 IDBRequest::Create(script_state, IDBAny::Create(this), transaction_.Get(), |
| 1004 std::move(metrics)); |
| 958 BackendDB()->Count(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, | 1005 BackendDB()->Count(transaction_->Id(), Id(), IDBIndexMetadata::kInvalidId, |
| 959 key_range, request->CreateWebCallbacks().release()); | 1006 key_range, request->CreateWebCallbacks().release()); |
| 960 return request; | 1007 return request; |
| 961 } | 1008 } |
| 962 | 1009 |
| 963 void IDBObjectStore::MarkDeleted() { | 1010 void IDBObjectStore::MarkDeleted() { |
| 964 DCHECK(transaction_->IsVersionChange()) | 1011 DCHECK(transaction_->IsVersionChange()) |
| 965 << "An object store got deleted outside a versionchange transaction."; | 1012 << "An object store got deleted outside a versionchange transaction."; |
| 966 | 1013 |
| 967 deleted_ = true; | 1014 deleted_ = true; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 } | 1106 } |
| 1060 } | 1107 } |
| 1061 return IDBIndexMetadata::kInvalidId; | 1108 return IDBIndexMetadata::kInvalidId; |
| 1062 } | 1109 } |
| 1063 | 1110 |
| 1064 WebIDBDatabase* IDBObjectStore::BackendDB() const { | 1111 WebIDBDatabase* IDBObjectStore::BackendDB() const { |
| 1065 return transaction_->BackendDB(); | 1112 return transaction_->BackendDB(); |
| 1066 } | 1113 } |
| 1067 | 1114 |
| 1068 } // namespace blink | 1115 } // namespace blink |
| OLD | NEW |