| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 5 #ifndef SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 6 #define SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 6 #define SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/threading/non_thread_safe.h" | 11 #include "base/threading/non_thread_safe.h" |
| 12 #include "sql/connection.h" | 12 #include "sql/connection.h" |
| 13 #include "sql/statement.h" | 13 #include "sql/statement.h" |
| 14 #include "sync/base/sync_export.h" |
| 14 #include "sync/internal_api/public/base/model_type.h" | 15 #include "sync/internal_api/public/base/model_type.h" |
| 15 #include "sync/syncable/dir_open_result.h" | 16 #include "sync/syncable/dir_open_result.h" |
| 16 #include "sync/syncable/directory.h" | 17 #include "sync/syncable/directory.h" |
| 17 #include "sync/syncable/metahandle_set.h" | 18 #include "sync/syncable/metahandle_set.h" |
| 18 | 19 |
| 19 namespace sync_pb { | 20 namespace sync_pb { |
| 20 class EntitySpecifics; | 21 class EntitySpecifics; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace syncer { | 24 namespace syncer { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 34 // | 35 // |
| 35 // The DirectoryBackingStore will own an sqlite lock on its database for most of | 36 // The DirectoryBackingStore will own an sqlite lock on its database for most of |
| 36 // its lifetime. You must not have two DirectoryBackingStore objects accessing | 37 // its lifetime. You must not have two DirectoryBackingStore objects accessing |
| 37 // the database simultaneously. Because the lock exists at the database level, | 38 // the database simultaneously. Because the lock exists at the database level, |
| 38 // not even two separate browser instances would be able to acquire it | 39 // not even two separate browser instances would be able to acquire it |
| 39 // simultaneously. | 40 // simultaneously. |
| 40 // | 41 // |
| 41 // This class is abstract so that we can extend it in interesting ways for use | 42 // This class is abstract so that we can extend it in interesting ways for use |
| 42 // in tests. The concrete class used in non-test scenarios is | 43 // in tests. The concrete class used in non-test scenarios is |
| 43 // OnDiskDirectoryBackingStore. | 44 // OnDiskDirectoryBackingStore. |
| 44 class DirectoryBackingStore : public base::NonThreadSafe { | 45 class SYNC_EXPORT_PRIVATE DirectoryBackingStore : public base::NonThreadSafe { |
| 45 public: | 46 public: |
| 46 explicit DirectoryBackingStore(const std::string& dir_name); | 47 explicit DirectoryBackingStore(const std::string& dir_name); |
| 47 virtual ~DirectoryBackingStore(); | 48 virtual ~DirectoryBackingStore(); |
| 48 | 49 |
| 49 // Loads and drops all currently persisted meta entries into |entry_bucket| | 50 // Loads and drops all currently persisted meta entries into |entry_bucket| |
| 50 // and loads appropriate persisted kernel info into |info_bucket|. | 51 // and loads appropriate persisted kernel info into |info_bucket|. |
| 51 // | 52 // |
| 52 // This function can perform some cleanup tasks behind the scenes. It will | 53 // This function can perform some cleanup tasks behind the scenes. It will |
| 53 // clean up unused entries from the database and migrate to the latest | 54 // clean up unused entries from the database and migrate to the latest |
| 54 // database version. The caller can safely ignore these details. | 55 // database version. The caller can safely ignore these details. |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // discarded. | 172 // discarded. |
| 172 bool needs_column_refresh_; | 173 bool needs_column_refresh_; |
| 173 | 174 |
| 174 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); | 175 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); |
| 175 }; | 176 }; |
| 176 | 177 |
| 177 } // namespace syncable | 178 } // namespace syncable |
| 178 } // namespace syncer | 179 } // namespace syncer |
| 179 | 180 |
| 180 #endif // SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ | 181 #endif // SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ |
| OLD | NEW |