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

Side by Side Diff: content/browser/dom_storage/session_storage_database.cc

Issue 2855953002: leveldb: Add DBTracker for exposing databases to Chrome's memory-infra. (Closed)
Patch Set: Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/dom_storage/session_storage_database.h" 5 #include "content/browser/dom_storage/session_storage_database.h"
6 6
7 #include <inttypes.h> 7 #include <inttypes.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 leveldb::Options options; 440 leveldb::Options options;
441 // The directory exists but a valid leveldb database might not exist inside it 441 // The directory exists but a valid leveldb database might not exist inside it
442 // (e.g., a subset of the needed files might be missing). Handle this 442 // (e.g., a subset of the needed files might be missing). Handle this
443 // situation gracefully by creating the database now. 443 // situation gracefully by creating the database now.
444 options.max_open_files = 0; // Use minimum. 444 options.max_open_files = 0; // Use minimum.
445 options.create_if_missing = true; 445 options.create_if_missing = true;
446 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; 446 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
447 // Default write_buffer_size is 4 MB but that might leave a 3.999 447 // Default write_buffer_size is 4 MB but that might leave a 3.999
448 // memory allocation in RAM from a log file recovery. 448 // memory allocation in RAM from a log file recovery.
449 options.write_buffer_size = 64 * 1024; 449 options.write_buffer_size = 64 * 1024;
450 return leveldb::DB::Open(options, file_path_.AsUTF8Unsafe(), db); 450 return leveldb_env::DBRegistry::Open(options, file_path_.AsUTF8Unsafe(), db);
451 } 451 }
452 452
453 bool SessionStorageDatabase::IsOpen() const { 453 bool SessionStorageDatabase::IsOpen() const {
454 return db_.get() != NULL; 454 return db_.get() != NULL;
455 } 455 }
456 456
457 bool SessionStorageDatabase::CallerErrorCheck(bool ok) const { 457 bool SessionStorageDatabase::CallerErrorCheck(bool ok) const {
458 DCHECK(ok); 458 DCHECK(ok);
459 return ok; 459 return ok;
460 } 460 }
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 std::string SessionStorageDatabase::MapKey(const std::string& map_id, 790 std::string SessionStorageDatabase::MapKey(const std::string& map_id,
791 const std::string& key) { 791 const std::string& key) {
792 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str()); 792 return base::StringPrintf("map-%s-%s", map_id.c_str(), key.c_str());
793 } 793 }
794 794
795 const char* SessionStorageDatabase::NextMapIdKey() { 795 const char* SessionStorageDatabase::NextMapIdKey() {
796 return "next-map-id"; 796 return "next-map-id";
797 } 797 }
798 798
799 } // namespace content 799 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698