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

Side by Side Diff: chrome/browser/value_store/value_store_frontend.h

Issue 10545128: Unrevert r141537: Add extensions::StateStore and use that instead of (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix.crash Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
6 #define CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/callback.h"
12 #include "base/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "base/threading/non_thread_safe.h"
17 #include "base/values.h"
18
19 // A frontend for a LeveldbValueStore, for use on the UI thread.
20 class ValueStoreFrontend
21 : public base::SupportsWeakPtr<ValueStoreFrontend>,
22 public base::NonThreadSafe {
23 public:
24 typedef base::Callback<void(scoped_ptr<base::Value>)> ReadCallback;
25
26 explicit ValueStoreFrontend(const FilePath& db_path);
27 ~ValueStoreFrontend();
28
29 // Retrieves a value from the database asynchronously, passing a copy to
30 // |callback| when ready. NULL is passed if no matching entry is found.
31 void Get(const std::string& key, const ReadCallback& callback);
32
33 // Sets a value with the given key.
34 void Set(const std::string& key, scoped_ptr<base::Value> value);
35
36 // Removes the value with the given key.
37 void Remove(const std::string& key);
38
39 private:
40 class Backend;
41
42 // A helper class to manage lifetime of the backing ValueStore, which lives
43 // on the FILE thread.
44 scoped_refptr<Backend> backend_;
45
46 DISALLOW_COPY_AND_ASSIGN(ValueStoreFrontend);
47 };
48
49 #endif // CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
OLDNEW
« no previous file with comments | « chrome/browser/value_store/testing_value_store_unittest.cc ('k') | chrome/browser/value_store/value_store_frontend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698