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

Side by Side Diff: content/browser/indexed_db/indexed_db_backing_store.cc

Issue 2760163002: [IndexedDB] Pool and evict leveldb iterators, to save memory (Closed)
Patch Set: comments & lifetime fix Created 3 years, 9 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 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/indexed_db/indexed_db_backing_store.h" 5 #include "content/browser/indexed_db/indexed_db_backing_store.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 using base::FilePath; 52 using base::FilePath;
53 using base::StringPiece; 53 using base::StringPiece;
54 using leveldb::Status; 54 using leveldb::Status;
55 using storage::FileWriterDelegate; 55 using storage::FileWriterDelegate;
56 using url::Origin; 56 using url::Origin;
57 57
58 namespace content { 58 namespace content {
59 59
60 namespace { 60 namespace {
61 static const size_t kDefaultMaxOpenIteratorsPerDatabase = 50;
pwnall 2017/03/24 09:16:02 How about explaining that we do this because every
dmurph 2017/03/24 23:33:39 Done.
61 62
62 enum IndexedDBBackingStoreErrorSource { 63 enum IndexedDBBackingStoreErrorSource {
63 // 0 - 2 are no longer used. 64 // 0 - 2 are no longer used.
64 FIND_KEY_IN_INDEX = 3, 65 FIND_KEY_IN_INDEX = 3,
65 GET_IDBDATABASE_METADATA, 66 GET_IDBDATABASE_METADATA,
66 GET_INDEXES, 67 GET_INDEXES,
67 GET_KEY_GENERATOR_CURRENT_NUMBER, 68 GET_KEY_GENERATOR_CURRENT_NUMBER,
68 GET_OBJECT_STORES, 69 GET_OBJECT_STORES,
69 GET_RECORD, 70 GET_RECORD,
70 KEY_EXISTS_IN_OBJECT_STORE, 71 KEY_EXISTS_IN_OBJECT_STORE,
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 1058
1058 } // namespace 1059 } // namespace
1059 1060
1060 class DefaultLevelDBFactory : public LevelDBFactory { 1061 class DefaultLevelDBFactory : public LevelDBFactory {
1061 public: 1062 public:
1062 DefaultLevelDBFactory() {} 1063 DefaultLevelDBFactory() {}
1063 Status OpenLevelDB(const FilePath& file_name, 1064 Status OpenLevelDB(const FilePath& file_name,
1064 const LevelDBComparator* comparator, 1065 const LevelDBComparator* comparator,
1065 std::unique_ptr<LevelDBDatabase>* db, 1066 std::unique_ptr<LevelDBDatabase>* db,
1066 bool* is_disk_full) override { 1067 bool* is_disk_full) override {
1067 return LevelDBDatabase::Open(file_name, comparator, db, is_disk_full); 1068 return LevelDBDatabase::Open(file_name, comparator, db,
1069 kDefaultMaxOpenIteratorsPerDatabase,
1070 is_disk_full);
1068 } 1071 }
1069 Status DestroyLevelDB(const FilePath& file_name) override { 1072 Status DestroyLevelDB(const FilePath& file_name) override {
1070 return LevelDBDatabase::Destroy(file_name); 1073 return LevelDBDatabase::Destroy(file_name);
1071 } 1074 }
1072 1075
1073 private: 1076 private:
1074 DISALLOW_COPY_AND_ASSIGN(DefaultLevelDBFactory); 1077 DISALLOW_COPY_AND_ASSIGN(DefaultLevelDBFactory);
1075 }; 1078 };
1076 1079
1077 IndexedDBBackingStore::IndexedDBBackingStore( 1080 IndexedDBBackingStore::IndexedDBBackingStore(
(...skipping 3376 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 4457
4455 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor( 4458 IndexedDBBackingStore::Transaction::WriteDescriptor::WriteDescriptor(
4456 const WriteDescriptor& other) = default; 4459 const WriteDescriptor& other) = default;
4457 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() = 4460 IndexedDBBackingStore::Transaction::WriteDescriptor::~WriteDescriptor() =
4458 default; 4461 default;
4459 IndexedDBBackingStore::Transaction::WriteDescriptor& 4462 IndexedDBBackingStore::Transaction::WriteDescriptor&
4460 IndexedDBBackingStore::Transaction::WriteDescriptor:: 4463 IndexedDBBackingStore::Transaction::WriteDescriptor::
4461 operator=(const WriteDescriptor& other) = default; 4464 operator=(const WriteDescriptor& other) = default;
4462 4465
4463 } // namespace content 4466 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698