Chromium Code Reviews| 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 <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <cerrno> | 10 #include <cerrno> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 leveldb::DB** db, | 119 leveldb::DB** db, |
| 120 std::unique_ptr<const leveldb::FilterPolicy>* filter_policy) { | 120 std::unique_ptr<const leveldb::FilterPolicy>* filter_policy) { |
| 121 filter_policy->reset(leveldb::NewBloomFilterPolicy(10)); | 121 filter_policy->reset(leveldb::NewBloomFilterPolicy(10)); |
| 122 leveldb::Options options; | 122 leveldb::Options options; |
| 123 options.comparator = comparator; | 123 options.comparator = comparator; |
| 124 options.create_if_missing = true; | 124 options.create_if_missing = true; |
| 125 options.paranoid_checks = true; | 125 options.paranoid_checks = true; |
| 126 options.filter_policy = filter_policy->get(); | 126 options.filter_policy = filter_policy->get(); |
| 127 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; | 127 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; |
| 128 options.compression = leveldb::kSnappyCompression; | 128 options.compression = leveldb::kSnappyCompression; |
| 129 options.write_buffer_size = leveldb_env::WriteBufferSize(path); | |
|
michaeln
2016/08/16 19:41:22
or maybe only expose the xxxForDiskSize() function
| |
| 129 | 130 |
| 130 // For info about the troubles we've run into with this parameter, see: | 131 // For info about the troubles we've run into with this parameter, see: |
| 131 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 | 132 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 |
| 132 options.max_open_files = 80; | 133 options.max_open_files = 80; |
| 133 options.env = env; | 134 options.env = env; |
| 134 | 135 |
| 135 // ChromiumEnv assumes UTF8, converts back to FilePath before using. | 136 // ChromiumEnv assumes UTF8, converts back to FilePath before using. |
| 136 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), db); | 137 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), db); |
| 137 | 138 |
| 138 return s; | 139 return s; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 dump->AddString("file_name", "", file_name_for_tracing); | 469 dump->AddString("file_name", "", file_name_for_tracing); |
| 469 | 470 |
| 470 // Memory is allocated from system allocator (malloc). | 471 // Memory is allocated from system allocator (malloc). |
| 471 pmd->AddSuballocation(dump->guid(), | 472 pmd->AddSuballocation(dump->guid(), |
| 472 base::trace_event::MemoryDumpManager::GetInstance() | 473 base::trace_event::MemoryDumpManager::GetInstance() |
| 473 ->system_allocator_pool_name()); | 474 ->system_allocator_pool_name()); |
| 474 return true; | 475 return true; |
| 475 } | 476 } |
| 476 | 477 |
| 477 } // namespace content | 478 } // namespace content |
| OLD | NEW |