| 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. | |
| 100 scoped_ptr<RlzValueStore> store_; | 98 scoped_ptr<RlzValueStore> store_; |
| 101 #elif defined(OS_CHROMEOS) | |
| 102 class RlzValueStoreChromeOS* store_; | |
| 103 #endif | |
| 104 #if defined(OS_WIN) | 99 #if defined(OS_WIN) |
| 105 LibMutex lock_; | 100 LibMutex lock_; |
| 106 #elif defined(OS_MACOSX) | 101 #elif defined(OS_MACOSX) |
| 107 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 102 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 108 #endif | 103 #endif |
| 109 }; | 104 }; |
| 110 | 105 |
| 111 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) | 106 #if defined(OS_POSIX) |
| 112 namespace testing { | 107 namespace testing { |
| 113 // Prefix |directory| to the path where the RLZ data file lives, for tests. | 108 // Prefix |directory| to the path where the RLZ data file lives, for tests. |
| 114 void SetRlzStoreDirectory(const FilePath& directory); | 109 void SetRlzStoreDirectory(const FilePath& directory); |
| 110 |
| 111 // Returns the path of the file used as data store. |
| 112 std::string RlzStoreFilenameStr(); |
| 115 } // namespace testing | 113 } // namespace testing |
| 116 #endif // defined(OS_MACOSX) || defined(OS_CHROMEOS) | 114 #endif // defined(OS_POSIX) |
| 117 | |
| 118 #if defined(OS_MACOSX) | |
| 119 namespace testing { | |
| 120 // Returns the path of the plist file used as data store. | |
| 121 std::string RlzPlistFilenameStr(); | |
| 122 } // namespace testing | |
| 123 #endif // defined(OS_MACOSX) | |
| 124 | |
| 125 | 115 |
| 126 } // namespace rlz_lib | 116 } // namespace rlz_lib |
| 127 | 117 |
| 128 #endif // RLZ_VALUE_STORE_H_ | 118 #endif // RLZ_VALUE_STORE_H_ |
| OLD | NEW |