OLD | NEW |
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 #ifndef CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ |
6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ | 6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <set> | 11 #include <set> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/sequence_checker.h" | 16 #include "base/sequence_checker.h" |
17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 | 20 |
21 namespace leveldb { | 21 namespace leveldb { |
22 class DB; | 22 class DB; |
23 class Env; | 23 class Env; |
24 class FilterPolicy; | 24 class FilterPolicy; |
25 class WriteBatch; | 25 class WriteBatch; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 bool IsInMemoryDatabase() const { return path_.empty(); } | 178 bool IsInMemoryDatabase() const { return path_.empty(); } |
179 | 179 |
180 // Exposes the LevelDB database used to back this notification database. | 180 // Exposes the LevelDB database used to back this notification database. |
181 // Should only be used for testing purposes. | 181 // Should only be used for testing purposes. |
182 leveldb::DB* GetDBForTesting() const { return db_.get(); } | 182 leveldb::DB* GetDBForTesting() const { return db_.get(); } |
183 | 183 |
184 base::FilePath path_; | 184 base::FilePath path_; |
185 | 185 |
186 int64_t next_notification_id_ = 0; | 186 int64_t next_notification_id_ = 0; |
187 | 187 |
188 scoped_ptr<const leveldb::FilterPolicy> filter_policy_; | 188 std::unique_ptr<const leveldb::FilterPolicy> filter_policy_; |
189 | 189 |
190 // The declaration order for these members matters, as |db_| depends on |env_| | 190 // The declaration order for these members matters, as |db_| depends on |env_| |
191 // and thus has to be destructed first. | 191 // and thus has to be destructed first. |
192 scoped_ptr<leveldb::Env> env_; | 192 std::unique_ptr<leveldb::Env> env_; |
193 scoped_ptr<leveldb::DB> db_; | 193 std::unique_ptr<leveldb::DB> db_; |
194 | 194 |
195 State state_ = STATE_UNINITIALIZED; | 195 State state_ = STATE_UNINITIALIZED; |
196 | 196 |
197 base::SequenceChecker sequence_checker_; | 197 base::SequenceChecker sequence_checker_; |
198 | 198 |
199 DISALLOW_COPY_AND_ASSIGN(NotificationDatabase); | 199 DISALLOW_COPY_AND_ASSIGN(NotificationDatabase); |
200 }; | 200 }; |
201 | 201 |
202 } // namespace content | 202 } // namespace content |
203 | 203 |
204 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ | 204 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_DATABASE_H_ |
OLD | NEW |