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

Side by Side Diff: chrome/browser/sync/syncable/directory_backing_store.h

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 9
10 #include "base/file_path.h"
10 #include "chrome/browser/sync/syncable/dir_open_result.h" 11 #include "chrome/browser/sync/syncable/dir_open_result.h"
11 #include "chrome/browser/sync/syncable/syncable.h" 12 #include "chrome/browser/sync/syncable/syncable.h"
12 13
13 extern "C" { 14 extern "C" {
14 struct sqlite3; 15 struct sqlite3;
15 struct sqlite3_stmt; 16 struct sqlite3_stmt;
16 } 17 }
17 18
18 namespace syncable { 19 namespace syncable {
19 20
(...skipping 18 matching lines...) Expand all
38 // thread *must* be the thread that owns / is responsible for destroying 39 // thread *must* be the thread that owns / is responsible for destroying
39 // the DBS. 40 // the DBS.
40 // This way, any thread may open a Directory (which today can be either the 41 // This way, any thread may open a Directory (which today can be either the
41 // AuthWatcherThread or SyncCoreThread) and Load its DBS. The first time 42 // AuthWatcherThread or SyncCoreThread) and Load its DBS. The first time
42 // SaveChanges is called a new sqlite3 handle is created, and it will get closed 43 // SaveChanges is called a new sqlite3 handle is created, and it will get closed
43 // when the DBS is destroyed, which is the reason for the requirement that the 44 // when the DBS is destroyed, which is the reason for the requirement that the
44 // thread that "uses" the DBS is the thread that destroys it. 45 // thread that "uses" the DBS is the thread that destroys it.
45 class DirectoryBackingStore { 46 class DirectoryBackingStore {
46 public: 47 public:
47 DirectoryBackingStore(const PathString& dir_name, 48 DirectoryBackingStore(const PathString& dir_name,
48 const PathString& backing_filepath); 49 const FilePath& backing_filepath);
49 50
50 virtual ~DirectoryBackingStore(); 51 virtual ~DirectoryBackingStore();
51 52
52 // Loads and drops all currently persisted meta entries into 53 // Loads and drops all currently persisted meta entries into
53 // |entry_bucket|, all currently persisted xattrs in |xattrs_bucket|, 54 // |entry_bucket|, all currently persisted xattrs in |xattrs_bucket|,
54 // and loads appropriate persisted kernel info in |info_bucket|. 55 // and loads appropriate persisted kernel info in |info_bucket|.
55 // NOTE: On success (return value of OPENED), the buckets are populated with 56 // NOTE: On success (return value of OPENED), the buckets are populated with
56 // newly allocated items, meaning ownership is bestowed upon the caller. 57 // newly allocated items, meaning ownership is bestowed upon the caller.
57 DirOpenResult Load(MetahandlesIndex* entry_bucket, 58 DirOpenResult Load(MetahandlesIndex* entry_bucket,
58 ExtendedAttributes* xattrs_bucket, 59 ExtendedAttributes* xattrs_bucket,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // The handle to our sqlite on-disk store for initialization and loading, and 107 // The handle to our sqlite on-disk store for initialization and loading, and
107 // for saving changes periodically via SaveChanges, respectively. 108 // for saving changes periodically via SaveChanges, respectively.
108 // TODO(timsteele): We should only have one handle here. The reason we need 109 // TODO(timsteele): We should only have one handle here. The reason we need
109 // two at the moment is because the DB can be opened by either the AuthWatcher 110 // two at the moment is because the DB can be opened by either the AuthWatcher
110 // or SyncCore threads, but SaveChanges is always called by the latter. We 111 // or SyncCore threads, but SaveChanges is always called by the latter. We
111 // need to change initialization so the DB is only accessed from one thread. 112 // need to change initialization so the DB is only accessed from one thread.
112 sqlite3* load_dbhandle_; 113 sqlite3* load_dbhandle_;
113 sqlite3* save_dbhandle_; 114 sqlite3* save_dbhandle_;
114 115
115 PathString dir_name_; 116 PathString dir_name_;
116 PathString backing_filepath_; 117 FilePath backing_filepath_;
117 118
118 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore); 119 DISALLOW_COPY_AND_ASSIGN(DirectoryBackingStore);
119 }; 120 };
120 121
121 } // namespace syncable 122 } // namespace syncable
122 123
123 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_ 124 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_BACKING_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.cc ('k') | chrome/browser/sync/syncable/directory_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698