OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ | |
6 #define CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/synchronization/cancellation_flag.h" | |
11 | |
12 namespace sql { | |
13 class Connection; | |
14 } | |
15 | |
16 namespace predictors { | |
17 | |
18 // Base class for all tables in the PredictorDatabase. | |
19 // | |
20 // Refcounted as it is created and destroyed in the UI thread but all database | |
21 // related functions need to happen in the database thread. | |
22 class PredictorTableBase | |
dominich
2012/05/08 20:35:28
consider just PredictorTable. It's cleaner.
Shishir
2012/05/08 21:49:03
There is precedence for both kind of naming in the
| |
23 : public base::RefCountedThreadSafe<PredictorTableBase> { | |
24 protected: | |
25 PredictorTableBase(); | |
26 virtual ~PredictorTableBase(); | |
27 | |
28 // DB thread functions. | |
29 virtual void CreateTableIfNonExistent() = 0; | |
30 virtual void LogDatabaseStats() = 0; | |
31 void Initialize(sql::Connection* db); | |
32 sql::Connection* DB(); | |
33 void ResetDB(); | |
34 | |
35 base::CancellationFlag cancelled_; | |
36 | |
37 private: | |
38 friend class base::RefCountedThreadSafe<PredictorTableBase>; | |
39 | |
40 sql::Connection* db_; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(PredictorTableBase); | |
43 }; | |
44 | |
45 } // namespace predictors | |
46 | |
47 #endif // CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ | |
OLD | NEW |