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

Unified Diff: components/data_reduction_proxy/core/browser/db_data_owner.cc

Issue 1173343009: LevelDB storage for data reduction proxy to store data usage stats. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove wrong const Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/data_reduction_proxy/core/browser/db_data_owner.cc
diff --git a/components/data_reduction_proxy/core/browser/db_data_owner.cc b/components/data_reduction_proxy/core/browser/db_data_owner.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bcadc8cbaf79f51ba232ff5de8b8c93845f13021
--- /dev/null
+++ b/components/data_reduction_proxy/core/browser/db_data_owner.cc
@@ -0,0 +1,49 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/data_reduction_proxy/core/browser/db_data_owner.h"
+
+#include "base/logging.h"
+#include "base/threading/sequenced_worker_pool.h"
+#include "components/data_reduction_proxy/core/browser/data_store.h"
+#include "components/data_reduction_proxy/core/browser/data_usage_store.h"
+#include "components/data_reduction_proxy/proto/data_store.pb.h"
+
+namespace data_reduction_proxy {
+
+DBDataOwner::DBDataOwner(scoped_ptr<DataStore> store)
+ : store_(store.Pass()),
+ data_usage_(new DataUsageStore(store_.get())),
+ weak_factory_(this) {
+ sequence_checker_.DetachFromSequence();
+}
+
+DBDataOwner::~DBDataOwner() {
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread());
+}
+
+void DBDataOwner::InitializeOnDBThread() {
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread());
+
+ store_->InitializeOnDBThread();
+}
+
+void DBDataOwner::LoadCurrentDataUsageBucket(DataUsageBucket* bucket) {
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread());
+
+ data_usage_->LoadCurrentDataUsageBucket(bucket);
+}
+
+void DBDataOwner::StoreCurrentDataUsageBucket(
+ scoped_ptr<DataUsageBucket> current) {
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread());
+
+ data_usage_->StoreCurrentDataUsageBucket(*current.get());
+}
+
+base::WeakPtr<DBDataOwner> DBDataOwner::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
+} // namespace data_reduction_proxy
« no previous file with comments | « components/data_reduction_proxy/core/browser/db_data_owner.h ('k') | components/data_reduction_proxy/proto/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698