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

Unified Diff: chrome/browser/policy/cloud/resource_cache.h

Issue 23868021: Prepare ExternalPolicyDataUpdater and ResourceCache for blocking pool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-uploading due to rietveld flake. Created 7 years, 3 months 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
Index: chrome/browser/policy/cloud/resource_cache.h
diff --git a/chrome/browser/policy/cloud/resource_cache.h b/chrome/browser/policy/cloud/resource_cache.h
index c9a1d825ebe1952219e95001abc2f9a6f2fbd7a2..1f56837ece762cd86892283f819607abc5b501bc 100644
--- a/chrome/browser/policy/cloud/resource_cache.h
+++ b/chrome/browser/policy/cloud/resource_cache.h
@@ -11,7 +11,11 @@
#include "base/basictypes.h"
#include "base/files/file_path.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/memory/ref_counted.h"
+
+namespace base {
+class SequencedTaskRunner;
+}
namespace policy {
@@ -19,11 +23,12 @@ namespace policy {
// a subkey, and can be queried by (key, subkey) or (key) lookups.
// The contents of the cache have to be manually cleared using Delete() or
// PurgeOtherSubkeys().
-// Instances of this class can be created on any thread, but from then on must
-// be always used from the same thread, and it must support file I/O.
-class ResourceCache : public base::NonThreadSafe {
+// The class can be instantiated on any thread but from then on, it must be
+// accessed via the |task_runner| only. The |task_runner| must support file I/O.
+class ResourceCache {
public:
- explicit ResourceCache(const base::FilePath& cache_path);
+ explicit ResourceCache(const base::FilePath& cache_path,
+ scoped_refptr<base::SequencedTaskRunner> task_runner);
virtual ~ResourceCache();
// Stores |data| under (key, subkey). Returns true if the store suceeded, and
@@ -72,6 +77,9 @@ class ResourceCache : public base::NonThreadSafe {
base::FilePath cache_dir_;
+ // Task runner that |this| runs on.
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceCache);
};
« no previous file with comments | « chrome/browser/policy/cloud/external_policy_data_updater.cc ('k') | chrome/browser/policy/cloud/resource_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698