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

Side by Side Diff: content/browser/indexed_db/leveldb/leveldb_database.cc

Issue 2243363002: IndexedDB: Limit the size of a leveldb write buffer to minimize disk space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | third_party/leveldatabase/env_chromium.h » ('j') | third_party/leveldatabase/env_chromium_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698