| 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 std::unique_ptr<leveldb::DB>* db, | 119 std::unique_ptr<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 = |
| 130 leveldb_env::WriteBufferSize(base::SysInfo::AmountOfTotalDiskSpace(path)); |
| 129 | 131 |
| 130 // For info about the troubles we've run into with this parameter, see: | 132 // 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 | 133 // https://code.google.com/p/chromium/issues/detail?id=227313#c11 |
| 132 options.max_open_files = 80; | 134 options.max_open_files = 80; |
| 133 options.env = env; | 135 options.env = env; |
| 134 | 136 |
| 135 // ChromiumEnv assumes UTF8, converts back to FilePath before using. | 137 // ChromiumEnv assumes UTF8, converts back to FilePath before using. |
| 136 leveldb::DB* db_ptr = nullptr; | 138 leveldb::DB* db_ptr = nullptr; |
| 137 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), &db_ptr); | 139 leveldb::Status s = leveldb::DB::Open(options, path.AsUTF8Unsafe(), &db_ptr); |
| 138 db->reset(db_ptr); | 140 db->reset(db_ptr); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 dump->AddString("file_name", "", file_name_for_tracing); | 473 dump->AddString("file_name", "", file_name_for_tracing); |
| 472 | 474 |
| 473 // Memory is allocated from system allocator (malloc). | 475 // Memory is allocated from system allocator (malloc). |
| 474 pmd->AddSuballocation(dump->guid(), | 476 pmd->AddSuballocation(dump->guid(), |
| 475 base::trace_event::MemoryDumpManager::GetInstance() | 477 base::trace_event::MemoryDumpManager::GetInstance() |
| 476 ->system_allocator_pool_name()); | 478 ->system_allocator_pool_name()); |
| 477 return true; | 479 return true; |
| 478 } | 480 } |
| 479 | 481 |
| 480 } // namespace content | 482 } // namespace content |
| OLD | NEW |