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

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

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/browser/ui/webui/screenshot_source.h ('k') | chrome/browser/webdata/web_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_ 5 #ifndef CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
6 #define CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_ 6 #define CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 16
17 class ValueStore;
18
19 namespace base {
17 class FilePath; 20 class FilePath;
18 class ValueStore; 21 }
19 22
20 // A frontend for a LeveldbValueStore, for use on the UI thread. 23 // A frontend for a LeveldbValueStore, for use on the UI thread.
21 class ValueStoreFrontend 24 class ValueStoreFrontend
22 : public base::SupportsWeakPtr<ValueStoreFrontend>, 25 : public base::SupportsWeakPtr<ValueStoreFrontend>,
23 public base::NonThreadSafe { 26 public base::NonThreadSafe {
24 public: 27 public:
25 typedef base::Callback<void(scoped_ptr<base::Value>)> ReadCallback; 28 typedef base::Callback<void(scoped_ptr<base::Value>)> ReadCallback;
26 29
27 ValueStoreFrontend(); 30 ValueStoreFrontend();
28 explicit ValueStoreFrontend(const FilePath& db_path); 31 explicit ValueStoreFrontend(const base::FilePath& db_path);
29 // This variant is useful for testing (using a mock ValueStore). 32 // This variant is useful for testing (using a mock ValueStore).
30 explicit ValueStoreFrontend(ValueStore* value_store); 33 explicit ValueStoreFrontend(ValueStore* value_store);
31 ~ValueStoreFrontend(); 34 ~ValueStoreFrontend();
32 35
33 void Init(const FilePath& db_path); 36 void Init(const base::FilePath& db_path);
34 37
35 // Retrieves a value from the database asynchronously, passing a copy to 38 // Retrieves a value from the database asynchronously, passing a copy to
36 // |callback| when ready. NULL is passed if no matching entry is found. 39 // |callback| when ready. NULL is passed if no matching entry is found.
37 void Get(const std::string& key, const ReadCallback& callback); 40 void Get(const std::string& key, const ReadCallback& callback);
38 41
39 // Sets a value with the given key. 42 // Sets a value with the given key.
40 void Set(const std::string& key, scoped_ptr<base::Value> value); 43 void Set(const std::string& key, scoped_ptr<base::Value> value);
41 44
42 // Removes the value with the given key. 45 // Removes the value with the given key.
43 void Remove(const std::string& key); 46 void Remove(const std::string& key);
44 47
45 private: 48 private:
46 class Backend; 49 class Backend;
47 50
48 // A helper class to manage lifetime of the backing ValueStore, which lives 51 // A helper class to manage lifetime of the backing ValueStore, which lives
49 // on the FILE thread. 52 // on the FILE thread.
50 scoped_refptr<Backend> backend_; 53 scoped_refptr<Backend> backend_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(ValueStoreFrontend); 55 DISALLOW_COPY_AND_ASSIGN(ValueStoreFrontend);
53 }; 56 };
54 57
55 #endif // CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_ 58 #endif // CHROME_BROWSER_VALUE_STORE_VALUE_STORE_FRONTEND_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/screenshot_source.h ('k') | chrome/browser/webdata/web_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698