| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/nullable_string16.h" | 13 #include "base/nullable_string16.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "sql/connection.h" | 15 #include "sql/connection.h" |
| 16 #include "webkit/dom_storage/dom_storage_export.h" |
| 16 #include "webkit/dom_storage/dom_storage_types.h" | 17 #include "webkit/dom_storage/dom_storage_types.h" |
| 17 | 18 |
| 18 namespace dom_storage { | 19 namespace dom_storage { |
| 19 | 20 |
| 20 // Represents a SQLite based backing for DOM storage data. This | 21 // Represents a SQLite based backing for DOM storage data. This |
| 21 // class is designed to be used on a single thread. | 22 // class is designed to be used on a single thread. |
| 22 class DomStorageDatabase { | 23 class DOM_STORAGE_EXPORT DomStorageDatabase { |
| 23 public: | 24 public: |
| 24 static FilePath GetJournalFilePath(const FilePath& database_path); | 25 static FilePath GetJournalFilePath(const FilePath& database_path); |
| 25 | 26 |
| 26 explicit DomStorageDatabase(const FilePath& file_path); | 27 explicit DomStorageDatabase(const FilePath& file_path); |
| 27 virtual ~DomStorageDatabase(); // virtual for unit testing | 28 virtual ~DomStorageDatabase(); // virtual for unit testing |
| 28 | 29 |
| 29 // Reads all the key, value pairs stored in the database and returns | 30 // Reads all the key, value pairs stored in the database and returns |
| 30 // them. |result| is assumed to be empty and any duplicate keys will | 31 // them. |result| is assumed to be empty and any duplicate keys will |
| 31 // be overwritten. If the database exists on disk then it will be | 32 // be overwritten. If the database exists on disk then it will be |
| 32 // opened. If it does not exist then it will not be created and | 33 // opened. If it does not exist then it will not be created and |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const FilePath file_path_; | 110 const FilePath file_path_; |
| 110 scoped_ptr<sql::Connection> db_; | 111 scoped_ptr<sql::Connection> db_; |
| 111 bool failed_to_open_; | 112 bool failed_to_open_; |
| 112 bool tried_to_recreate_; | 113 bool tried_to_recreate_; |
| 113 bool known_to_be_empty_; | 114 bool known_to_be_empty_; |
| 114 }; | 115 }; |
| 115 | 116 |
| 116 } // namespace dom_storage | 117 } // namespace dom_storage |
| 117 | 118 |
| 118 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ | 119 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_DATABASE_H_ |
| OLD | NEW |