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

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

Issue 2760163002: [IndexedDB] Pool and evict leveldb iterators, to save memory (Closed)
Patch Set: comments Created 3 years, 8 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 <cerrno> 5 #include <cerrno>
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 36
37 namespace content { 37 namespace content {
38 class IndexedDBFactory; 38 class IndexedDBFactory;
39 } 39 }
40 40
41 namespace { 41 namespace {
42 42
43 class BustedLevelDBDatabase : public LevelDBDatabase { 43 class BustedLevelDBDatabase : public LevelDBDatabase {
44 public: 44 public:
45 BustedLevelDBDatabase() {} 45 BustedLevelDBDatabase()
46 : LevelDBDatabase(LevelDBDatabase::kDefaultMaxOpenIteratorsPerDatabase) {}
46 static std::unique_ptr<LevelDBDatabase> Open( 47 static std::unique_ptr<LevelDBDatabase> Open(
47 const base::FilePath& file_name, 48 const base::FilePath& file_name,
48 const LevelDBComparator* /*comparator*/) { 49 const LevelDBComparator* /*comparator*/) {
49 return base::MakeUnique<BustedLevelDBDatabase>(); 50 return base::MakeUnique<BustedLevelDBDatabase>();
50 } 51 }
51 leveldb::Status Get(const base::StringPiece& key, 52 leveldb::Status Get(const base::StringPiece& key,
52 std::string* value, 53 std::string* value,
53 bool* found, 54 bool* found,
54 const LevelDBSnapshot* = 0) override { 55 const LevelDBSnapshot* = 0) override {
55 return leveldb::Status::IOError("It's busted!"); 56 return leveldb::Status::IOError("It's busted!");
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 leveldb_env::kNewLogger, 165 leveldb_env::kNewLogger,
165 base::File::FILE_ERROR_FAILED)); 166 base::File::FILE_ERROR_FAILED));
166 scoped_refptr<IndexedDBBackingStore> backing_store4 = 167 scoped_refptr<IndexedDBBackingStore> backing_store4 =
167 IndexedDBBackingStore::Open( 168 IndexedDBBackingStore::Open(
168 factory, origin, path, request_context_getter, &data_loss_info, 169 factory, origin, path, request_context_getter, &data_loss_info,
169 &disk_full, &mock_leveldb_factory, task_runner, clean_journal, &s); 170 &disk_full, &mock_leveldb_factory, task_runner, clean_journal, &s);
170 ASSERT_TRUE(s.IsIOError()); 171 ASSERT_TRUE(s.IsIOError());
171 } 172 }
172 173
173 } // namespace 174 } // namespace
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_class_factory.cc ('k') | content/browser/indexed_db/leveldb/leveldb_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698