Commit 47a8860f authored by thestig's avatar thestig Committed by Commit bot

Remove activity_log's Util::DropObsoleteTables().

After three years, the obsolete tables are probably gone for good.

Review-Url: https://codereview.chromium.org/2318833003
Cr-Commit-Position: refs/heads/master@{#417349}
parent 58ddb817
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/json/json_string_value_serializer.h" #include "base/json/json_string_value_serializer.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/stringprintf.h"
#include "base/time/clock.h" #include "base/time/clock.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h" #include "chrome/browser/extensions/activity_log/activity_action_constants.h"
...@@ -24,14 +23,6 @@ using content::BrowserThread; ...@@ -24,14 +23,6 @@ using content::BrowserThread;
namespace constants = activity_log_constants; namespace constants = activity_log_constants;
namespace {
// Obsolete database tables: these should be dropped from the database if
// found.
const char* const kObsoleteTables[] = {"activitylog_apis",
"activitylog_blocked",
"activitylog_urls"};
} // namespace
namespace extensions { namespace extensions {
ActivityLogPolicy::ActivityLogPolicy(Profile* profile) {} ActivityLogPolicy::ActivityLogPolicy(Profile* profile) {}
...@@ -164,19 +155,4 @@ void ActivityLogPolicy::Util::ComputeDatabaseTimeBounds(const base::Time& now, ...@@ -164,19 +155,4 @@ void ActivityLogPolicy::Util::ComputeDatabaseTimeBounds(const base::Time& now,
} }
} }
// static
bool ActivityLogPolicy::Util::DropObsoleteTables(sql::Connection* db) {
for (size_t i = 0; i < arraysize(kObsoleteTables); i++) {
const char* table_name = kObsoleteTables[i];
if (db->DoesTableExist(table_name)) {
std::string drop_statement =
base::StringPrintf("DROP TABLE %s", table_name);
if (!db->Execute(drop_statement.c_str())) {
return false;
}
}
}
return true;
}
} // namespace extensions } // namespace extensions
...@@ -120,12 +120,6 @@ class ActivityLogPolicy { ...@@ -120,12 +120,6 @@ class ActivityLogPolicy {
int64_t* early_bound, int64_t* early_bound,
int64_t* late_bound); int64_t* late_bound);
// Deletes obsolete database tables from an activity log database. This
// can be used in InitDatabase() methods of ActivityLogDatabasePolicy
// subclasses to clean up data from old versions of the activity logging
// code. Returns true on success, false on database error.
static bool DropObsoleteTables(sql::Connection* db);
private: private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Util); DISALLOW_IMPLICIT_CONSTRUCTORS(Util);
}; };
......
...@@ -179,9 +179,6 @@ CountingPolicy::CountingPolicy(Profile* profile) ...@@ -179,9 +179,6 @@ CountingPolicy::CountingPolicy(Profile* profile)
CountingPolicy::~CountingPolicy() {} CountingPolicy::~CountingPolicy() {}
bool CountingPolicy::InitDatabase(sql::Connection* db) { bool CountingPolicy::InitDatabase(sql::Connection* db) {
if (!Util::DropObsoleteTables(db))
return false;
if (!string_table_.Initialize(db)) if (!string_table_.Initialize(db))
return false; return false;
if (!url_table_.Initialize(db)) if (!url_table_.Initialize(db))
......
...@@ -57,9 +57,6 @@ FullStreamUIPolicy::FullStreamUIPolicy(Profile* profile) ...@@ -57,9 +57,6 @@ FullStreamUIPolicy::FullStreamUIPolicy(Profile* profile)
FullStreamUIPolicy::~FullStreamUIPolicy() {} FullStreamUIPolicy::~FullStreamUIPolicy() {}
bool FullStreamUIPolicy::InitDatabase(sql::Connection* db) { bool FullStreamUIPolicy::InitDatabase(sql::Connection* db) {
if (!Util::DropObsoleteTables(db))
return false;
// Create the unified activity log entry table. // Create the unified activity log entry table.
return ActivityDatabase::InitializeTable(db, return ActivityDatabase::InitializeTable(db,
kTableName, kTableName,
...@@ -83,8 +80,7 @@ bool FullStreamUIPolicy::FlushDatabase(sql::Connection* db) { ...@@ -83,8 +80,7 @@ bool FullStreamUIPolicy::FlushDatabase(sql::Connection* db) {
sql::Statement statement(db->GetCachedStatement( sql::Statement statement(db->GetCachedStatement(
sql::StatementID(SQL_FROM_HERE), sql_str.c_str())); sql::StatementID(SQL_FROM_HERE), sql_str.c_str()));
Action::ActionVector::size_type i; for (size_t i = 0; i != queued_actions_.size(); ++i) {
for (i = 0; i != queued_actions_.size(); ++i) {
const Action& action = *queued_actions_[i]; const Action& action = *queued_actions_[i];
statement.Reset(true); statement.Reset(true);
statement.BindString(0, action.extension_id()); statement.BindString(0, action.extension_id());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment