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

Side by Side Diff: content/browser/notifications/notification_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/notifications/notification_database.h" 5 #include "content/browser/notifications/notification_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 options.paranoid_checks = true; 127 options.paranoid_checks = true;
128 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue; 128 options.reuse_logs = leveldb_env::kDefaultLogReuseOptionValue;
129 options.filter_policy = filter_policy_.get(); 129 options.filter_policy = filter_policy_.get();
130 if (IsInMemoryDatabase()) { 130 if (IsInMemoryDatabase()) {
131 env_.reset(leveldb::NewMemEnv(leveldb::Env::Default())); 131 env_.reset(leveldb::NewMemEnv(leveldb::Env::Default()));
132 options.env = env_.get(); 132 options.env = env_.get();
133 } 133 }
134 134
135 leveldb::DB* db = nullptr; 135 leveldb::DB* db = nullptr;
136 Status status = LevelDBStatusToStatus( 136 Status status = LevelDBStatusToStatus(
137 leveldb::DB::Open(options, path_.AsUTF8Unsafe(), &db)); 137 leveldb_env::DBRegistry::Open(options, path_.AsUTF8Unsafe(), &db));
138 if (status != STATUS_OK) 138 if (status != STATUS_OK)
139 return status; 139 return status;
140 140
141 state_ = STATE_INITIALIZED; 141 state_ = STATE_INITIALIZED;
142 db_.reset(db); 142 db_.reset(db);
143 143
144 return ReadNextPersistentNotificationId(); 144 return ReadNextPersistentNotificationId();
145 } 145 }
146 146
147 int64_t NotificationDatabase::GetNextPersistentNotificationId() { 147 int64_t NotificationDatabase::GetNextPersistentNotificationId() {
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 notification_database_data.notification_id); 388 notification_database_data.notification_id);
389 } 389 }
390 390
391 if (deleted_notification_ids->empty()) 391 if (deleted_notification_ids->empty())
392 return STATUS_OK; 392 return STATUS_OK;
393 393
394 return LevelDBStatusToStatus(db_->Write(leveldb::WriteOptions(), &batch)); 394 return LevelDBStatusToStatus(db_->Write(leveldb::WriteOptions(), &batch));
395 } 395 }
396 396
397 } // namespace content 397 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698