OLD | NEW |
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/leveldb/leveldb_database.h" | 5 #include "content/browser/indexed_db/leveldb/leveldb_database.h" |
6 | 6 |
7 #include <cerrno> | 7 #include <cerrno> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 leveldb::Env* env, | 96 leveldb::Env* env, |
97 const base::FilePath& path, | 97 const base::FilePath& path, |
98 leveldb::DB** db, | 98 leveldb::DB** db, |
99 scoped_ptr<const leveldb::FilterPolicy>* filter_policy) { | 99 scoped_ptr<const leveldb::FilterPolicy>* filter_policy) { |
100 filter_policy->reset(leveldb::NewBloomFilterPolicy(10)); | 100 filter_policy->reset(leveldb::NewBloomFilterPolicy(10)); |
101 leveldb::Options options; | 101 leveldb::Options options; |
102 options.comparator = comparator; | 102 options.comparator = comparator; |
103 options.create_if_missing = true; | 103 options.create_if_missing = true; |
104 options.paranoid_checks = true; | 104 options.paranoid_checks = true; |
105 options.filter_policy = filter_policy->get(); | 105 options.filter_policy = filter_policy->get(); |
106 options.reuse_logs = false; | 106 options.reuse_logs = true; |
107 options.compression = leveldb::kSnappyCompression; | 107 options.compression = leveldb::kSnappyCompression; |
108 | 108 |
109 // For info about the troubles we've run into with this parameter, see: | 109 // For info about the troubles we've run into with this parameter, see: |
110 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 | 110 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 |
111 options.max_open_files = 80; | 111 options.max_open_files = 80; |
112 options.env = env; | 112 options.env = env; |
113 | 113 |
114 // ChromiumEnv assumes UTF8, converts back to FilePath before using. | 114 // ChromiumEnv assumes UTF8, converts back to FilePath before using. |
115 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), db); | 115 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), db); |
116 | 116 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 const leveldb::Slice start_slice = MakeSlice(start); | 429 const leveldb::Slice start_slice = MakeSlice(start); |
430 const leveldb::Slice stop_slice = MakeSlice(stop); | 430 const leveldb::Slice stop_slice = MakeSlice(stop); |
431 // NULL batch means just wait for earlier writes to be done | 431 // NULL batch means just wait for earlier writes to be done |
432 db_->Write(leveldb::WriteOptions(), NULL); | 432 db_->Write(leveldb::WriteOptions(), NULL); |
433 db_->CompactRange(&start_slice, &stop_slice); | 433 db_->CompactRange(&start_slice, &stop_slice); |
434 } | 434 } |
435 | 435 |
436 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } | 436 void LevelDBDatabase::CompactAll() { db_->CompactRange(NULL, NULL); } |
437 | 437 |
438 } // namespace content | 438 } // namespace content |
OLD | NEW |