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

Side by Side Diff: chrome/browser/budget_service/budget_database.h

Issue 2107173002: Add the future storage framework for the BudgetDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2016 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_BUDGET_SERVICE_BUDGET_DATABASE_H_
6 #define CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_
7
8 #include <memory>
9
10 #include "base/callback_forward.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/run_loop.h"
13 #include "base/sequenced_task_runner.h"
14 #include "components/leveldb_proto/proto_database.h"
15 #include "url/gurl.h"
16
17 namespace chrome_browser_budget_service {
18 class Budget;
19 }
20
21 using chrome_browser_budget_service::Budget;
Peter Beverloo 2016/06/29 13:37:27 `using` declarations in headers are forbidden by o
harkness 2016/06/30 10:41:57 Yes, the package names was truly horrible.
22
23 class BudgetDatabase {
Peter Beverloo 2016/06/29 13:37:28 ++docs (why does it do what it does, why does it n
harkness 2016/06/30 10:41:57 Done.
24 public:
25 BudgetDatabase(const base::FilePath& database_dir,
26 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
27 ~BudgetDatabase();
28
29 // Callback for the basic GetBudget call.
30 using GetValueCallback =
31 base::Callback<void(bool success, std::unique_ptr<Budget>)>;
32
33 // Callback for setting a budget value.
34 using SetValueCallback = base::Callback<void(bool success)>;
35
36 void OnDatabaseInit(bool success);
Peter Beverloo 2016/06/29 13:37:27 This should be private.
harkness 2016/06/30 10:41:57 Done.
37 void GetValue(const GURL& origin, const GetValueCallback& callback);
38 void SetValue(const GURL& origin,
39 const Budget& budget,
40 const SetValueCallback& callback);
41
42 private:
43 // The database for storing budget information.
44 std::unique_ptr<leveldb_proto::ProtoDatabase<Budget>> db_;
45
46 base::WeakPtrFactory<BudgetDatabase> weak_ptr_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(BudgetDatabase);
49 };
50
51 #endif // CHROME_BROWSER_BUDGET_SERVICE_BUDGET_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698