OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 RLZ_VALUE_STORE_H_ | 5 #ifndef RLZ_VALUE_STORE_H_ |
6 #define RLZ_VALUE_STORE_H_ | 6 #define RLZ_VALUE_STORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "rlz/lib/rlz_enums.h" | 10 #include "rlz/lib/rlz_enums.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 public: | 88 public: |
89 ScopedRlzValueStoreLock(); | 89 ScopedRlzValueStoreLock(); |
90 ~ScopedRlzValueStoreLock(); | 90 ~ScopedRlzValueStoreLock(); |
91 | 91 |
92 // Returns a RlzValueStore protected by a cross-process lock, or NULL if the | 92 // Returns a RlzValueStore protected by a cross-process lock, or NULL if the |
93 // lock can't be obtained. The lifetime of the returned object is limited to | 93 // lock can't be obtained. The lifetime of the returned object is limited to |
94 // the lifetime of this ScopedRlzValueStoreLock object. | 94 // the lifetime of this ScopedRlzValueStoreLock object. |
95 RlzValueStore* GetStore(); | 95 RlzValueStore* GetStore(); |
96 | 96 |
97 private: | 97 private: |
| 98 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 99 // On ChromeOS, there is a singleton instance of RlzValueStore. |
98 scoped_ptr<RlzValueStore> store_; | 100 scoped_ptr<RlzValueStore> store_; |
| 101 #elif defined(OS_CHROMEOS) |
| 102 class RlzValueStoreChromeOS* store_; |
| 103 #endif |
99 #if defined(OS_WIN) | 104 #if defined(OS_WIN) |
100 LibMutex lock_; | 105 LibMutex lock_; |
101 #elif defined(OS_MACOSX) | 106 #elif defined(OS_MACOSX) |
102 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 107 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
103 #endif | 108 #endif |
104 }; | 109 }; |
105 | 110 |
106 #if defined(OS_MACOSX) | 111 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) |
107 namespace testing { | 112 namespace testing { |
108 // Prefix |directory| to the path where the RLZ data file lives, for tests. | 113 // Prefix |directory| to the path where the RLZ data file lives, for tests. |
109 void SetRlzStoreDirectory(const FilePath& directory); | 114 void SetRlzStoreDirectory(const FilePath& directory); |
| 115 } // namespace testing |
| 116 #endif // defined(OS_MACOSX) || defined(OS_CHROMEOS) |
110 | 117 |
| 118 #if defined(OS_MACOSX) |
| 119 namespace testing { |
111 // Returns the path of the plist file used as data store. | 120 // Returns the path of the plist file used as data store. |
112 std::string RlzPlistFilenameStr(); | 121 std::string RlzPlistFilenameStr(); |
113 } // namespace testing | 122 } // namespace testing |
114 #endif // defined(OS_MACOSX) | 123 #endif // defined(OS_MACOSX) |
115 | 124 |
116 | 125 |
117 } // namespace rlz_lib | 126 } // namespace rlz_lib |
118 | 127 |
119 #endif // RLZ_VALUE_STORE_H_ | 128 #endif // RLZ_VALUE_STORE_H_ |
OLD | NEW |