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

Unified Diff: chrome/browser/extensions/activity_log/activity_database.h

Issue 19234003: Extension activity log database refactoring (step 2) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/activity_log/activity_database.h
diff --git a/chrome/browser/extensions/activity_log/activity_database.h b/chrome/browser/extensions/activity_log/activity_database.h
index f7472e905a7fb2afc217e9156584be95d546a156..6724fefe7516f10276ebe63230920fd6a8c83f1e 100644
--- a/chrome/browser/extensions/activity_log/activity_database.h
+++ b/chrome/browser/extensions/activity_log/activity_database.h
@@ -93,20 +93,9 @@ class ActivityDatabase {
// update the database schema if needed.
void Init(const base::FilePath& db_name);
- // The ActivityLog should call this to kill the ActivityDatabase.
+ // An ActivityLogPolicy should call this to kill the ActivityDatabase.
void Close();
- void LogInitFailure();
-
- // Record a DOMction in the database.
- void RecordDOMAction(scoped_refptr<DOMAction> action);
-
- // Record a APIAction in the database.
- void RecordAPIAction(scoped_refptr<APIAction> action);
-
- // Record a BlockedAction in the database.
- void RecordBlockedAction(scoped_refptr<BlockedAction> action);
-
// Record an Action in the database.
void RecordAction(scoped_refptr<Action> action);
@@ -126,20 +115,30 @@ class ActivityDatabase {
void SetClockForTesting(base::Clock* clock);
void SetTimerForTesting(int milliseconds);
+ // A helper method for initializing or upgrading a database table. The
+ // content_fields array should list the names of all of the columns in the
+ // database. The field_types should specify the types of the corresponding
+ // columns (e.g., INTEGER or LONGVARCHAR). There should be the same number of
+ // field_types as content_fields, since the two arrays should correspond.
+ static bool InitializeTable(sql::Connection* db,
+ const char* table_name,
+ const char* content_fields[],
+ const char* field_types[],
+ const int num_content_fields);
+
private:
// This should never be invoked by another class. Use Close() to order a
// suicide.
virtual ~ActivityDatabase();
- sql::InitStatus InitializeTable(const char* table_name,
- const char* table_structure);
-
// When we're in batched mode (which is on by default), we write to the db
// every X minutes instead of on every API call. This prevents the annoyance
// of writing to disk multiple times a second.
void StartTimer();
void RecordBatchedActions();
+ void LogInitFailure();
+
// If an error is unrecoverable or occurred while we were trying to close
// the database properly, we take "emergency" actions: break any outstanding
// transactions, raze the database, and close. When next opened, the

Powered by Google App Engine
This is Rietveld 408576698