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 // This used to do a lot of TLS-based management of multiple Directory objects. | 5 // This used to do a lot of TLS-based management of multiple Directory objects. |
6 // We now can access Directory objects from any thread for general purpose | 6 // We now can access Directory objects from any thread for general purpose |
7 // operations and we only ever have one Directory, so this class isn't doing | 7 // operations and we only ever have one Directory, so this class isn't doing |
8 // anything too fancy besides keeping calling and access conventions the same | 8 // anything too fancy besides keeping calling and access conventions the same |
9 // for now. | 9 // for now. |
10 // TODO(timsteele): We can probably nuke this entire class and use raw | 10 // TODO(timsteele): We can probably nuke this entire class and use raw |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 }; | 47 }; |
48 | 48 |
49 DirectoryManagerEvent DirectoryManagerShutdownEvent(); | 49 DirectoryManagerEvent DirectoryManagerShutdownEvent(); |
50 | 50 |
51 class DirectoryManager { | 51 class DirectoryManager { |
52 public: | 52 public: |
53 typedef EventChannel<DirectoryManagerEvent> Channel; | 53 typedef EventChannel<DirectoryManagerEvent> Channel; |
54 | 54 |
55 // root_path specifies where db is stored. | 55 // root_path specifies where db is stored. |
56 explicit DirectoryManager(const FilePath& root_path); | 56 explicit DirectoryManager(const FilePath& root_path); |
57 ~DirectoryManager(); | 57 virtual ~DirectoryManager(); |
58 | 58 |
59 static const FilePath GetSyncDataDatabaseFilename(); | 59 static const FilePath GetSyncDataDatabaseFilename(); |
60 const FilePath GetSyncDataDatabasePath() const; | 60 const FilePath GetSyncDataDatabasePath() const; |
61 | 61 |
62 // Opens a directory. Returns false on error. | 62 // Opens a directory. Returns false on error. |
63 // Name parameter is the the user's login, | 63 // Name parameter is the the user's login, |
64 // MUST already have been converted to a common case. | 64 // MUST already have been converted to a common case. |
65 bool Open(const std::string& name); | 65 bool Open(const std::string& name); |
66 | 66 |
67 // Marks a directory as closed. It might take a while until all the | 67 // Marks a directory as closed. It might take a while until all the |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 bool good_; | 123 bool good_; |
124 // Ensure that the programmer checks good before using the ScopedDirLookup. | 124 // Ensure that the programmer checks good before using the ScopedDirLookup. |
125 // This member should can be removed if it ever shows up in profiling | 125 // This member should can be removed if it ever shows up in profiling |
126 bool good_checked_; | 126 bool good_checked_; |
127 DirectoryManager* const dirman_; | 127 DirectoryManager* const dirman_; |
128 }; | 128 }; |
129 | 129 |
130 } // namespace syncable | 130 } // namespace syncable |
131 | 131 |
132 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_ | 132 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_ |
OLD | NEW |