Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 #include "components/data_reduction_proxy/core/browser/db_service.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 #include "base/threading/sequenced_worker_pool.h" | |
| 9 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stor e.h" | |
| 10 #include "components/data_reduction_proxy/core/browser/data_usage_store.h" | |
| 11 #include "components/data_reduction_proxy/proto/store.pb.h" | |
| 12 #include "content/public/browser/browser_thread.h" | |
| 13 | |
| 14 namespace data_reduction_proxy { | |
| 15 | |
| 16 DBService::DBService(scoped_ptr<DataReductionProxyStore> store) | |
| 17 : store_(store.Pass()), | |
| 18 data_usage_(new DataUsageStore(store_.get())), | |
| 19 weak_factory_(this) { | |
| 20 } | |
| 21 | |
| 22 DBService::~DBService() { | |
| 23 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | |
|
jeremyim
2015/07/01 21:31:01
Use task_runner, not the named thread pool.
Not at Google. Contact bengr
2015/07/01 23:17:38
Used sequence_checker.
| |
| 24 } | |
| 25 | |
| 26 void DBService::InitializeOnDBThread() { | |
| 27 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | |
| 28 | |
| 29 store_->InitializeOnDBThread(); | |
| 30 } | |
| 31 | |
| 32 void DBService::LoadCurrentDataUsageBucket(DataUsageBucket* bucket) { | |
| 33 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | |
| 34 | |
| 35 data_usage_->LoadCurrentDataUsageBucket(bucket); | |
| 36 } | |
| 37 | |
| 38 void DBService::StoreCurrentDataUsageBucket( | |
| 39 scoped_ptr<DataUsageBucket> current) { | |
| 40 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | |
| 41 | |
| 42 data_usage_->StoreCurrentDataUsageBucket(*current.get()); | |
| 43 } | |
| 44 | |
| 45 base::WeakPtr<DBService> DBService::GetWeakPtr() { | |
| 46 return weak_factory_.GetWeakPtr(); | |
| 47 } | |
| 48 | |
| 49 } // namespace data_reduction_proxy | |
| OLD | NEW |