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

Side by Side Diff: chrome/browser/predictors/predictor_table_base.h

Issue 9610006: Refactoring, moving and renaming the NetworkActionPredictor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changing DB to PKS from RefcountedPKS and addressing comments. Created 8 years, 9 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 unified diff | Download patch
OLDNEW
(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
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
34 base::CancellationFlag cancelled_;
35
36 private:
37 friend class base::RefCountedThreadSafe<PredictorTableBase>;
38
39 sql::Connection* db_;
40
41 DISALLOW_COPY_AND_ASSIGN(PredictorTableBase);
42 };
43
44 } // namespace predictors
45
46 #endif // CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698