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.
5 #include "chrome/browser/predictors/predictor_table_base.h"
7 #include "base/logging.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "sql/connection.h"
11 using content::BrowserThread
;
13 namespace predictors
{
15 PredictorTableBase::PredictorTableBase() : db_(NULL
) {
18 PredictorTableBase::~PredictorTableBase() {
21 void PredictorTableBase::Initialize(sql::Connection
* db
) {
22 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB
));
24 CreateTableIfNonExistent();
27 void PredictorTableBase::SetCancelled() {
31 sql::Connection
* PredictorTableBase::DB() {
32 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB
));
36 void PredictorTableBase::ResetDB() {
37 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB
));
41 bool PredictorTableBase::CantAccessDatabase() {
42 CHECK(BrowserThread::CurrentlyOn(BrowserThread::DB
));
43 return cancelled_
.IsSet() || !db_
;
46 } // namespace predictors