Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: components/sync/syncable/directory_backing_store.h

Issue 2240613002: [Sync] Convert sync to a static library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try getting rid of sync_core source set. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 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 COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 5 #ifndef COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/threading/non_thread_safe.h" 15 #include "base/threading/non_thread_safe.h"
16 #include "components/sync/base/model_type.h" 16 #include "components/sync/base/model_type.h"
17 #include "components/sync/base/sync_export.h"
18 #include "components/sync/syncable/dir_open_result.h" 17 #include "components/sync/syncable/dir_open_result.h"
19 #include "components/sync/syncable/directory.h" 18 #include "components/sync/syncable/directory.h"
20 #include "components/sync/syncable/metahandle_set.h" 19 #include "components/sync/syncable/metahandle_set.h"
21 #include "sql/connection.h" 20 #include "sql/connection.h"
22 #include "sql/statement.h" 21 #include "sql/statement.h"
23 22
24 namespace sync_pb { 23 namespace sync_pb {
25 class EntitySpecifics; 24 class EntitySpecifics;
26 } 25 }
27 26
28 namespace syncer { 27 namespace syncer {
29 namespace syncable { 28 namespace syncable {
30 29
31 SYNC_EXPORT extern const int32_t kCurrentDBVersion; 30 extern const int32_t kCurrentDBVersion;
32 SYNC_EXPORT extern const int32_t kCurrentPageSizeKB; 31 extern const int32_t kCurrentPageSizeKB;
33 32
34 struct ColumnSpec; 33 struct ColumnSpec;
35 34
36 // Interface that provides persistence for a syncable::Directory object. You can 35 // Interface that provides persistence for a syncable::Directory object. You can
37 // load all the persisted data to prime a syncable::Directory on startup by 36 // load all the persisted data to prime a syncable::Directory on startup by
38 // invoking Load. The only other thing you (or more correctly, a Directory) can 37 // invoking Load. The only other thing you (or more correctly, a Directory) can
39 // do here is save any changes that have occurred since calling Load, which can 38 // do here is save any changes that have occurred since calling Load, which can
40 // be done periodically as often as desired. 39 // be done periodically as often as desired.
41 // 40 //
42 // The DirectoryBackingStore will own an sqlite lock on its database for most of 41 // The DirectoryBackingStore will own an sqlite lock on its database for most of
43 // its lifetime. You must not have two DirectoryBackingStore objects accessing 42 // its lifetime. You must not have two DirectoryBackingStore objects accessing
44 // the database simultaneously. Because the lock exists at the database level, 43 // the database simultaneously. Because the lock exists at the database level,
45 // not even two separate browser instances would be able to acquire it 44 // not even two separate browser instances would be able to acquire it
46 // simultaneously. 45 // simultaneously.
47 // 46 //
48 // This class is abstract so that we can extend it in interesting ways for use 47 // This class is abstract so that we can extend it in interesting ways for use
49 // in tests. The concrete class used in non-test scenarios is 48 // in tests. The concrete class used in non-test scenarios is
50 // OnDiskDirectoryBackingStore. 49 // OnDiskDirectoryBackingStore.
51 class SYNC_EXPORT DirectoryBackingStore : public base::NonThreadSafe { 50 class DirectoryBackingStore : public base::NonThreadSafe {
52 public: 51 public:
53 explicit DirectoryBackingStore(const std::string& dir_name); 52 explicit DirectoryBackingStore(const std::string& dir_name);
54 virtual ~DirectoryBackingStore(); 53 virtual ~DirectoryBackingStore();
55 54
56 // Loads and drops all currently persisted meta entries into |handles_map| 55 // Loads and drops all currently persisted meta entries into |handles_map|
57 // and loads appropriate persisted kernel info into |kernel_load_info|. 56 // and loads appropriate persisted kernel info into |kernel_load_info|.
58 // The function determines which entries can be safely dropped and inserts 57 // The function determines which entries can be safely dropped and inserts
59 // their keys into |metahandles_to_purge|. It is up to the caller to 58 // their keys into |metahandles_to_purge|. It is up to the caller to
60 // perform the actual cleanup. 59 // perform the actual cleanup.
61 // 60 //
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // sql::Connection is destroyed/recreated. 261 // sql::Connection is destroyed/recreated.
263 base::Closure catastrophic_error_handler_; 262 base::Closure catastrophic_error_handler_;
264 263
265 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); 264 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore);
266 }; 265 };
267 266
268 } // namespace syncable 267 } // namespace syncable
269 } // namespace syncer 268 } // namespace syncer
270 269
271 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 270 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « components/sync/syncable/directory.h ('k') | components/sync/syncable/directory_backing_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698