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

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

Issue 2635403002: IndexedDB: Replace O(n^2) algorithm computing multientry index keys (Closed)
Patch Set: add comment about hashtable 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
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBKey.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 return; 322 return;
323 323
324 if (!indexMetadata.multiEntry || indexKey->getType() != IDBKey::ArrayType) { 324 if (!indexMetadata.multiEntry || indexKey->getType() != IDBKey::ArrayType) {
325 if (!indexKey->isValid()) 325 if (!indexKey->isValid())
326 return; 326 return;
327 327
328 indexKeys->push_back(indexKey); 328 indexKeys->push_back(indexKey);
329 } else { 329 } else {
330 DCHECK(indexMetadata.multiEntry); 330 DCHECK(indexMetadata.multiEntry);
331 DCHECK_EQ(indexKey->getType(), IDBKey::ArrayType); 331 DCHECK_EQ(indexKey->getType(), IDBKey::ArrayType);
332 indexKey = IDBKey::createMultiEntryArray(indexKey->array()); 332 indexKeys->appendVector(indexKey->toMultiEntryArray());
333
334 for (size_t i = 0; i < indexKey->array().size(); ++i)
335 indexKeys->push_back(indexKey->array()[i]);
336 } 333 }
337 } 334 }
338 335
339 IDBRequest* IDBObjectStore::add(ScriptState* scriptState, 336 IDBRequest* IDBObjectStore::add(ScriptState* scriptState,
340 const ScriptValue& value, 337 const ScriptValue& value,
341 const ScriptValue& key, 338 const ScriptValue& key,
342 ExceptionState& exceptionState) { 339 ExceptionState& exceptionState) {
343 IDB_TRACE("IDBObjectStore::add"); 340 IDB_TRACE("IDBObjectStore::add");
344 return put(scriptState, WebIDBPutModeAddOnly, IDBAny::create(this), value, 341 return put(scriptState, WebIDBPutModeAddOnly, IDBAny::create(this), value,
345 key, exceptionState); 342 key, exceptionState);
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1088 }
1092 } 1089 }
1093 return IDBIndexMetadata::InvalidId; 1090 return IDBIndexMetadata::InvalidId;
1094 } 1091 }
1095 1092
1096 WebIDBDatabase* IDBObjectStore::backendDB() const { 1093 WebIDBDatabase* IDBObjectStore::backendDB() const {
1097 return m_transaction->backendDB(); 1094 return m_transaction->backendDB();
1098 } 1095 }
1099 1096
1100 } // namespace blink 1097 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBKey.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698