Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / predictors / predictor_table_base.h
blob2c115fbf765b666b4012e05ff4053823d64664a5
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 #ifndef CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
6 #define CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/synchronization/cancellation_flag.h"
11 namespace sql {
12 class Connection;
15 namespace predictors {
17 // Base class for all tables in the PredictorDatabase.
19 // Refcounted as it is created and destroyed in the UI thread but all database
20 // related functions need to happen in the database thread.
21 class PredictorTableBase
22 : public base::RefCountedThreadSafe<PredictorTableBase> {
23 protected:
24 PredictorTableBase();
25 virtual ~PredictorTableBase();
27 // DB thread functions.
28 virtual void CreateTableIfNonExistent() = 0;
29 virtual void LogDatabaseStats() = 0;
30 void Initialize(sql::Connection* db);
31 void SetCancelled();
32 sql::Connection* DB();
33 void ResetDB();
35 bool CantAccessDatabase();
37 private:
38 base::CancellationFlag cancelled_;
40 friend class base::RefCountedThreadSafe<PredictorTableBase>;
42 sql::Connection* db_;
44 DISALLOW_COPY_AND_ASSIGN(PredictorTableBase);
47 } // namespace predictors
49 #endif // CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_