Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1113)

Side by Side Diff: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp

Issue 2614663008: Migrate WTF::Vector::append() to ::push_back() [part 13 of N] (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 IDBKey* indexKey = ScriptValue::to<IDBKey*>( 319 IDBKey* indexKey = ScriptValue::to<IDBKey*>(
320 isolate, objectValue, exceptionState, indexMetadata.keyPath); 320 isolate, objectValue, exceptionState, indexMetadata.keyPath);
321 321
322 if (!indexKey) 322 if (!indexKey)
323 return; 323 return;
324 324
325 if (!indexMetadata.multiEntry || indexKey->getType() != IDBKey::ArrayType) { 325 if (!indexMetadata.multiEntry || indexKey->getType() != IDBKey::ArrayType) {
326 if (!indexKey->isValid()) 326 if (!indexKey->isValid())
327 return; 327 return;
328 328
329 indexKeys->append(indexKey); 329 indexKeys->push_back(indexKey);
330 } else { 330 } else {
331 DCHECK(indexMetadata.multiEntry); 331 DCHECK(indexMetadata.multiEntry);
332 DCHECK_EQ(indexKey->getType(), IDBKey::ArrayType); 332 DCHECK_EQ(indexKey->getType(), IDBKey::ArrayType);
333 indexKey = IDBKey::createMultiEntryArray(indexKey->array()); 333 indexKey = IDBKey::createMultiEntryArray(indexKey->array());
334 334
335 for (size_t i = 0; i < indexKey->array().size(); ++i) 335 for (size_t i = 0; i < indexKey->array().size(); ++i)
336 indexKeys->append(indexKey->array()[i]); 336 indexKeys->push_back(indexKey->array()[i]);
337 } 337 }
338 } 338 }
339 339
340 IDBRequest* IDBObjectStore::add(ScriptState* scriptState, 340 IDBRequest* IDBObjectStore::add(ScriptState* scriptState,
341 const ScriptValue& value, 341 const ScriptValue& value,
342 const ScriptValue& key, 342 const ScriptValue& key,
343 ExceptionState& exceptionState) { 343 ExceptionState& exceptionState) {
344 IDB_TRACE("IDBObjectStore::add"); 344 IDB_TRACE("IDBObjectStore::add");
345 return put(scriptState, WebIDBPutModeAddOnly, IDBAny::create(this), value, 345 return put(scriptState, WebIDBPutModeAddOnly, IDBAny::create(this), value,
346 key, exceptionState); 346 key, exceptionState);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 } 495 }
496 496
497 Vector<int64_t> indexIds; 497 Vector<int64_t> indexIds;
498 HeapVector<IndexKeys> indexKeys; 498 HeapVector<IndexKeys> indexKeys;
499 for (const auto& it : metadata().indexes) { 499 for (const auto& it : metadata().indexes) {
500 if (clone.isEmpty()) 500 if (clone.isEmpty())
501 clone = 501 clone =
502 deserializeScriptValue(scriptState, serializedValue.get(), &blobInfo); 502 deserializeScriptValue(scriptState, serializedValue.get(), &blobInfo);
503 IndexKeys keys; 503 IndexKeys keys;
504 generateIndexKeysForValue(scriptState->isolate(), *it.value, clone, &keys); 504 generateIndexKeysForValue(scriptState->isolate(), *it.value, clone, &keys);
505 indexIds.append(it.key); 505 indexIds.push_back(it.key);
506 indexKeys.append(keys); 506 indexKeys.push_back(keys);
507 } 507 }
508 508
509 IDBRequest* request = 509 IDBRequest* request =
510 IDBRequest::create(scriptState, source, m_transaction.get()); 510 IDBRequest::create(scriptState, source, m_transaction.get());
511 Vector<char> wireBytes; 511 Vector<char> wireBytes;
512 serializedValue->toWireBytes(wireBytes); 512 serializedValue->toWireBytes(wireBytes);
513 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes); 513 RefPtr<SharedBuffer> valueBuffer = SharedBuffer::adoptVector(wireBytes);
514 514
515 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo, 515 backendDB()->put(m_transaction->id(), id(), WebData(valueBuffer), blobInfo,
516 key, static_cast<WebIDBPutMode>(putMode), 516 key, static_cast<WebIDBPutMode>(putMode),
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 return; 658 return;
659 659
660 ScriptState::Scope scope(m_scriptState.get()); 660 ScriptState::Scope scope(m_scriptState.get());
661 661
662 IDBAny* cursorAny = request->resultAsAny(); 662 IDBAny* cursorAny = request->resultAsAny();
663 IDBCursorWithValue* cursor = nullptr; 663 IDBCursorWithValue* cursor = nullptr;
664 if (cursorAny->getType() == IDBAny::IDBCursorWithValueType) 664 if (cursorAny->getType() == IDBAny::IDBCursorWithValueType)
665 cursor = cursorAny->idbCursorWithValue(); 665 cursor = cursorAny->idbCursorWithValue();
666 666
667 Vector<int64_t> indexIds; 667 Vector<int64_t> indexIds;
668 indexIds.append(indexMetadata().id); 668 indexIds.push_back(indexMetadata().id);
669 if (cursor && !cursor->isDeleted()) { 669 if (cursor && !cursor->isDeleted()) {
670 cursor->continueFunction(nullptr, nullptr, ASSERT_NO_EXCEPTION); 670 cursor->continueFunction(nullptr, nullptr, ASSERT_NO_EXCEPTION);
671 671
672 IDBKey* primaryKey = cursor->idbPrimaryKey(); 672 IDBKey* primaryKey = cursor->idbPrimaryKey();
673 ScriptValue value = cursor->value(m_scriptState.get()); 673 ScriptValue value = cursor->value(m_scriptState.get());
674 674
675 IndexKeys indexKeys; 675 IndexKeys indexKeys;
676 generateIndexKeysForValue(m_scriptState->isolate(), indexMetadata(), 676 generateIndexKeysForValue(m_scriptState->isolate(), indexMetadata(),
677 value, &indexKeys); 677 value, &indexKeys);
678 678
679 HeapVector<IndexKeys> indexKeysList; 679 HeapVector<IndexKeys> indexKeysList;
680 indexKeysList.append(indexKeys); 680 indexKeysList.push_back(indexKeys);
681 681
682 m_database->backend()->setIndexKeys(m_transactionId, m_objectStoreId, 682 m_database->backend()->setIndexKeys(m_transactionId, m_objectStoreId,
683 primaryKey, indexIds, indexKeysList); 683 primaryKey, indexIds, indexKeysList);
684 } else { 684 } else {
685 // Now that we are done indexing, tell the backend to go 685 // Now that we are done indexing, tell the backend to go
686 // back to processing tasks of type NormalTask. 686 // back to processing tasks of type NormalTask.
687 m_database->backend()->setIndexesReady(m_transactionId, m_objectStoreId, 687 m_database->backend()->setIndexesReady(m_transactionId, m_objectStoreId,
688 indexIds); 688 indexIds);
689 m_database.clear(); 689 m_database.clear();
690 } 690 }
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 } 1092 }
1093 } 1093 }
1094 return IDBIndexMetadata::InvalidId; 1094 return IDBIndexMetadata::InvalidId;
1095 } 1095 }
1096 1096
1097 WebIDBDatabase* IDBObjectStore::backendDB() const { 1097 WebIDBDatabase* IDBObjectStore::backendDB() const {
1098 return m_transaction->backendDB(); 1098 return m_transaction->backendDB();
1099 } 1099 }
1100 1100
1101 } // namespace blink 1101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698