| OLD | NEW | 
|    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 #ifndef CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |    5 #ifndef CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 
|    6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |    6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 
|    7  |    7  | 
|    8 #include <stdint.h> |    8 #include <stdint.h> | 
|    9  |    9  | 
|   10 #include <map> |   10 #include <map> | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   95   // Opens the database at file_path_ if it exists already and creates it if |   95   // Opens the database at file_path_ if it exists already and creates it if | 
|   96   // |create_if_needed| is true. Returns true if the database was opened, false |   96   // |create_if_needed| is true. Returns true if the database was opened, false | 
|   97   // if the opening failed or was not necessary (the database doesn't exist and |   97   // if the opening failed or was not necessary (the database doesn't exist and | 
|   98   // |create_if_needed| is false). The possible failures are: |   98   // |create_if_needed| is false). The possible failures are: | 
|   99   // - leveldb cannot open the database. |   99   // - leveldb cannot open the database. | 
|  100   // - The database is in an inconsistent or errored state. |  100   // - The database is in an inconsistent or errored state. | 
|  101   bool LazyOpen(bool create_if_needed); |  101   bool LazyOpen(bool create_if_needed); | 
|  102  |  102  | 
|  103   // Tries to open the database at file_path_, assigns |db| to point to the |  103   // Tries to open the database at file_path_, assigns |db| to point to the | 
|  104   // opened leveldb::DB instance. |  104   // opened leveldb::DB instance. | 
|  105   leveldb::Status TryToOpen(leveldb::DB** db); |  105   leveldb::Status TryToOpen(std::unique_ptr<leveldb::DB>* db); | 
|  106  |  106  | 
|  107   // Returns true if the database is already open, false otherwise. |  107   // Returns true if the database is already open, false otherwise. | 
|  108   bool IsOpen() const; |  108   bool IsOpen() const; | 
|  109  |  109  | 
|  110   // Helpers for checking caller erros, invariants and database errors. All |  110   // Helpers for checking caller erros, invariants and database errors. All | 
|  111   // these return |ok|, for chaining. |  111   // these return |ok|, for chaining. | 
|  112   bool CallerErrorCheck(bool ok) const; |  112   bool CallerErrorCheck(bool ok) const; | 
|  113   bool ConsistencyCheck(bool ok); |  113   bool ConsistencyCheck(bool ok); | 
|  114   bool DatabaseErrorCheck(bool ok); |  114   bool DatabaseErrorCheck(bool ok); | 
|  115  |  115  | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  217   // The number of database operations in progress. We need this so that we can |  217   // The number of database operations in progress. We need this so that we can | 
|  218   // delete an inconsistent database at the right moment. |  218   // delete an inconsistent database at the right moment. | 
|  219   int operation_count_; |  219   int operation_count_; | 
|  220  |  220  | 
|  221   DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase); |  221   DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase); | 
|  222 }; |  222 }; | 
|  223  |  223  | 
|  224 }  // namespace content |  224 }  // namespace content | 
|  225  |  225  | 
|  226 #endif  // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ |  226 #endif  // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ | 
| OLD | NEW |