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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/sync/syncable/syncable.h" | 24 #include "chrome/browser/sync/syncable/syncable.h" |
25 #include "chrome/browser/sync/util/cryptographer.h" | 25 #include "chrome/browser/sync/util/cryptographer.h" |
26 #include "chrome/common/deprecated/event_sys.h" | 26 #include "chrome/common/deprecated/event_sys.h" |
27 | 27 |
28 namespace sync_api { class BaseTransaction; } | 28 namespace sync_api { class BaseTransaction; } |
29 | 29 |
30 namespace syncable { | 30 namespace syncable { |
31 | 31 |
32 struct DirectoryManagerEvent { | 32 struct DirectoryManagerEvent { |
33 enum { | 33 enum { |
34 OPEN_FAILED, | |
35 OPENED, | |
36 CLOSED, | 34 CLOSED, |
37 CLOSED_ALL, | 35 CLOSED_ALL, |
38 SHUTDOWN, | 36 SHUTDOWN, |
39 } what_happened; | 37 } what_happened; |
40 std::string dirname; | 38 std::string dirname; |
41 DirOpenResult error; // Only for OPEN_FAILED. | |
42 typedef DirectoryManagerEvent EventType; | 39 typedef DirectoryManagerEvent EventType; |
43 static inline bool IsChannelShutdownEvent(const EventType& event) { | 40 static inline bool IsChannelShutdownEvent(const EventType& event) { |
44 return SHUTDOWN == event.what_happened; | 41 return SHUTDOWN == event.what_happened; |
45 } | 42 } |
46 }; | 43 }; |
47 | 44 |
48 DirectoryManagerEvent DirectoryManagerShutdownEvent(); | 45 DirectoryManagerEvent DirectoryManagerShutdownEvent(); |
49 | 46 |
50 class DirectoryManager { | 47 class DirectoryManager { |
51 public: | 48 public: |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool good_; | 119 bool good_; |
123 // Ensure that the programmer checks good before using the ScopedDirLookup. | 120 // Ensure that the programmer checks good before using the ScopedDirLookup. |
124 // This member should can be removed if it ever shows up in profiling | 121 // This member should can be removed if it ever shows up in profiling |
125 bool good_checked_; | 122 bool good_checked_; |
126 DirectoryManager* const dirman_; | 123 DirectoryManager* const dirman_; |
127 }; | 124 }; |
128 | 125 |
129 } // namespace syncable | 126 } // namespace syncable |
130 | 127 |
131 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_ | 128 #endif // CHROME_BROWSER_SYNC_SYNCABLE_DIRECTORY_MANAGER_H_ |
OLD | NEW |