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

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

Issue 10900037: Adding more histograms to ResourcePrefetchPredictor. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ 5 #ifndef CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
6 #define CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ 6 #define CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/synchronization/cancellation_flag.h" 9 #include "base/synchronization/cancellation_flag.h"
10 10
11 class Profile;
12
11 namespace sql { 13 namespace sql {
12 class Connection; 14 class Connection;
13 } 15 }
14 16
15 namespace predictors { 17 namespace predictors {
16 18
17 // Base class for all tables in the PredictorDatabase. 19 // Base class for all tables in the PredictorDatabase.
18 // 20 //
19 // Refcounted as it is created and destroyed in the UI thread but all database 21 // Refcounted as it is created and destroyed in the UI thread but all database
20 // related functions need to happen in the database thread. 22 // related functions need to happen in the database thread.
21 class PredictorTableBase 23 class PredictorTableBase
22 : public base::RefCountedThreadSafe<PredictorTableBase> { 24 : public base::RefCountedThreadSafe<PredictorTableBase> {
23 protected: 25 protected:
24 PredictorTableBase(); 26 PredictorTableBase();
25 virtual ~PredictorTableBase(); 27 virtual ~PredictorTableBase();
26 28
27 // DB thread functions. 29 // DB thread functions.
28 virtual void CreateTableIfNonExistent() = 0; 30 virtual void CreateTableIfNonExistent() = 0;
29 virtual void LogDatabaseStats() = 0; 31 virtual void LogDatabaseStats(Profile* profile) = 0;
30 void Initialize(sql::Connection* db); 32 void Initialize(sql::Connection* db);
31 void SetCancelled(); 33 void SetCancelled();
32 sql::Connection* DB(); 34 sql::Connection* DB();
33 void ResetDB(); 35 void ResetDB();
34 36
35 bool CantAccessDatabase(); 37 bool CantAccessDatabase();
36 38
37 private: 39 private:
38 base::CancellationFlag cancelled_; 40 base::CancellationFlag cancelled_;
39 41
40 friend class base::RefCountedThreadSafe<PredictorTableBase>; 42 friend class base::RefCountedThreadSafe<PredictorTableBase>;
41 43
42 sql::Connection* db_; 44 sql::Connection* db_;
43 45
44 DISALLOW_COPY_AND_ASSIGN(PredictorTableBase); 46 DISALLOW_COPY_AND_ASSIGN(PredictorTableBase);
45 }; 47 };
46 48
47 } // namespace predictors 49 } // namespace predictors
48 50
49 #endif // CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_ 51 #endif // CHROME_BROWSER_PREDICTORS_PREDICTOR_TABLE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698