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

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

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

Powered by Google App Engine
This is Rietveld 408576698