| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "rlz/lib/rlz_enums.h" | 16 #include "rlz/lib/rlz_enums.h" |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include "rlz/win/lib/lib_mutex.h" | 19 #include "rlz/win/lib/lib_mutex.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
| 23 #include "base/mac/scoped_nsautorelease_pool.h" | 23 #include "base/mac/scoped_nsautorelease_pool.h" |
| 24 #endif | 24 #endif |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 public: | 92 public: |
| 93 ScopedRlzValueStoreLock(); | 93 ScopedRlzValueStoreLock(); |
| 94 ~ScopedRlzValueStoreLock(); | 94 ~ScopedRlzValueStoreLock(); |
| 95 | 95 |
| 96 // Returns a RlzValueStore protected by a cross-process lock, or NULL if the | 96 // Returns a RlzValueStore protected by a cross-process lock, or NULL if the |
| 97 // lock can't be obtained. The lifetime of the returned object is limited to | 97 // lock can't be obtained. The lifetime of the returned object is limited to |
| 98 // the lifetime of this ScopedRlzValueStoreLock object. | 98 // the lifetime of this ScopedRlzValueStoreLock object. |
| 99 RlzValueStore* GetStore(); | 99 RlzValueStore* GetStore(); |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 scoped_ptr<RlzValueStore> store_; | 102 std::unique_ptr<RlzValueStore> store_; |
| 103 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
| 104 LibMutex lock_; | 104 LibMutex lock_; |
| 105 #elif defined(OS_MACOSX) | 105 #elif defined(OS_MACOSX) |
| 106 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 106 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 107 #endif | 107 #endif |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 #if defined(OS_POSIX) | 110 #if defined(OS_POSIX) |
| 111 namespace testing { | 111 namespace testing { |
| 112 // Prefix |directory| to the path where the RLZ data file lives, for tests. | 112 // Prefix |directory| to the path where the RLZ data file lives, for tests. |
| 113 void SetRlzStoreDirectory(const base::FilePath& directory); | 113 void SetRlzStoreDirectory(const base::FilePath& directory); |
| 114 | 114 |
| 115 // Returns the path of the file used as data store. | 115 // Returns the path of the file used as data store. |
| 116 std::string RlzStoreFilenameStr(); | 116 std::string RlzStoreFilenameStr(); |
| 117 } // namespace testing | 117 } // namespace testing |
| 118 #endif // defined(OS_POSIX) | 118 #endif // defined(OS_POSIX) |
| 119 | 119 |
| 120 } // namespace rlz_lib | 120 } // namespace rlz_lib |
| 121 | 121 |
| 122 #endif // RLZ_VALUE_STORE_H_ | 122 #endif // RLZ_VALUE_STORE_H_ |
| OLD | NEW |