Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Unified Diff: rlz/chromeos/lib/rlz_value_store_chromeos.h

Issue 11308196: [cros] RlzValueStore made protected by a cross-process lock and not persisted over browser lifetime… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/rlz/rlz_unittest.cc ('k') | rlz/chromeos/lib/rlz_value_store_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: rlz/chromeos/lib/rlz_value_store_chromeos.h
diff --git a/rlz/chromeos/lib/rlz_value_store_chromeos.h b/rlz/chromeos/lib/rlz_value_store_chromeos.h
index c9456a828e9552f8f8ab33bb3109fdb78bdaee57..476041894e97a38c818cd80da7e3a7d8972862c0 100644
--- a/rlz/chromeos/lib/rlz_value_store_chromeos.h
+++ b/rlz/chromeos/lib/rlz_value_store_chromeos.h
@@ -5,8 +5,9 @@
#ifndef RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
#define RLZ_CHROMEOS_LIB_RLZ_VALUE_STORE_CHROMEOS_H_
-#include "base/prefs/persistent_pref_store.h"
+#include "base/file_path.h"
#include "base/threading/non_thread_safe.h"
+#include "base/values.h"
#include "rlz/lib/rlz_value_store.h"
namespace base {
@@ -15,28 +16,19 @@ class SequencedTaskRunner;
class Value;
}
-template <typename T> struct DefaultSingletonTraits;
-
namespace rlz_lib {
-// An implementation of RlzValueStore for ChromeOS. Unlike Mac and Win
-// counterparts, it's non thread-safe and should only be accessed on a single
-// Thread instance that has a MessageLoop.
-class RlzValueStoreChromeOS : public RlzValueStore {
+// An implementation of RlzValueStore for ChromeOS.
+class RlzValueStoreChromeOS : public RlzValueStore,
+ public base::NonThreadSafe {
public:
- static RlzValueStoreChromeOS* GetInstance();
-
- // Sets the MessageLoopProxy that underlying PersistentPrefStore will post I/O
- // tasks to. Must be called before the first GetInstance() call.
- static void SetIOTaskRunner(base::SequencedTaskRunner* io_task_runner);
-
- // Must be invoked during shutdown to commit pending I/O.
- static void Cleanup();
+ // // Sets the task runner that will be used by ImportantFileWriter for write
+ // // operations.
+ // static void SetFileTaskRunner(base::SequencedTaskRunner* file_task_runner);
- // Resets the store to its initial state. Should only be used for testing.
- // Same restrictions as for calling GetInstance() for the first time apply,
- // i.e. must call SetIOTaskRunner first.
- static void ResetForTesting();
+ // Creates new instance and synchronously reads data from file.
+ RlzValueStoreChromeOS(const FilePath& store_path);
+ virtual ~RlzValueStoreChromeOS();
// RlzValueStore overrides:
virtual bool HasAccess(AccessType type) OVERRIDE;
@@ -68,28 +60,23 @@ class RlzValueStoreChromeOS : public RlzValueStore {
virtual void CollectGarbage() OVERRIDE;
private:
- friend struct DefaultSingletonTraits<RlzValueStoreChromeOS>;
-
- // Used by JsonPrefStore for write operations.
- static base::SequencedTaskRunner* io_task_runner_;
+ // Reads RLZ store from file.
+ void ReadStore();
- static bool created_;
+ // Writes RLZ store back to file.
+ void WriteStore();
- RlzValueStoreChromeOS();
- virtual ~RlzValueStoreChromeOS();
-
- // Initializes RLZ store.
- void ReadPrefs();
-
- // Retrieves list at path |list_name| from JSON store.
- base::ListValue* GetList(std::string list_name);
// Adds |value| to list at |list_name| path in JSON store.
bool AddValueToList(std::string list_name, base::Value* value);
// Removes |value| from list at |list_name| path in JSON store.
bool RemoveValueFromList(std::string list_name, const base::Value& value);
- // Store with RLZ data.
- scoped_refptr<PersistentPrefStore> rlz_store_;
+ // In-memory store with RLZ data.
+ scoped_ptr<base::DictionaryValue> rlz_store_;
+
+ FilePath store_path_;
+
+ bool read_only_;
DISALLOW_COPY_AND_ASSIGN(RlzValueStoreChromeOS);
};
« no previous file with comments | « chrome/browser/rlz/rlz_unittest.cc ('k') | rlz/chromeos/lib/rlz_value_store_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698