| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 6 #define CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 6 #define CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/gtest_prod_util.h" |
| 12 #include "chrome/browser/sync/syncable/dir_open_result.h" | 13 #include "chrome/browser/sync/syncable/dir_open_result.h" |
| 13 #include "chrome/browser/sync/syncable/model_type.h" | 14 #include "chrome/browser/sync/syncable/model_type.h" |
| 14 #include "chrome/browser/sync/syncable/syncable.h" | 15 #include "chrome/browser/sync/syncable/syncable.h" |
| 15 #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST | |
| 16 | 16 |
| 17 extern "C" { | 17 extern "C" { |
| 18 struct sqlite3; | 18 struct sqlite3; |
| 19 struct sqlite3_stmt; | 19 struct sqlite3_stmt; |
| 20 } | 20 } |
| 21 | 21 |
| 22 class SQLStatement; | 22 class SQLStatement; |
| 23 | 23 |
| 24 namespace sync_pb { | 24 namespace sync_pb { |
| 25 class EntitySpecifics; | 25 class EntitySpecifics; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 Directory::KernelLoadInfo* kernel_load_info); | 69 Directory::KernelLoadInfo* kernel_load_info); |
| 70 | 70 |
| 71 // Updates the on-disk store with the input |snapshot| as a database | 71 // Updates the on-disk store with the input |snapshot| as a database |
| 72 // transaction. Does NOT open any syncable transactions as this would cause | 72 // transaction. Does NOT open any syncable transactions as this would cause |
| 73 // opening transactions elsewhere to block on synchronous I/O. | 73 // opening transactions elsewhere to block on synchronous I/O. |
| 74 // DO NOT CALL THIS FROM MORE THAN ONE THREAD EVER. Also, whichever thread | 74 // DO NOT CALL THIS FROM MORE THAN ONE THREAD EVER. Also, whichever thread |
| 75 // calls SaveChanges *must* be the thread that owns/destroys |this|. | 75 // calls SaveChanges *must* be the thread that owns/destroys |this|. |
| 76 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot); | 76 virtual bool SaveChanges(const Directory::SaveChangesSnapshot& snapshot); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion67To68); | 79 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion67To68); |
| 80 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion68To69); | 80 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion68To69); |
| 81 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion69To70); | 81 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion69To70); |
| 82 FRIEND_TEST(DirectoryBackingStoreTest, MigrateVersion70To71); | 82 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion70To71); |
| 83 FRIEND_TEST(DirectoryBackingStoreTest, ModelTypeIds); | 83 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds); |
| 84 FRIEND_TEST(DirectoryBackingStoreTest, Corruption); | 84 FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption); |
| 85 FRIEND_TEST(MigrationTest, ToCurrentVersion); | 85 FRIEND_TEST_ALL_PREFIXES(MigrationTest, ToCurrentVersion); |
| 86 | 86 |
| 87 // General Directory initialization and load helpers. | 87 // General Directory initialization and load helpers. |
| 88 DirOpenResult InitializeTables(); | 88 DirOpenResult InitializeTables(); |
| 89 // Returns an sqlite return code, usually SQLITE_DONE. | 89 // Returns an sqlite return code, usually SQLITE_DONE. |
| 90 int CreateTables(); | 90 int CreateTables(); |
| 91 | 91 |
| 92 // Create 'share_info' or 'temp_share_info' depending on value of | 92 // Create 'share_info' or 'temp_share_info' depending on value of |
| 93 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success. | 93 // is_temporary. Returns an sqlite return code, SQLITE_DONE on success. |
| 94 int CreateShareInfoTable(bool is_temporary); | 94 int CreateShareInfoTable(bool is_temporary); |
| 95 // Create 'metas' or 'temp_metas' depending on value of is_temporary. | 95 // Create 'metas' or 'temp_metas' depending on value of is_temporary. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // Set to true if migration left some old columns around that need to be | 175 // Set to true if migration left some old columns around that need to be |
| 176 // discarded. | 176 // discarded. |
| 177 bool needs_column_refresh_; | 177 bool needs_column_refresh_; |
| 178 | 178 |
| 179 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); | 179 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 } // namespace syncable | 182 } // namespace syncable |
| 183 | 183 |
| 184 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 184 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| OLD | NEW |